MySQL kickcount does not go up. -
So I have /kick which is ment to add +1 to someone's kick count, however it always just changes it to 1, it doesn't go higher. What am I doing wrong?
Код:
CMD:kick(playerid, params[])
{
new targetid, reason[64];
if(PlayerInfo[playerid][pAdmin] < 2)
return SCM(playerid,COLOR_ERROR,"You do not have the required access to execute this command.");
if(sscanf(params, "us[128]", targetid, reason))
return SCM(playerid, COLOR_INFO, "/kick [name/id] [reason]");
if(!IsPlayerConnected(targetid))
return SCM(playerid, COLOR_ERROR, "That account is not connected.");
if(IsAdmin(targetid))
return SCM(playerid, COLOR_ERROR, "You cannot use this command on another administrator.");
new query[250];
mysql_format(g_SQL, query, sizeof(query), "SELECT `acc_dbid` FROM `accounts` WHERE `acc_dbid` = '%i' LIMIT 1", PlayerInfo[targetid][pDBID]);
mysql_tquery(g_SQL, query, "OnPlayerKick", "iis", playerid, targetid, reason);
return 1;
}
forward OnPlayerKick(playerid, targetid, reason[]);
public OnPlayerKick(playerid, targetid, reason[])
{
new rows, fields, str[150];
cache_get_row_count(rows);
cache_get_field_count(fields);
format(str, sizeof(str), "%s %s(%i) has kicked %s(%i) for: %s", ReturnAdminLevel(playerid), ReturnICName(playerid), playerid, ReturnICName(targetid), targetid, reason);
SendClientMessageToAll(COLOR_ADMIN, str);
SetTimerEx("KickTimer", 200, false, "i", targetid);
new action[10];
format(action, sizeof(action), "kick");
new query[250];
mysql_format(g_SQL, query, sizeof(query), "INSERT INTO logs_punishments(acc_dbid, acc_name, ip_address, time, action, reason, by_acc_dbid, by_acc_name) VALUES('%i', '%e', '%e', UTC_TIMESTAMP(), '%e', '%e', '%i', '%e') LIMIT 1", PlayerInfo[targetid][pDBID], ReturnName(targetid), ReturnIP(targetid), action, reason, PlayerInfo[targetid][pDBID], ReturnName(playerid));
mysql_tquery(g_SQL, query);
new kickcount;
cache_get_value_name_int(0, "kickcount", kickcount);
new query2[250];
mysql_format(g_SQL, query2, sizeof(query2), "UPDATE `accounts` SET `kickcount` = '%i' WHERE `acc_dbid` = '%i' LIMIT 1", kickcount + 1, PlayerInfo[targetid][pDBID]);
mysql_tquery(g_SQL, query2);
}
forward KickTimer(playerid);
public KickTimer(playerid)
{
Kick(playerid);
return 0;
}