Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define Tempo_Respawn 60
- new TempoRespawn;
- //ongame
- SetTimer("TimerRp", 8000, true);
- //No Comando
- TempoRespawn = PegaTimerUla()+Tempo_Respawn*60;
- //
- forward TimerRp();
- public TimerRp()
- {
- if(TempoRespawn > PegaTimerUla())
- {
- new str[128];
- format(str, sizeof(str), "%s", Convert(TempoRespawn-PegaTimerUla()));
- if(!strfind(str,"50m", true))
- {
- //Falta 50 minutos...
- }
- else if(!strfind(str,"30m", true))
- {
- //Falta 30 minutos...
- }
- else if(!strfind(str,"10m", true))
- {
- //Falta 30 minutos...
- }
- else if(!strfind(str,"1m", true))
- {
- //Falta 1 minuto...
- }
- else
- {
- //Erro o.O
- }
- return 0x01;
- }
- else
- {
- //Respawn
- TempoRespawn = PegaTimerUla()+Tempo_Respawn*60;
- }
- }
- stock Convert(number)
- {
- new hours = 0, mins = 0, secs = 0, string[100];
- hours = floatround(number / 3600);
- mins = floatround((number / 60) - (hours * 60));
- secs = floatround(number - ((hours * 3600) + (mins * 60)));
- new days = 0;
- if(hours >= 24)
- {
- days = floatround((hours/24), floatround_floor);
- hours = hours % 24;
- }
- if(days > 0)
- {
- format(string, 100, "%ddias, %dh %dm e %ds", days, hours, mins, secs);
- }
- else if(hours > 0)
- {
- format(string, 100, "%dh %dm e %ds", hours, mins, secs);
- }
- else
- {
- format(string, 100, "%dm", mins);
- }
- return string;
- }
- stock SaporraVai(hour,minute,second,day,month,year)
- {
- new timestamp2;
- timestamp2 = second + (minute * 60) + (hour * 3600);
- new days_of_month[12];
- if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
- {
- days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
- }
- else
- {
- days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // keins
- }
- new days_this_year = 0;
- days_this_year = day;
- if(month > 1)
- {
- for(new i=0; i<month-1;i++)
- {
- days_this_year += days_of_month[i];
- }
- }
- timestamp2 += days_this_year * 86400;
- for(new j=1970;j<year;j++)
- {
- timestamp2 += 31536000;
- if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag
- }
- return timestamp2;
- }
- stock PegaTimerUla()
- {
- new hour,minute,second;
- new year, month,day;
- gettime(hour, minute, second);
- getdate(year, month, day);
- return SaporraVai(hour,minute,second,day,month,year);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement