[Ajuda] Sistema de data para vip - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Sistema de data para vip (
/showthread.php?tid=653422)
Sistema de data para vip -
Feconito - 04.05.2018
bom, tenho aqui um sistema de calendбrio, bom, queria usar esse sistema para determinar o tempo vip de um player
segue o cуdigo abaixa:
PHP Code:
{
getdate(Ano, Mes, Dia);
gettime(Horas, Minutos, Segundos);
if(Minutos == 0 && Segundos == 0)
{
format(String, sizeof(String), "[BPT]: Sгo %d:00 horas",Horas);
SendClientMessageToAll(VERDE_BEM_CLARO ,String);
PayDay(playerid);
return true;
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
OnPlayerSave(i);
DOF2_SaveFile();
if(Mes == 1) { String = "Janeiro"; }
else if(Mes == 2) { String = "Fevereiro"; }
else if(Mes == 3) { String = "Marco"; }
else if(Mes == 4) { String = "Abril"; }
else if(Mes == 5) { String = "Maio"; }
else if(Mes == 6) { String = "Junho"; }
else if(Mes == 7) { String = "Julho"; }
else if(Mes == 8) { String = "Agosto"; }
else if(Mes == 9) { String = "Setembro"; }
else if(Mes == 10) { String = "Outubro"; }
else if(Mes == 11) { String = "Novembro"; }
else if(Mes == 12) { String = "Dezembro"; }
format(String, sizeof(String), "%d de %s~n~%s%d/%s%d/2018~n~ %s%d:%s%d:%s%d",Dia, String, ((Dia < 10) ? ("0") : ("")) ,Dia, ((Mes < 10) ? ("0") : ("")), Mes, (Horas < 10) ? ("0") : (""), Horas, (Minutos < 10) ? ("0") : (""), Minutos, (Segundos < 10) ? ("0") : (""), Segundos);
TextDrawSetString(Horario[i], String);
Re: Sistema de data para vip -
F1N4L - 04.05.2018
Usando gettime()...
gettime trabalha com segundos e retorna unix timestamp, entгo vocк pode usar a seguinte forma:
gettime() + segundos
12 horas:
gettime() + (60 * 60 * 12)
1 dia:
gettime() + (60 * 60 * 24)
7 dias:
gettime() + (60 * 60 * 24 * 7)
Apуs isso, vocк precisa saber o tempo restante. Para isso usa-se uma incrнvel fуrmula de subtraзгo:
Maior - Menor = valor restante
(60 * 60 * 24 * 7 + gettime()) - gettime()