dcmd(a, 1, cmdtext); |
dcmd_a(playerid, cmdtext[]) { #pragma unused cmdtext new sendername[MAX_PLAYER_NAME]; new string[256], idx; GetPlayerName(playerid, sendername, sizeof(sendername)); new length = strlen(cmdtext); while ((idx < length) && (cmdtext[idx] <= ' ')) { idx++; } new offset = idx; new result[64]; while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) { result[idx - offset] = cmdtext[idx]; idx++; } result[idx - offset] = EOS; if(!strlen(result)) { SendClientMessage(playerid, COLOR_WHITE, "USAGE: /a <message>"); return 1; } format(string, sizeof(string), "[AdminChat]%s: %s", sendername, result); SendAdminMessage(COLOR_WHITE,string); return 1; } |
// Enum:
enum pInfo
{
AdminLevel
}
new PlayerData [] [pInfo];
CMD:a(playerid, params[])
{
new p2[128], Pna[32];
if(PlayerData [playerid] [AdminLevel] < 1) return 0;
if( isnull (params)) return SendClientMessage(playerid, COLOR_RED, "/a [msg]");
GetPlayerName(playerid, Pna, 32);
if (PlayerData [playerid] [ALevel] >= 1 || IsPlayerAdmin(playerid))
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerData[i] [AdminLevel] >= 1)
{
format(p2, 128, "Admin %s (%d): %s", Pna, playerid, params);
SendClientMessage(i , -1, p2);
}
}
}
}
return 1;
}
dcmd_a(playerid, params[]) {
new string[128], str[128], sendername[MAX_PLAYER_NAME];
if(sscanf(params, "s", str)) return SendClientMessage(playerid, -1,"USAGE: /a <message>");
//if(YourAdminVariable[playerid] == 0) you are not admin bla ba
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "[AdminChat]%s: %s", sendername, str);
SendAdminMessage(COLOR_WHITE,string);
return 1;
}