20.03.2012, 05:56
I assume you're talking about the normal chat rather then a separate chat for admins.
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.
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.
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.
}
pawn Код:
stock GetName(playerid)
{
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
return pName;
}