Quote:
Originally Posted by Isolated
pawn Code:
IsPlayerBanned(playerid) { new String[100]; if(BanInfo[playerid][pBanned] == 1) { if(gettime() > BanInfo[playerid][pUnbanTime]) { UnbanPlayer(playerid); SendClientMessage(playerid, COLOR_WHITE, "You have been unbanned from the server."); format(String, sizeof(String), "** %s(ID: %d) has been unbanned from the server."); SendClientMessageToAll(COLOR_YELLOW, String); return 1; } else { new diff_secs = (BanInfo[playerid][pUnbanTime] - gettime()); new mins = floatround(diff_secs / 60); new hours = floatround(diff_secs / 60 * 60);
new Format[70]; format(Format, sizeof(Format), "%d Hours %d Minutes", hours, mins); format(String, sizeof(String), "You are currently banned. You have %s till the removal of your ban.", Format); SendClientMessage(playerid, COLOR_RED, String); format(String, sizeof(String), "You were banned for: %s", BanInfo[playerid][pReason]); SendClientMessage(playerid, COLOR_RED, String); SendClientMessage(playerid, COLOR_RED, "You can appeal this ban at "#serverDomain); KickPlayer(playerid, "Banned Account"); return 1; } } return 1; }
It works, however it bans the user for 3180 hours.
|
Sorry for my English. I'm from Brazil ..
Well, really wrong. If we divide the result by 60 and multiply by 60. back to the value before the split. Attempts to divide by 60 2 times ..
pawn Code:
new hours = floatround(diff_secs / 60 * 60);
Change to:
pawn Code:
new hours = floatround(diff_secs / 60 / 60);
Here it worked that way ...
EDIT: Spellcheck