Advertisement
dodostyle

Testaa Aee Exu!

Apr 23rd, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.48 KB | None | 0 0
  1. #define Tempo_Respawn 60
  2. new TempoRespawn;
  3.  
  4. //ongame
  5. SetTimer("TimerRp", 8000, true);
  6.  
  7.  
  8. //No Comando
  9. TempoRespawn = PegaTimerUla()+Tempo_Respawn*60;
  10. //
  11.  
  12. forward TimerRp();
  13. public TimerRp()
  14. {
  15. if(TempoRespawn > PegaTimerUla())
  16. {
  17. new str[128];
  18. format(str, sizeof(str), "%s", Convert(TempoRespawn-PegaTimerUla()));
  19. if(!strfind(str,"50m", true))
  20. {
  21. //Falta 50 minutos...
  22. }
  23. else if(!strfind(str,"30m", true))
  24. {
  25. //Falta 30 minutos...
  26. }
  27. else if(!strfind(str,"10m", true))
  28. {
  29. //Falta 30 minutos...
  30. }
  31. else if(!strfind(str,"1m", true))
  32. {
  33. //Falta 1 minuto...
  34. }
  35. else
  36. {
  37. //Erro o.O
  38. }
  39. return 0x01;
  40. }
  41. else
  42. {
  43. //Respawn
  44. TempoRespawn = PegaTimerUla()+Tempo_Respawn*60;
  45. }
  46. }
  47.  
  48.  
  49. stock Convert(number)
  50. {
  51. new hours = 0, mins = 0, secs = 0, string[100];
  52. hours = floatround(number / 3600);
  53. mins = floatround((number / 60) - (hours * 60));
  54. secs = floatround(number - ((hours * 3600) + (mins * 60)));
  55. new days = 0;
  56.  
  57. if(hours >= 24)
  58. {
  59. days = floatround((hours/24), floatround_floor);
  60. hours = hours % 24;
  61. }
  62.  
  63. if(days > 0)
  64. {
  65. format(string, 100, "%ddias, %dh %dm e %ds", days, hours, mins, secs);
  66. }
  67. else if(hours > 0)
  68. {
  69. format(string, 100, "%dh %dm e %ds", hours, mins, secs);
  70. }
  71. else
  72. {
  73. format(string, 100, "%dm", mins);
  74. }
  75. return string;
  76. }
  77.  
  78. stock SaporraVai(hour,minute,second,day,month,year)
  79. {
  80. new timestamp2;
  81. timestamp2 = second + (minute * 60) + (hour * 3600);
  82. new days_of_month[12];
  83. if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) )
  84. {
  85. days_of_month = {31,29,31,30,31,30,31,31,30,31,30,31}; // Schaltjahr
  86. }
  87. else
  88. {
  89. days_of_month = {31,28,31,30,31,30,31,31,30,31,30,31}; // keins
  90. }
  91. new days_this_year = 0;
  92. days_this_year = day;
  93. if(month > 1)
  94. {
  95. for(new i=0; i<month-1;i++)
  96. {
  97. days_this_year += days_of_month[i];
  98. }
  99. }
  100. timestamp2 += days_this_year * 86400;
  101. for(new j=1970;j<year;j++)
  102. {
  103. timestamp2 += 31536000;
  104. if ( ((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0) ) timestamp2 += 86400; // Schaltjahr + 1 Tag
  105. }
  106. return timestamp2;
  107. }
  108.  
  109. stock PegaTimerUla()
  110. {
  111. new hour,minute,second;
  112. new year, month,day;
  113. gettime(hour, minute, second);
  114. getdate(year, month, day);
  115. return SaporraVai(hour,minute,second,day,month,year);
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement