How do i put a command for admin only?
#4

First of all, why do you specify a length in strcmp? It seems a little odd considering it doesn't do anything in this circumstance.

Secondly, how do you want to check for administrator? Do you want to use the standard RCON administrator stuff? If so, then use IsPlayerAdmin, for example:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/heal", cmdtext, true) == 0)
    {
        if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You need to be RCON admin!"); // Check if the player is not an RCON admin and stop execution with a client message
        SetPlayerHealth(playerid,100);// heal the player
        SendClientMessage(playerid, COLOR_YELLOW, "FT Bot: "#COL_GREEN"You have been healed!");
        return 1;
    }
    return 0;
}
You can read more about IsPlayerAdmin on the SA-MP Wiki:

https://sampwiki.blast.hk/wiki/IsPlayerAdmin

Edit: grr, stop posting so fast!
Reply


Messages In This Thread
How do i put a command for admin only? - by dahley5 - 31.08.2011, 02:41
Re: How do i put a command for admin only? - by Jack_Leslie - 31.08.2011, 02:43
Re: How do i put a command for admin only? - by IceCube! - 31.08.2011, 02:43
Re: How do i put a command for admin only? - by JaTochNietDan - 31.08.2011, 02:44
Re: How do i put a command for admin only? - by dahley5 - 31.08.2011, 02:48
Re: How do i put a command for admin only? - by Kingunit - 31.08.2011, 02:50
Re: How do i put a command for admin only? - by IceCube! - 31.08.2011, 02:50
Re: How do i put a command for admin only? - by dahley5 - 31.08.2011, 02:54
Re: How do i put a command for admin only? - by dahley5 - 31.08.2011, 20:10
Re: How do i put a command for admin only? - by Wesley221 - 31.08.2011, 20:14

Forum Jump:


Users browsing this thread: 2 Guest(s)