Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // === Checkpoint Streamer V0.3 === //
- // === Released on SA-MP forum only: === //
- // === http://forum.sa-mp.com/showthread.php?t=354636 === //
- // === Credits to Oplosthee, SKAzini & [HiC]TheKiller === //
- #define FILTERSCRIPT
- #include <a_samp>
- new bool:CPMsg[MAX_PLAYERS];
- forward CPCheck();
- stock Float:GetDistanceToPoint(playerid, Float:X2, Float:Y2, Float:Z2) {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- return floatsqroot ( floatpower ( floatabs ( floatsub ( X , X2 ) ) , 2 ) + floatpower ( floatabs ( floatsub ( Y , Y2 ) ) , 2 ) + floatpower ( floatabs ( floatsub ( Z , Z2 ) ) , 2 ) );
- }
- public OnFilterScriptInit() {
- printf("\nSKAzini/Oplosthee's CP Streamer has been loaded. Version: 0.3.\n");
- SetTimer("CPCheck", 500, 1);
- return 1;
- }
- public OnPlayerConnect(playerid) {
- CPMsg[playerid] = true;
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid) {
- if(GetDistanceToPoint(playerid, 2096, 1287, 10)<=2) { //the same X,Y,Z coords as the ones you put into the timer || the 2 should be your checkpoint radius
- if(CPMsg[playerid] == true) {
- CPMsg[playerid] = false;
- SendClientMessage(playerid, 0xFFFFFFAA, "You reached a checkpoint.");//message when standing in a checkpoint
- }
- }
- if(GetDistanceToPoint(playerid, 2030, 1342, 10)<=2) {
- if(CPMsg[playerid] == true) {
- CPMsg[playerid] = false;
- SendClientMessage(playerid, 0xFFFFFFAA, "You reached a checkpoint.");
- }
- }
- return 1;
- }
- public CPCheck() {
- for(new i; i < MAX_PLAYERS; i++) {// a loop that goes through all player
- if(IsPlayerConnected(i)) {//checks if the player is connected
- if(GetDistanceToPoint(i, 2096, 1287, 10) <= 30) {//change 10 to whatever you want the "view distance" to be.
- SetPlayerCheckpoint(i, 2096, 1287, 10, 2);//Change 2 to whatever radius you want (of the checkpoint)
- }
- else if(GetDistanceToPoint(i, 2030, 1342, 10) <= 30) {
- SetPlayerCheckpoint(i, 2030, 1342, 10, 2);
- }
- else {
- DisablePlayerCheckpoint(i);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment