Код:
stock BanWithReason(playerid , reason[], admin, cleanreason[]="")
{
switch(PlayerInfo[playerid][Banned])
{
case 0:
{
/*
new INI:File = INI_Open(UserPath(playerid)), year, month, day;
INI_SetTag(File,"Ban Data");
INI_WriteInt(File,"Banned",1);
INI_WriteInt(File,"Banyear",year);
INI_WriteInt(File,"Banmonth",month);
INI_WriteInt(File,"Banday",day);
INI_WriteString(File,"BanAdmin",Baner);
INI_WriteString(File,"Reason",reason);
INI_Close(File);*/
/* MySQL Part */
new query[215], IPP[26], year, month, day;
getdate(year,month,day);
GetPlayerIp(playerid, IPP, sizeof(IPP));
if(admin != SYSTEM_ID) mysql_format(connection_handle, query, sizeof(query), "UPDATE `"USERSTABLE"` SET Banned=1, BanYear=%d, BanMonth=%d, BanDay=%d, adminid='%d', Reason='%e' WHERE ID='%d'", year, month, day, PlayerInfo[admin][AccountID], cleanreason, PlayerInfo[playerid][AccountID]);
else mysql_format(connection_handle, query, sizeof(query), "UPDATE `"USERSTABLE"` SET Banned=1, BanYear=%d, BanMonth=%d, BanDay=%d, adminid='%d', Reason='%e' WHERE ID='%d'", year, month, day, SYSTEM_ID, cleanreason, PlayerInfo[playerid][AccountID]);
mysql_pquery(connection_handle, query, "", "");
if(admin != SYSTEM_ID) mysql_format(connection_handle, query, sizeof(query), "SELECT User_Name FROM `"BANSTABLE"` WHERE userid='%d' AND Reason='%e' AND adminid='%d' LIMIT 1", PlayerInfo[playerid][AccountID], cleanreason, PlayerInfo[admin][AccountID]);
else mysql_format(connection_handle, query, sizeof(query), "SELECT User_Name FROM `"BANSTABLE"` WHERE userid='%d' AND Reason='%e' AND adminid='%d' LIMIT 1", PlayerInfo[playerid][AccountID], cleanreason, SYSTEM_ID);
mysql_pquery(connection_handle, query, "BanResult", "dsds", admin, cleanreason, playerid, IPP);
/* ------------------ */
printf("%s has been banned by %s for %s\n", GetName(playerid), GetName(admin),reason);
SetTimerEx("BanTimer",1000,0,"i",playerid);
format(PString[playerid],127,"[INGAME BAN]%s",reason);
}
case 1:
{
KickPlayer(playerid);
}
}
return 1;
}