SA-MP Forums Archive
command - 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)
+--- Thread: command (/showthread.php?tid=415357)



command - maisto5 - 12.02.2013

What to do when a player writes a command such as /work, then it can not write the command /speed until you write /leave . Thanks .


Re: command - 2KY - 12.02.2013

pawn Код:
new
    bool: CommandLimiter [ MAX_PLAYERS ] = false;

public OnPlayerCommandText(playerid, cmdtext[])
{
    if( strcmp ( "/work", cmdtext, true, 5 ) == 0 )
    {
        CommandLimiter [ playerid ] = true;
        return true;
    }
   
    else if( strcmp ( "/speed", cmdtext, true, 6 ) == 0 )
    {
        if( CommandLimiter [ playerid ] == false )
        {
            // Allow the command.
        }
        else return false;
    }
   
    else if( strcmp ( "/leave", cmdtext, true, 6 ) == 0 )
    {
        if( CommandLimiter [ playerid ] == true )
        {
            CommandLimiter [ playerid ] = false;
        }
        else return false;
    }
    return false;
}
Should give you a good idea on how to go about it.


Re: command - maisto5 - 15.02.2013

thanks