CHECKPOINT - 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 (
/showthread.php?tid=296874)
CHECKPOINT -
jiwan - 13.11.2011
i want to make a checkpont which show to all players
i have no idea
please tell me something
to help me !
Re: CHECKPOINT -
Sascha - 13.11.2011
pawn Код:
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
SetPlayerCheckpoint(i, yourcoords and range);
}
}
Re: CHECKPOINT -
BlackWolf120 - 13.11.2011
well basically this function makes it possible to dislpay actual cp's also to players that have connected after the specific cp has been set.
(so u dont need everything from this function but u can also use it)
pawn Код:
stock SetCheckpointForAll(id, Float:cx, Float:cy, Float:cz, Float:csize)
{
if(id > -1)
{
if(CP_ID != -1)
DisableCheckpointForAll();
for(new i; i != MAX_PLAYERS; i++)
if(SetPlayerCheckpoint(i, cx, cy, cz, csize))
CheckPoint[i] = id;
CP_Data[3] = csize;
CP_Data[0] = cx;
CP_Data[1] = cy;
CP_Data[2] = cz;
CP_ID = id;
return true;
}
return false;
}
To show a cp to all players just use a loop.
Put it into a stock function like in this example.
Then u can simply use only this single line to show a cp to all players connected:
pawn Код:
SetCheckpointForAll(id, Float:cx, Float:cy, Float:cz, Float:csize);
to make the previous stock easier u can simply:
pawn Код:
stock SetCheckpointForAll(id, Float:cx, Float:cy, Float:cz, Float:csize)
{
for(new i; i != MAX_PLAYERS; i++)SetPlayerCheckpoint(i, cx, cy, cz, csize))//foreach loop recommended!
return 1;
}