PDA

View Full Version : CHECKPOINT


jiwan
13/11/2011, 12:47 PM
i want to make a checkpont which show to all players
i have no idea
please tell me something
to help me !

Sascha
13/11/2011, 12:52 PM
for(new i=0; i<GetMaxPlayers(); i++)
{
if(IsPlayerConnected(i))
{
SetPlayerCheckpoint(i, yourcoords and range);
}
}

BlackWolf120
13/11/2011, 01:03 PM
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)


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:

SetCheckpointForAll(id, Float:cx, Float:cy, Float:cz, Float:csize);


to make the previous stock easier u can simply:


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;
}