1. /* AW_timers by [A]lien[W]are (Agus Juarez) (c)
  2. v1 - 27/1/2014
  3. EN: use: AW_SetTimer(call, time, repeats);
  4. ES: uso: AW_SetTimer(funcion, tiempo, repeticiones);
  5. */
  6. #include <a_samp>
  7. #define MAX_AW_TIMERS 1000
  8. /* - ---------------------- - */
  9. new aw_timer = -1,aw_aw_timer[MAX_AW_TIMERS],aw_call[MAX_AW_TIMERS],aw_time[MAX_AW_TIMERS],aw_repeat[MAX_AW_TIMERS];
  10. /* - ---------------------- - */
  11. /*EN: Fix the 'call'
  12. ES: Funcion arreglada*/
  13. stock AW_SetTimer(call[], time, repeats) { aw_timer++; aw_call[aw_timer] = call; aw_time[aw_timer] = time; aw_repeat[aw_timer] = repeats; SetTimer(call, time, true); SetTimerEx("AW_D", time, true, "i", aw_timer); }
  14. forward AW_D(t);
  15. public AW_D(t)
  16. {
  17. if(aw_repeat[t] == 0)
  18. {
  19. KillTimer(aw_aw_timer[t]);
  20. aw_repeat[t] = 0;
  21. }
  22. else
  23. {
  24. aw_repeat[t]--;
  25. }
  26. return 1;
  27. }