Temp ban - strange bug.
#1

pawn Код:
CMD:tban(playerid, params[])
{
    if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
    if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
   
    new giveplayerid, hours, string[128], reason[128];
    if(sscanf(params, "uds[128]", giveplayerid, hours, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tban [player id or name] [hours] [reason]");
    if(hours < 1)return SendClientMessage(playerid, COLOUR_GREY, "Hours must be above 1.");
   
    format(string, sizeof(string), "You have been temporary banned for %d Hour(s).", hours);
    SendClientMessage(giveplayerid, COLOUR_LIGHTRED, string);
   
    format(string, sizeof(string), "Admin %s has Temp-Banned %s for [%d Hour(s)] [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid), hours, reason);
    SendClientMessageToAll(COLOUR_LIGHTRED, string);
    new unbantime = (hours * 60) + gettime();
    MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime", unbantime, "Accounts");
    Kick(giveplayerid);
    return 1;
}
I cannot find anything wrong with this code, when I /tban myself for 1 hour, the mysql saves this: 1319921684, don't ask me why, thats why Iam asking you... strange, eh? it all works. and it even checks to see if theyre temp banned when connecting and kicks them, but imagine banning someone for 1 hour to find its over a million...
Reply
#2

It saves that because gettime returns a unix timestamp.

http://en.wikipedia.org/wiki/Unix_time
Reply
#3

Yeah but, this confuses me completely, can you elaborate?
Reply
#4

as far as i know. If you retrieve the time in unix timestamp it is. And make sure you save it as an hour later. You compare what you saved with what you have. you should be able to unban. As in the code i can see. Then if you get the if statement: if(BanTime == gettime) { unban stuff happens. } or something like that. If you use print_r(gettime()); you could also see what the gettime does. And how it works a bit.
Reply
#5

I'm not really experienced in this but I'm sure if you check this source you'll find out the issue.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)