time ban problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: time ban problem (
/showthread.php?tid=624024)
time ban problem -
Mister0 - 09.12.2016
I try to make a message to dysplay the ban time left,
when I use command /ban
time = gettime() + (days*86400); //86400 I know this it means a day in unix
and when login
"Ban will expire in %d and %d hours",(time-gettime())/86400 , (time-/86400)-(time/86400)/24*24);
SendClientMessage(playerid, -1, string);
,(time-gettime())/86400 this is 2 days and is good, but last who should be hours is wrong 8 and should be 24 because I just banned me for 3 days
Re: time ban problem -
Dayrion - 09.12.2016
I'm doing like this:
PHP код:
//Onplayerconnect
if(gettime() < pAccount[playerid][pBanTime])
{
new heure, // hour
jour, // day
minute, // minutes
secondes; // seconds
TimeToDate(pAccount[playerid][pBanTime]-gettime(), _, _, jour, heure, minute, secondes);
KillTimer(p_TimerSpawnAFK{playerid});
if(jour >= 365)
{
SCM(playerid, RED, "Vous кtes banni dйfinitevement du serveur. Veuillez contacter ** en cas d'erreur.");
pAccount[playerid][pBanTime] = gettime() + jour*60*60*24;
}
else
SCMF(playerid, RED, "Vous кtes banni du serveur pour encore %02i jours, %02i heures, %02i minutes, %02i secondes", jour, heure, minute, secondes);
AdminWarn("%s a tentй de se connecter avec un compte banni.", GetName(playerid, true));
SaveSpecificPlayerStats(playerid, 18);
call_kick(playerid, 200, false, false);
return 1;
}
// --
TimeToDate(time, &annee = 0, &mois = 0, &jour = 0, &heure = 0, &minute = 0, &seconds = 0)
{
seconds = time % 60;
minute = time / 60;
heure = minute / 60;
if(minute >= 60)
minute %= 60;
jour = heure / 24;
if(heure >= 24)
heure %= 24;
mois = jour / 30;
if(jour >= 30)
heure %= 30;
annee = mois / 12;
if(mois >= 12)
mois %= 12;
}
This is not an accurate method for ban which is higher than 30 days.
Re: time ban problem -
Logic_ - 10.12.2016
Use TimeStampToDate.