OnPlayerText => OnPlayerCommandText
#1

Hi all,i ask a favour of users here.

I've this for admin chat

OnPlayerText

Код:
     if(text[0] == '@')
    {
        if(PlayerInfo[playerid][AdminLevel] > 2)
        {
            if(!strlen(text[1])) return SendClientMessage(playerid, COLOR_ORANGE, "USAGE: @<text>");
            new sendername[128];
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new string[128];
            format(string, sizeof(string), "Admin Chat [%i]%s: %s" ,playerid,sendername, text[1]);
            SendMessageToAdmins(COLOR_GREEN, string);
            IRC_GroupSay(gGroupID, IRC_ADMINCHANNEL, string);
            AdminCLog(string);
            return 0;
        }
    else return 0;
    }
   }
I wanna make it /a text with dcmd.

How?

Thanks.
Reply
#2

Hope it helps you abit.
pawn Код:
dcmd_a(playerid, params[])
{
    new ChatMessage[128];
    if(PlayerInfo[i][AdminLevel] == 0) return SendClientMessage(playerid, COLOR_YELLOW, "Suck.");
    if(sscanf(params, "s", ChatMessage)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /a [message]");
   
    GetPlayerName(playerid, name, MAX_PLAYER_NAME);
    format(string,sizeof(string),"** ADMIN CHAT %s [ID: %d]: %s",name,playerid,ChatMessage);

    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(PlayerInfo[i][AdminLevel] >= 2)
        {
        SendClientMessage(i, COLOR_YELLOW, string);
        PlayerPlaySound(i, 1137, 0.0, 0.0, 0.0);
        }
    }
    return 0;
}
Reply
#3

Sorry i just posted the right code.

Sorry for mistake.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)