25.02.2012, 21:58
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;
}
{
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;
}