SA-MP Forums Archive
simple thing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: simple thing (/showthread.php?tid=149438)



simple thing - shoru93 - 22.05.2010

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


Re: simple thing - [XST]O_x - 22.05.2010

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;
}



Re: simple thing - Hiddos - 22.05.2010

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.