When player do /joinrace disable cmd /v
#3

You'll have to create a new variable, which'll be true once the player joins race. Let me give you an example:
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;
And for the other problem, something like:

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;
}
[/pawn]
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)