Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // === Checkpoint Streamer V0.2 === //
- // === 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 SendMsg[MAX_PLAYERS];
- forward CheckpointCheck();
- 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.2.\n");
- SetTimer("CheckpointCheck", 500, 1);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SendMsg[playerid] = 1;
- 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(SendMsg[playerid] == 1)
- {
- SendMsg[playerid] = 0;
- SendClientMessage(playerid, 0xFFFFFFAA, "You reached a checkpoint.");//message when standing in a checkpoint
- }
- }
- if(GetDistanceToPoint(playerid, 2030, 1342, 10)<=2)
- {
- if(SendMsg[playerid] == 1)
- {
- SendMsg[playerid] = 0;
- SendClientMessage(playerid, 0xFFFFFFAA, "You reached a checkpoint.");
- }
- }
- return 1;
- }
- public CheckpointCheck()
- {
- for(new i; i<MAX_PLAYERS; i++)// a loop that goes though all players
- {
- if(IsPlayerConnected(i))//checks if the player is connected
- {
- if(GetDistanceToPoint(i, 2096, 1287, 10) <= 30) //change 10 to what ever you want the "view distance" to be.
- {
- SetPlayerCheckpoint(i, 2096, 1287, 10, 2);//Change 2 to what ever radius you want (of the checkpoint)
- }
- else if(GetDistanceToPoint(i, 2030, 1342, 10) <= 30)
- {
- SetPlayerCheckpoint(i, 2030, 1342, 10, 2);
- }
- else
- {
- DisablePlayerCheckpoint(i);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement