command
#1

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 .
Reply
#2

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.
Reply
#3

thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)