Admin In chat
#7

I assume you're talking about the normal chat rather then a separate chat for admins.

pawn Код:
public OnPlayerText(playerid, text[]) // If you already have a OnPlayerText function in your script, just merge this into your current script.
{
    new string[128];
    if(IsPlayerAdmin(playerid)) // WARNING: this will check if the player is an RCON admin or not(which you properly already know, you've most likely got another way to check if a player is an admin or not, simply re-edit this line and you'll be fine.
    {
        format(string,sizeof(string),"[ADMIN] %s(%d): {FFFFFF}%s",GetName(playerid),playerid,text);
        SendClientMessage(playerid,GetPlayerColor(playerid),string);
    }
    else
    {
        format(string,sizeof(string),"%s(%d): {FFFFFF}%s",GetName(playerid),playerid,text);
        SendClientMessage(playerid,GetPlayerColor(playerid),string);
    }
    return 0; //return 0 so it doesn't output the normal chat line.
}
In addition you'll also need this GetName function, if you don't want to use this you could re-edit the code I've given above. You can put this snippet anywhere in your script as long as it's not in another function, once again you most likely know that.
pawn Код:
stock GetName(playerid)
{
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));
    return pName;
}
I haven't exactly tested this code yet, but if it doesn't work you've got a good idea on how you can go about creating such a thing. Hopefully I've understood your question; if not don't hesitate to ask.
Reply


Messages In This Thread
Admin In chat - by [LHT]Bally - 20.03.2012, 00:08
AW: Admin In chat - by Blunt P - 20.03.2012, 00:19
Re: Admin In chat - by Skribblez - 20.03.2012, 00:26
Re: Admin In chat - by MaximumGaming - 20.03.2012, 04:15
Re: Admin In chat - by Skribblez - 20.03.2012, 04:36
Re: Admin In chat - by new121 - 20.03.2012, 04:44
Re: Admin In chat - by Haydz - 20.03.2012, 05:56

Forum Jump:


Users browsing this thread: 1 Guest(s)