22.05.2015, 09:57
I'd personally something like this (an example as I don't know anything about your minigame). Also use player-textdraws:
PHP код:
new Player_DMV@CP[MAX_PLAYERS];
// OnPlayerConnect and when the player completes the minigame:
Player_DMV@CP[playerid] = 0;
// Also create the player-textdraws on connect
// when the minigame starts (in case the player is IN the checkpoint):
if (IsPlayerInRaceCheckpoint(playerid)) OnPlayerEnterRaceCheckpoint(playerid);
// OnPlayerEnterRaceCheckpoint:
// have a variable of whether it has started or not if it has countdown and:
if (MINIGAME_HAS_NOT_STARTED_VARIABLE) return 1; // at the top so it won't go to the next checkpoint
// if it doesn't have a countdown, skip it
switch (MAX_CHECKPOINTS_VARIABLE - Player_DMV@CP[playerid])
{
case 1:
{
// player got last checkpoint.. end it for the player
DisablePlayerRaceCheckpoint(playerid);
}
case 2:
{
++Player_DMV@CP[playerid];
SetPlayerRaceCheckpoint(playerid, 1, X_CP_HERE, Y_CP_HERE, Z_CP_HERE, 0.0, 0.0, 0.0, 9.0);
}
default:
{
++Player_DMV@CP[playerid];
SetPlayerRaceCheckpoint(playerid, 0, X_CP_HERE, Y_CP_HERE, Z_CP_HERE, X_CP_NEXT_HERE, Y_CP_NEXT_HERE, Z_CP_NEXT_HERE, 9.0);
}
}
new text[30];
format(text, sizeof (text), "DMV CHECKPOINTS: %i/%i", Player_DMV@CP[playerid], MAX_CHECKPOINTS_VARIABLE);
PlayerTextDrawSetString(playerid, PLAYER_TEXTDRAW_HERE, text);