16.04.2013, 18:32
Hello, i have a tempban system and it works, but there is a problem: When someone joins with a temp banned account, the message saying "account banned for more" is wrong. It shows random numbers. It should show day/month/year - hour/min/sec.
This is the tempban check:
And this is tempban:
What could be wrong?
This is the tempban check:
pawn Код:
public CheckTempBan(playerid)
{
if(pInfo[playerid][TempBan] >= gettime())
{
new Jstring[128];
new echo[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
new minu, hour ,day, sec = pInfo[playerid][TempBan] - gettime();
format(Jstring, sizeof(Jstring),"** (KICK) %s (%d) (Account banned for more %s)", pName,playerid,ConvertTime(sec,minu,hour,day));
format(echo,sizeof echo,"0,4** (KICK) %s (%d) (Account banned for more %s).",pName,playerid,ConvertTime(sec,minu,hour,day));
IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
SCMTA(pink,Jstring);
KickTimer[playerid] = SetTimerEx("KickPlayer",200,false,"d",playerid);
}
else if(pInfo[playerid][TempBan] > 0)
{
new year,month,day;
getdate(year,month,day);
new Jstring[128];
SendClientMessage(playerid,pink,"** Your tempban period has expired, welcome back!");
format(Jstring,sizeof(Jstring),"Expired on: %d/%d/%d",year,month,day);
pInfo[playerid][TempBan] = 0;
}
return 1;
}
pawn Код:
CMD:tempban(playerid, params[])
{
if(pInfo[playerid][Admin] >= 5)
{
new id, reason[128], aName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
new days, year, month, day, hour, minute;
if(sscanf(params, "uis[250]", id, days, reason)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/tempban <playerid> <days> <reason>");
if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "Invalid player ID.");
GetPlayerName(playerid, aName, sizeof(aName));
GetPlayerName(id, pName, sizeof(pName));
pInfo[id][TempBan] = (gettime() + (86400*days));
getdate(year, month, day);
gettime(hour, minute);
new tBans[256], echo[256], banmsg[128];
format(tBans, sizeof(tBans), "** %s (%d) has been temporarily banned by Admin %s (%d) for %d days | Reason: %s (%02d/%02d/%04d | %02d:%02d)", pName, id, aName, playerid, days, reason, day, month, year, hour, minute);
format(echo, sizeof(echo), "0,4** %s (%d) has been temporarily banned by Admin %s (%d) for %d days | Reason: %s (%02d/%02d/%04d | %02d:%02d)", pName, id, aName, playerid, days, reason, day, month, year, hour, minute);
format(banmsg, sizeof(banmsg), "Admin %s (%d) has temp banned you for %d days | Reason: %s", aName, playerid, days, reason);
SendClientMessageToAll(pink, tBans);
IRC_Say(gGroupID, IRC_CHANNEL, echo);
IRC_Say(gGroupID, IRC_ACHANNEL, echo);
SendClientMessage(id, pink, banmsg);
KickTimer[id] = SetTimerEx("KickPlayer", 100, false, "d", id);
}
return 1;
}