CookieMosnter

AFK Timer

Dec 9th, 2012
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new Timer,pPaused[MAX_PLAYERS];
  4.  
  5. forward public AFKTimer(playerid);
  6.  
  7. public OnPlayerConnect(playerid)
  8. {
  9. pPaused[playerid] = 1;
  10. Timer = SetTimerEx("AFKTimer",500,1,"i",playerid);
  11. return 1;
  12. }
  13.  
  14. public AFKTimer(playerid)
  15. {
  16. if(pPaused[playerid] != 0)
  17. {
  18. printf("%d is paused.",playerid);
  19. }
  20. pPaused[playerid] = 1;
  21. return 1;
  22. }
  23.  
  24. public OnPlayerUpdate(playerid)
  25. {
  26. pPaused[playerid] = 0;
  27. return 1;
  28. }
  29.  
  30. public OnPlayerDisconnect(playerid)
  31. {
  32. KillTimer(Timer);
  33. return 1;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment