15.12.2010, 01:24
pawn Код:
stock SafeBan(playerid,reason[],days)
{
printf("Banning A Player:%s(%d)",Playername(playerid),playerid);
new ip[16];
GetPlayerIp(playerid,ip,sizeof ip);
new year,mon,d;
getdate(year,mon,d);
new s = Bancount+1;
format(TempBans[s][BannedName],24,"%s",Playername(playerid));
format(TempBans[s][BannedIP],17,"%s",ip);
TempBans[s][UnbanDate] = d+days;
TempBans[s][Banid] = Bancount+1;
Bancount++;
format(TempBans[s][Reason],150,"%s",reason);
switch(d)
{
case 20,21,22: TempBans[s][UnbanDate] = 26-days;
case 23,24,25: TempBans[s][UnbanDate] = 27-days;
case 26,27,28: TempBans[s][UnbanDate] = 28-days;
case 29,30,31: TempBans[s][UnbanDate] = 31-days,mon+=1;
}
new str[100];
format(str,sizeof str,"*Ban: %s(%d) Has Been Banned. Ban Date Set To Be Expired On %d/%d/%d",Playername(playerid),playerid,TempBans[s][UnbanDate],mon,year);
MessageToAdmins(COLOR_ADMIN,str);
new bEscape[3][80];
mysql_real_escape_string(Playername(playerid),bEscape[0]);
mysql_real_escape_string(ip,bEscape[1]);
mysql_real_escape_string(reason,bEscape[2]);
new Query[512];
format(Query, sizeof(Query), "INSERT INTO `Bans` (`Banid`,`Name`,`IP`,`UnbanDate`,`Reason`) VALUES (%d,'%s','%s',%d,'%s')",TempBans[s][Banid],bEscape[0],bEscape[1],TempBans[s][UnbanDate],bEscape[2]);
printf(Query);
mysql_query(Query);
/*format(str,sizeof str,"banip %s %s",ip,reason);
SendRconCommand(str);*/
//BanEx(playerid,reason);
Kick(playerid);
SaveTempBans();
return 1;
}
how i used it?
pawn Код:
format(string,sizeof(string),"Auto Advertising Ban(%s)",text);
SafeBan(playerid,string,8);