public OnPlayerText(playerid, text[]) { if(ismuted[playerid] == 1) { SendClientMessage(playerid,COLOR_RED,"You have been muted. You cannot chat, unless, unmuted."); return 0; } if(text[0]=='@') { if(PlayerInfo[playerid][pLevel]>0) { new st[128]; format(st,128,"{f41e98}[A-chat]{999999} %s: %s",GetName(playerid),text); for(new i;i<MAX_PLAYERS;i++) { if(PlayerInfo[i][pLevel]>0) { SendClientMessage(i, 0xFFFFFF, st); } } } return 0; } return 1; }
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.
}
dcmd_a(playerid,params[]) { new string[128]; if(!strlen(params)) { SendClientMessage(playerid,WHITE,"Usage /a (Message)"); return 1; } if(IsSpawned[playerid] == 0) { SendClientMessage(playerid, -1,"{FF0000}[ERROR]{FFFFFF}You must be spawned in order to be able to use this command."); return 1; } format(string,sizeof(string),"[ADMIN CHAT] %s(%d): %s",PlayerName(playerid),playerid,params); IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string); for(new i=0; i<MAX_PLAYERS; i++) { if(AdminLevel[i] >= 1) { format(string,sizeof(string),"[ADMIN CHAT] %s(%d): %s",PlayerName(playerid),playerid,params); SendClientMessage(i,COLOR_ADMIN,string); } } return 1; }
Why not simply use this:
Код:
dcmd_a(playerid,params[]) { new string[128]; if(!strlen(params)) { SendClientMessage(playerid,WHITE,"Usage /a (Message)"); return 1; } if(IsSpawned[playerid] == 0) { SendClientMessage(playerid, -1,"{FF0000}[ERROR]{FFFFFF}You must be spawned in order to be able to use this command."); return 1; } format(string,sizeof(string),"[ADMIN CHAT] %s(%d): %s",PlayerName(playerid),playerid,params); IRC_GroupSay(gGroupAdminID,IRC_ADMINCHANNEL,string); for(new i=0; i<MAX_PLAYERS; i++) { if(AdminLevel[i] >= 1) { format(string,sizeof(string),"[ADMIN CHAT] %s(%d): %s",PlayerName(playerid),playerid,params); SendClientMessage(i,COLOR_ADMIN,string); } } return 1; } |