Problem with warn-command!
#6

CMD:warn(playerid, params[])
{
if (PlayerInfo[playerid][pAdmin] >= 2)
{
new string[128], giveplayerid, reason[64];
if(sscanf(params, "us[64]", giveplayerid, reason)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /warn [playerid] [reason]");

if(IsPlayerConnected(giveplayerid))
{
if(PlayerInfo[giveplayerid][pAdmin] >= 2)
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Admins can not be warned !");
return 1;
}
PlayerInfo[giveplayerid][pWarns] += 1;
if(PlayerInfo[giveplayerid][pWarns] >= 3)
{
new year, month,day;
new ip[32];
GetPlayerIp(giveplayerid,ip,sizeof(ip));
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s (IP: %s) was banned by %s (had 3 Warnings), reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), ip, GetPlayerNameEx(playerid), reason,month,day,year);
Log("logs/ban.log", string);
format(string, sizeof(string), "AdmCmd: %s was banned by %s (had 3 Warnings), reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
SendClientMessageToAllEx(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pBanned] = 1;
AddBan(ip);
Kick(giveplayerid);
return 1;
}
new year, month, day;
getdate(year, month, day);
format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason);
ABroadCast(COLOR_LIGHTRED, string, 2);
format(string, sizeof(string), "AdmCmd: %s was warned by %s, reason: %s (%d-%d-%d)", GetPlayerNameEx(giveplayerid), GetPlayerNameEx(playerid), reason,month, day, year);
Log("logs/admin.log", string);
format(string, sizeof(string), "You were warned by %s, reason: %s", GetPlayerNameEx(playerid), reason);
SendClientMessageEx(giveplayerid, COLOR_LIGHTRED, string);
return 1;

}
}
else SendClientMessageEx(playerid, COLOR_GRAD1, "Invalid player specified.");
return 1;
}
Reply


Messages In This Thread
Problem with warn-command! - by Twisted_Insane - 23.02.2012, 20:34
Re: Problem with warn-command! - by Tanush123 - 23.02.2012, 20:44
Re: Problem with warn-command! - by Twisted_Insane - 24.02.2012, 07:52
Re: Problem with warn-command! - by Tanush123 - 25.02.2012, 20:49
Re: Problem with warn-command! - by Konstantinos - 25.02.2012, 21:53
Re: Problem with warn-command! - by HighPitchedVoice - 25.02.2012, 21:58
Re: Problem with warn-command! - by Tanush123 - 26.02.2012, 00:50

Forum Jump:


Users browsing this thread: 2 Guest(s)