TempBan help
#1

Hello, I made a good working /ban command with days like "/ban [playerid/part of name] [days] [reason]". Yes, it works correctly but the unban system doesnt really work. Here is the code:

pawn Код:
new second, minute, hour, day, month, year;
        gettime(second,minute,hour);
        getdate(day,month,year);
        new psecond, pminute, phour, pday, pmonth, pyear;
        psecond = PlayerInfo[playerid][pSecond];
        pminute = PlayerInfo[playerid][pMinute];
        phour = PlayerInfo[playerid][pHour];
        pday = PlayerInfo[playerid][pDay];
        pmonth = PlayerInfo[playerid][pMonth];
        pyear = PlayerInfo[playerid][pYear];
        if(pyear != 0)
        {
            if(pyear>year||(pyear==year&&pmonth>month)||(pyear==year&&pmonth==month&&pday>day)||(pyear==year&&pmonth==month&&pday==day&&phour>hour)||(pyear==year&&pmonth==month&&pday==day&&phour==hour&&pminute>minute)||(pyear==year&&pmonth==month&&pday==day&&phour==hour&&pminute==minute&&psecond>second))
            {
            format(string2, sizeof(string2), "You are banned by admin %s for reason %s, until date %d/%d/%d (day/month/year), time %d:%d:%d", PlayerInfo[playerid][pBanned], PlayerInfo[playerid][pReason], PlayerInfo[playerid][pDay], PlayerInfo[playerid][pMonth], PlayerInfo[playerid][pYear], PlayerInfo[playerid][pHour], PlayerInfo[playerid][pMinute], PlayerInfo[playerid][pSecond]);
            SendClientMessage(playerid, COLOR_LIGHTGREEN, string2);
            KickWithMessage(playerid, COLOR_LIGHTRED, "If you want to make an unban appeal, please login on our forum: www.rrf-ro.com");
            return 1;
            }
            SendClientMessage(playerid, COLOR_GREEN, "Your ban expired. Welcome back on our server and try to respect the rules.");
            PlayerInfo[playerid][pSecond] = 0;
            PlayerInfo[playerid][pMinute] = 0;
            PlayerInfo[playerid][pHour] = 0;
            PlayerInfo[playerid][pDay] = 0;
            PlayerInfo[playerid][pMonth] = 0;
            PlayerInfo[playerid][pYear] = 0;
        }
Again, ban system works well, I banned myself for 1 day, 10 days, 40 days etc and all were good when I opened my account in scriptfiles, the second, minute, hour, day, month and year was ok there. The problem is here, I think didn't make it correctly:
pawn Код:
if(pyear>year||(pyear==year&&pmonth>month)||(pyear==year&&pmonth==month&&pday>day)||(pyear==year&&pmonth==month&&pday==day&&phour>hour)||(pyear==year&&pmonth==month&&pday==day&&phour==hour&&pminute>minute)||(pyear==year&&pmonth==month&&pday==day&&phour==hour&&pminute==minute&&psecond>second))
When I enter the server it tells me that i am banned until date 21/2/2014, time: 11:45:2 and right now here is 21/2/2014 and time 12:32.
Reply
#2

try reversing the > < and see what happens
Reply
#3

Quote:
Originally Posted by Vanter
Посмотреть сообщение
try reversing the > < and see what happens
That's like saying "Try turning it off and back on."

You could set new variables for the time set, something like:
enum TimeOut;
TimeEnd [playerid] [year]
..........................[month]
..........................[day]
etc.

Then:
if (GetPlayerTime >= TimeOut)
{
Remove from TimeOut (ban)
}

Im no scripting expert but I think you can see what I mean.
Reply
#4

the condition u have given in if is for unban and the statements included in if it are for banned person
Reply
#5

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
the condition u have given in if is for unban and the statements included in if it are for banned person
No, pYear etc means when the player will be unbanned. So if the player will be unbanned in "2015" and the current year is "2014" it will tell the player that he is banned. But if player will be unbanned in 2014 month 2 and we are in 2014 month 1 it will tell him the same thing. Same for the others.

Aerotactics, I dont really understand what you mean.
Reply
#6

unix timestamps.
Reply
#7

Solved with unix timestamps. Thanks all.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)