Ban command problem
#1

I was fixing my ban command, i made this:

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;
}
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 )".
Reply


Messages In This Thread
Ban command problem - by Face9000 - 07.02.2014, 09:51
Re: Ban command problem - by CuervO - 07.02.2014, 09:58
Re: Ban command problem - by Face9000 - 07.02.2014, 10:03
Re: Ban command problem - by RajatPawar - 07.02.2014, 10:05

Forum Jump:


Users browsing this thread: 1 Guest(s)