IsPlayerInRaceCheckpoint not triggering
#1

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.
Reply
#2

Why do you use OnPlayerUpdate?

There is a callback especially for this: OnPlayerEnterRaceCheckpoint

Greekz
Reply
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Why do you use OnPlayerUpdate?

There is a callback especially for this: OnPlayerEnterRaceCheckpoint

Greekz
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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)