Admin chat problem
#1

Hi,i've this admin chat cmd:

pawn Код:
dcmd_a(playerid, params[])
{
    new ChatMessage[256],name[24];
    if(sscanf(params, "s", ChatMessage)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /a [message]");

    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    new string[256];
    format(string,sizeof(string),"AdmChat %s [%d]: %s",name,playerid,ChatMessage);
    IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, string);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][AdminLevel] >= 2)
        {
        SendClientMessage(i, COLOR_GOLD, string);
        AdminCLog(string);
        PlayerPlaySound(i, 1137, 0.0, 0.0, 0.0);
        }
    }
    return 1;
}
I have admin variables but all players can use it.Why?
Reply
#2

add this at the top of the command...
pawn Код:
if(/*Check if player isn't an admin*/) return SendClientMessage(playerid,COLOR_WHITE,"You are not an admin!");
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)