Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // === Checkpoint Streamer V0.1 === //
- // === Credits to Oplosthee (Omni), SKAzini & [HiC]TheKiller === //
- #define FILTERSCRIPT
- #include <a_samp>
- 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 ) );
- }
- new SendMsg[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- printf("\nCheckpoint Streamer by Oplosthee has been loaded\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.");
- }
- if(GetDistanceToPoint(playerid,2030, 1342, 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.");
- }
- }
- return 1;
- }
- 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);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment