Checkpoints - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Checkpoints (
/showthread.php?tid=230502)
Checkpoints -
Spiral - 23.02.2011
Hey, so I was making a simple checkpoint system for my server, but I got a problem. If I create a checkpoint, using SetPlayerCheckpoint, how do I see that the player entered the specified checkpoint? I want it to be like this, if a player enters this checkpoint:
pawn Код:
SetPlayerCheckpoint(playerid, -1546.3070,2651.5574,55.4233, 3.0);
It will disable this checkpoint using DisablePlayerCheckpoint and make this checkpoint:
pawn Код:
SetPlayerCheckpoint(playerid, -1481.1399,2670.2441,55.4200, 3.0);
How could I do this? Any explanations?
Re: Checkpoints -
Stigg - 23.02.2011
Give the checkpoint an id.
Check1 = SetPlayerCheckpoint(playerid, -1546.3070,2651.5574,55.4233, 3.0);
Peace...
Re: Checkpoints -
Spiral - 23.02.2011
Wow, thanks!
Re: Checkpoints -
Jeffry - 23.02.2011
https://sampwiki.blast.hk/wiki/Function:SetPlayerCheckpoint
Quote:
Returns This function doesn't return a specific value
|
The code by Stigg won't work.
I will give you one in some minutes.
__________________________________________________ ___________________________________________
__________________________________________________ ___________________________________________
Okey, now this will work:
First of all we create a new variable for each player, so we can let the server know, which checkpoint the player is currently able to see.
pawn Код:
new PlayerSeeCheckpoint[MAX_PLAYERS];
Okey, and now we create the first checkpoint:
pawn Код:
SetPlayerCheckpoint(playerid, -1546.3070,2651.5574,55.4233, 3.0);
PlayerSeeCheckpoint[playerid]=1; //ID 1 is shown
Then he/she enters the checkpoint:
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
//We switch between the different CPs
switch(PlayerSeeCheckpoint[playerid])
{
case 1:
{
//Here the player has entered the checkpoint from upon (ID 1)
DisablePlayerCheckpoint(playerid);
SetPlayerCheckpoint(playerid, -1481.1399,2670.2441,55.4200, 3.0);
PlayerSeeCheckpoint[playerid]=2; //New he/she sees ID 2
}
case 2:
{
//He has entered the checkpoint 2 now.
//Add anything, but if you show a new checkpoint, don't forget to give him a ID.
//And watch out that no ID is twice. ;)
}
}
return 1;
}
I hope this will help you.
If you have any questions, feel free to ask.
Jeffry