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;
}
mysql_format(mysql, Query, sizeof(Query), "INSET INTO `bans` VALUES ('%s', '%s', '%s', '%s', '%s', '1')",GPN(pid),reason,GPN(playerid),pIP,gettime());
mysql_format(mysql, Query, sizeof(Query), "INSET INTO `bans`(`somthing`,`somthing`,`somthing`,`somthing`,`somthing`,`somthing`) VALUES ('%s', '%s', '%s', '%s', '%s', '1')",GPN(pid),reason,GPN(playerid),pIP,gettime());
Код:
mysql_format(mysql, Query, sizeof(Query), "INSET INTO `bans` VALUES ('%s', '%s', '%s', '%s', '%s', '1')",GPN(pid),reason,GPN(playerid),pIP,gettime()); PHP код:
|
Now it saves all as 0,0,0,0
EDIT:Sorry for double post . Didn't realise! |
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), "INSERT INTO `bans` VALUES (`Name` = '%s', `Reason` = '%s',`BannedBy` = '%s',`IP` = '%s', `Date` = '%s', `Status` = '1')",GPN(pid),reason,GPN(playerid),pIP,getdate());
mysql_tquery(mysql,Query);
printf(Query);
Kick(pid);
return 1;
}
It prints the right values :S
pawn Код:
[00:17:10] The player vassilis has been banned at: 314 [00:17:10] INSERT INTO `bans` VALUES (`Name` = 'vassilis', `Reason` = 'test',`BannedBy` = 'vassilis',`IP` = '192.168.1.7', `Date` = ':vassilis', `Status` = '1') [00:17:10] [part] vassilis has left the server (0:2) |
INSERT INTO `bans` (`Name`, `Reason`, `BannedBy`, `IP`, `Status`) VALUES ('%s', '%s', '%s','%s', '%s', '1')
[01:09:25] [DEBUG] mysql_format - connection: 1, len: 240, format: "INSERT INTO `bans` (`Name`, `Reason`, `BannedBy`, `IP`, `Status`) VALUES ('%s', '%s', '%s','%s', '%s', '1')"
[01:09:25] [DEBUG] mysql_tquery - connection: 1, query: "INSERT INTO `bans` (`Name`, `Reason`, `BannedBy`, `IP`, `Status`", callback: "(null)", format: "(null)"
[01:09:25] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[01:09:26] [DEBUG] mysql_format - connection: 1, len: 340, format: "UPDATE `players` SET `Admin`=%d, `VIP`=%d, `Money`=%d, `posX`=%f, `posY`=%f, `posZ`=%f,`Score` =%d, `Banned` =%d, `Cuffed` =%d, ..."
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 318.277 milliseconds
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[01:09:26] [ERROR] CMySQLQuery::Execute[] - (error #1064) You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Ґ', '1')' at line 1
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - error will be triggered in OnQueryError
[01:09:26] [DEBUG] mysql_tquery - connection: 1, query: "UPDATE `players` SET `Admin`=5, `VIP`=0, `Money`=0, `posX`=965.8", callback: "(null)", format: "(null)"
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 79.348 milliseconds
[01:09:26] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving