12.02.2013, 20:25
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 .
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;
}