SA-MP Forums Archive
Checkpoint for all players - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Checkpoint for all players (/showthread.php?tid=448705)



Checkpoint for all players - arjanforgames - 05.07.2013

How can I set a checkpoint for everyone instead of just one player?


Re: Checkpoint for all players - Sasino97 - 05.07.2013

pawn Код:
SetCheckpointForAll(...)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) SetPlayerCheckpoint(...);
    }
}
put the parameters instead of ...


Re: Checkpoint for all players - Guest123 - 05.07.2013

pawn Код:
SetCheckpointForAll(Float:x, Float:y, Float:z, Float:size)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
         {
              SetPlayerCheckpoint(i , Float:x,  Float:y, Float:z, Float:size);
         }
    }
}
edited [GF]Sasino97 pawn ^^

edit: use streamer to use Dynamic Checkpoint


Re: Checkpoint for all players - arjanforgames - 05.07.2013

SetCheckpointForAll not defined.

Please help.


Re: Checkpoint for all players - Sasino97 - 05.07.2013

In fact that was the definition....

The code we gave has to be put outside any function because it is one.
Then use it when you need


Re: Checkpoint for all players - (ETR)Geto244 - 05.07.2013

You put that in your Gm and than you use in your code where you need to create checkpoint forall

pawn Код:
SetCheckpointForAll(Float:x, Float:y, Float:z, Float:size)
{
    for(new i=0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
         {
              SetPlayerCheckpoint(i , Float:x,  Float:y, Float:z, Float:size);
         }
    }
}
In your code you put SetCheckpointForAll(pos x, pos y, pos z, size of checkpoint)

Example:
CMD:race(playerid, params[])
{
SetCheckpointForAll(284.34, 1322.32, 472.90, 3.0);
return 1;
}


Re: Checkpoint for all players - arjanforgames - 05.07.2013

Thanks!