simple thing
#1

so we have 2 commands: /race and /kill
how to make /kill command unavailable if i do first /race? i mean to can not be used /kill while im in race
Reply
#2

pawn Код:
new InRace[MAX_PLAYERS];
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/race", cmdtext, true, 5) == 0)
    {
        //Your code.
        InRace[playerid] = 1;
        return 1;
    }
    if (strcmp("/kill", cmdtext, true, 5) == 0)
    {
        if(InRace[playerid] == 1)
        {
           SendClientMessage(playerid,COLOR,"You can't kill yourself while you're in a race.");
        }
        else
        {
           SetPlayerHealth(playerid,0);
        }
        return 1;
    }
    return 0;
}
Reply
#3

Use PVars. When the player types /race, set the PVar to 1.

When the player types /kill, check if the PVar isn't 1. If so, you can kill him. If it is 1, deny his request to suicide.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)