09.09.2012, 23:37
You'll have to create a new variable, which'll be true once the player joins race. Let me give you an example:
And for the other problem, something like:
[/pawn]
pawn Код:
new bool: pInRace[MAX_PLAYERS];
//Under OnPlayerConnect
pInRace[playerid] = false;
//Under OnPlayerDisconnect
pInRace[playerid] = false;
//In your /joinrace command
pInRace[playerid] = true;
//In your /v command
if(pInRace[playerid])
return SendClientMessage(playerid, -1, "You can't use this command when you're in a race.");
//In your /leaverace command
pInRace[playerid] = false;
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
if(oldstate == PLAYER_STATE_DRIVER && newstate == PLAYER_STATE_ONFOOT)
{
if(pInRace[playerid])
{
pInRace[playerid] = false;
SendPlayerMessage(playerid, -1, "You left your vehicle and you've lost the race.");
//The rest of your code here, insert whatever you want.
return 1;
}
}
return 1;
}