[admin] chat help
#2

pawn Код:
public OnPlayerText(playerid, text[]) //Called when a player attempts to send text to the server.
{
    if(ismuted[playerid]) return SendClientMessage(playerid, COLOR_RED, "You have been muted. You cannot chat, unless, unmuted.");
    //If they are muted, send them the above message.
    if(text[0] == '@') //If the first character of their text is an '@', then process the text as an admin message.
    {
        if(PlayerInfo[playerid][pLevel] > 0) //If they are an admin...
        {
            new st[128];
            format(st, sizeof(st), "[A-chat]{999999} %s: %s", GetName(playerid), text[1]);
            //The message to send will be the name, followed by the second character of the text onwards. (Excludes the '@' symbol)
            for(new i = 0; i < MAX_PLAYERS; i++) //Start a loop through all players
            {
                if(!IsPlayerConnected(i)) continue; //If the player isn't connected, skip them.
                if(PlayerInfo[i][pLevel] < 1) continue; //If the player's admin level is less than 1, skip them.
                SendClientMessage(i, 0xF41E98FF, st);
            }
            return 0; //Do not send the message to the server.
        }
    }
    return 1; //Send the message normally to the server.
}
Reply


Messages In This Thread
[admin] chat help - by yvoms - 11.03.2014, 04:43
Re: [admin] chat help - by Threshold - 11.03.2014, 04:50
Re: [admin] chat help - by Sojo12 - 11.03.2014, 09:53
Re: [admin] chat help - by biker122 - 11.03.2014, 13:08
Re: [admin] chat help - by Sojo12 - 11.03.2014, 14:01

Forum Jump:


Users browsing this thread: 1 Guest(s)