IsPlayerInRaceCheckpoint not triggering - 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: IsPlayerInRaceCheckpoint not triggering (
/showthread.php?tid=566950)
IsPlayerInRaceCheckpoint not triggering -
Nicker - 09.03.2015
In my race system, when the race starts and the racers are in the first checkpoint, the checkpoint doesn't get triggered unless the player leaves the checkpoint then enters it again (drives forward then reverses into the checkpoint). I have under OnPlayerUpdate this:
pawn Код:
if(IsPlayerInRaceCheckpoint(playerid) && RaceBegun == 1) //If they're in their race checkpoint and the race has started
{
if(PlayerRaceCP[playerid] == 1) //If the player's race checkpoint progress is the first checkpoint
{
PlayerPlaySound(playerid, 4202, 0, 0, 0); //Play a sound
PlayerCheckpoint[playerid] ++; //Add to their checkpoint progress
CreatePlayerRaceCP2(playerid); //Sets the new race checkpoint for the player
}
}
But it still doesn't get triggered unless the leave and enter it again. I've also tried to use OnPlayerLeaveRaceCheckpoint but that provides the same results.
AW: IsPlayerInRaceCheckpoint not triggering -
Kaliber - 09.03.2015
Why do you use OnPlayerUpdate?
There is a callback especially for this:
OnPlayerEnterRaceCheckpoint
Greekz
Re: AW: IsPlayerInRaceCheckpoint not triggering -
Nicker - 09.03.2015
Quote:
Originally Posted by Kaliber
|
Perhaps I didn't make myself clear enough :P
That does not get triggered for the first checkpoint as the racers are already in the checkpoint when the race starts. That callback gets triggered when a player ENTERS a checkpoint, not when they're already in one, like IsPlayerInRaceCheckpoint.