How to restrict a player from using a command ?
#6

@Jarnu,
Код:
CMD:rpw(playerid, params[])
{  
    Restrict = 1;
    return 1;
}
That will disable the commands to the admin, it needs to specify the ID.
Код:
// Global variable
new
    Allowed_To_Use[ MAX_PLAYERS ]
;

public OnPlayerConnect( playerid )
{
    Allowed_To_Use[ playerid ] = 0;
    return 1;
}

public OnPlayerDisconnect( playerid, reason )
{
    Allowed_To_Use[ playerid ] = 0;
    return 1;
}

CMD:rpw( playerid, params[ ] )
{
    new
        id
    ;
    if( sscanf( params, "u", id ) ) return SendClientMessage( playerid, -1, "Syntax: /rpw [ID/Part Of Name]" );
    if( !IsPlayerConnected( id ) && id == INVALID_PLAYER_ID ) return SendClientMessage( playerid, -1, "Invalid player ID!" );
    if( Allowed_To_Use[ id ] == 1 ) return SendClientMessage( playerid, -1, "You have already disabled the weapon commands from that player!" );
    Allowed_To_Use[ id ] = 1
    return 1;
}

CMD:getm4( playerid, params[ ] )
{
    if( Allowed_To_Use[ playerid ] == 1 ) return SendClientMessage( playerid, -1, "Weapons commands are disabled for you!" );
    // rest of your code
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)