Is there a way if player is admin to disable player command ?
#6

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Then change the 2 commands to:
pawn Код:
// command to disable (an example)
CMD:disablecmd( playerid, params[ ] )
{
    if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You are not admin" );
   
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( !IsPlayerConnected( i ) || IsPlayerNPC( i ) ) continue;
        Disabled_Command[ i ] = true;
    }
    return 1;
}

// command to enable (an example)
CMD:enablecmd( playerid, params[ ] )
{
    if( !IsPlayerAdmin( playerid ) ) return SendClientMessage( playerid, -1, "You are not admin" );
   
    for( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if( !IsPlayerConnected( i ) || IsPlayerNPC( i ) ) continue;
        Disabled_Command[ i ] = false;
    }
    return 1;
}
It loops throught the online players and it sets the variable to enabled/disabled.

You don't really have to take care of NPC's, do you? Unless it is needed to.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)