26.04.2013, 19:11
Alright, so, a nice guy from this forum made me this CMD, but now I want to improve it a bit but I don't have the knowledge for that, could you help me out, pros?
I want it that when a player sends a message to admins a message returns to him like: Your message, ( what he typed), was sent to administrators. And that when an admin sends a message to a player all admins see something like this: Admin Message to %s (ID: %d): (message that he sent) from (admin that send the message). Could you help me out, please?
pawn Код:
CMD:am(playerid, params[])
{
new ToAdminsText[128], TargetID, MessageToAdmins[152], PlayerName[MAX_PLAYER_NAME];
if(PlayerInfo[playerid][pAdmin] < 1 && sscanf(params, "s[128]", ToAdminsText)) return SendClientMessage(playerid, -1, "USAGE: /am [text]");
if(PlayerInfo[playerid][pAdmin] > 0 && sscanf(params, "rs[128]",TargetID, ToAdminsText)) return SendClientMessage(playerid, -1, "USAGE: /am [id] [text]");
GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
format(MessageToAdmins, sizeof(MessageToAdmins), "Admin Message from %s (ID: %d): %s", PlayerName, playerid, ToAdminsText);
if(PlayerInfo[playerid][pAdmin] < 1)
{
for(new i = 0; i <= MAX_PLAYERS; i++)
{
if(PlayerInfo[i][pAdmin] > 0) SendClientMessage(i, -1, MessageToAdmins);
}
}
else SendClientMessage(TargetID, COLOR_GREEN, MessageToAdmins);
return 1;
}