26.09.2011, 16:25
Hi, I have been experimenting with a /warn command for my server which was suggested, but I can't seem to get it to work.
If anyone can see a problem with this, i'll be so happy. Thanks!
pawn Код:
CMD:warn(playerid, params[])
{
if(PlayerInfo[playerid][pAdmin] >= 2)
{
new achat[128], string[128], id;
if(sscanf(params, "is[128]", id, achat)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /warn [id] [reason]");
if(PlayerInfo[id][pWarns] == 1)
{
PlayerInfo[id][pWarns]++;
format(string, sizeof(string), "{009DFF}Admin %s {FFFFFF}has warned {009DFF}%s, {FFFFFF}warn level: {009DFF}%d{FFFFFF}.", PlayerName(playerid), PlayerName(id), PlayerInfo[id][pWarns]);
SendAdminMessage(COLOR_WHITE, string);
format(string, sizeof(string), "{009DFF}Admin %s {FFFFFF}has warned {009DFF}%s, {FFFFFF}reason: {009DFF}%s{FFFFFF}.", PlayerName(playerid), PlayerName(id), achat);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[id][pWarns] == 2)
{
PlayerInfo[id][pWarns]++;
format(string, sizeof(string), "Admin {009DFF}%s {FFFFFF}has warned {009DFF}%s, {FFFFFF}warn level: {009DFF}%d{FFFFFF}.", PlayerName(playerid), PlayerName(id), PlayerInfo[id][pWarns]);
SendAdminMessage(COLOR_WHITE, string);
format(string, sizeof(string), "{009DFF}Admin %s {FFFFFF}has warned {009DFF}%s, {FFFFFF}reason: {009DFF}%s{FFFFFF}.", PlayerName(playerid), PlayerName(id), achat);
SendClientMessageToAll(COLOR_WHITE, string);
}
else if(PlayerInfo[id][pWarns] == 3)
{
PlayerInfo[id][pWarns]++;
format(string, sizeof(string), "{009DFF}Admin %s {FFFFFF}has warned {009DFF}%s, {FFFFFF}warn level: {009DFF}%d{FFFFFF}.", PlayerName(playerid), PlayerName(id), PlayerInfo[id][pWarns]);
SendAdminMessage(COLOR_WHITE, string);
format(string, sizeof(string), "{009DFF}Admin %s {FFFFFF}has warn banned {009DFF}%s, {FFFFFF}reason: {009DFF}%s{FFFFFF}.", PlayerName(playerid), PlayerName(id), achat);
SendClientMessageToAll(COLOR_WHITE, string);
Ban(id);
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "ERROR: You don't seem to be an admin!");
}
return 1;
}