21.02.2014, 09:26
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:
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:
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.
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;
}
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))