09.11.2015, 16:00
Hello mates i have a small problem with my code here. The problem is that it doesnt insert any values on bans table!! its empty
Could the problem be anywhere else?
pawn Код:
CMD:ban(playerid,params[])
{
new pid,reason[70],string[120],string2[140], Query[240],pIP[16];
new year, month, date;
GetPlayerIp(pid,pIP,sizeof(pIP));
getdate(year, month, date);
printf("%02d:%02d:%02d", year, month, date);
new Seconds = getdate();
printf("The player %s has been banned at: %d", GPN(pid),Seconds);
if(pinfo[playerid][Admin] < 3) return 0;
if(pinfo[playerid][Admin] < pinfo[pid][Admin]) return SendClientMessage(playerid,COLOR_RED," (ERROR): You can't ban a higher level admin!");
if(sscanf(params,"us[70]",pid,reason)) return SendClientMessage(playerid, COLOR_RED," SERVER : /ban [playerid] [reason]");
if(pid == INVALID_PLAYER_ID || !IsPlayerConnected(pid)) return ErrorMessages(playerid,2);
format(string,sizeof(string),"CCNR SYSTEM: %s ( %i ) has been banned from the server. Reason: %s",GPN(pid),pid,reason);
SendClientMessageToAll(COLOR_PINK,string);
format(string,sizeof(string),"CCNR SYSTEM: You have been banned from the server. Date: %d / %d / %d Reason: %s",year,month,date,reason);
SendClientMessage(pid,COLOR_PINK,string2);
pinfo[pid][Banned] = 1;
mysql_format(mysql, Query, sizeof(Query), "UPDATE `players` SET `Banned` = '%i' WHERE ID = '%i'", pinfo[pid][Banned], pinfo[pid][ID]);
//mysql_tquery(mysql, Query);
mysql_format(mysql, Query, sizeof(Query), "INSET INTO `bans` VALUES ('%s', '%s', '%s', '%s', '%s', '1')",GPN(pid),reason,GPN(playerid),pIP,gettime());
mysql_tquery(mysql,Query);
Kick(pid);
return 1;
}