07.02.2014, 09:51
I was fixing my ban command, i made this:
But, in the "playerdata" table at "BanReason", "BannedBy", "BannedTim", "UnbanTim" it shows random numbers, not the correct params.
Also when i login i get this:
What's wrong?
The fields in the database are all "varchar( 128 )".
pawn Код:
CMD:ban(playerid, params[])
{
new target_id, hours, minutes, seconds, reason[128], name[MAX_PLAYER_NAME];
if(sscanf(params, "uddds[128]", target_id, hours, minutes, seconds, reason)) return SendClientMessage(playerid, -1, "USAGE: /ban (playerid) (hours) (mins) (secs) (reason)");
if(!IsPlayerConnected( target_id ) ) return SendClientMessage(playerid, -1, "ERROR: Requested player is offline.");
{
GetPlayerName(playerid, name, MAX_PLAYER_NAME);
PlayerInfo[target_id][Banned] = 1;
PlayerInfo[target_id][BannedTime] = gettime();
format( PlayerInfo[target_id][BanReason], 128, "%s", reason );
format( PlayerInfo[target_id][BannedBy], MAX_PLAYER_NAME, "%s", name);
new total_banned_seconds_from_now = seconds + ( minutes * 60 ) + (hours * 60 * 60);
PlayerInfo[target_id][UnbanTime] = total_banned_seconds_from_now + gettime();
new query[200], TARGETname[MAX_PLAYER_NAME];
GetPlayerName(target_id, TARGETname, 24);
format(query, sizeof(query), "UPDATE `playerdata` SET Banned = 1, BanReason = '%s', BannedBy = '%s', BannedTime = %d, UnbanTime = %d WHERE user = '%s'", reason, name, gettime(), PlayerInfo[target_id][UnbanTime], TARGETname);
mysql_function_query(mysqlc, query, false, "", "");
SendClientMessage(target_id, -1, "You have been banned.");
SendClientMessage(playerid, -1, "You have banned the requested player successfully.");
}
return 1;
}
Also when i login i get this:
What's wrong?
The fields in the database are all "varchar( 128 )".