Advertisement
Guest User

RollTi's Afficient AFK v1.0 [Inc.]

a guest
Apr 25th, 2012
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. /***********************************************
  2. * roAFK - Afficient AFK System Inc. *
  3. * @Author: RollTi *
  4. * @Version: v1.0 *
  5. * Very Special Thanks to: *
  6. * - Meta for helping in GetPlayerAFKToggle *
  7. * - RollTi (me) for scripting roAFK.inc *
  8. * - iPLEOMAX for giving some good tips/hint *
  9. * *
  10. **********************************************/
  11.  
  12. #if defined _roAFK_included
  13. #endinput
  14. #endif
  15. #define _roAFK_included
  16.  
  17. #include <a_samp>
  18. #include <YSI\y_hooks>
  19.  
  20. new bool:AFKing[MAX_PLAYERS char],
  21. AFKTimer[MAX_PLAYERS];
  22.  
  23. forward OnPlayerAFK(playerid);
  24.  
  25. /*
  26. native TogglePlayerAFK(playerid, toggle);
  27. native GetPlayerAFK(playerid);
  28. */
  29.  
  30. #if defined _FILTERSCRIPT_
  31. hook roAFK_OnFilterScriptInit()
  32. {
  33. print("Your filterscript is using RollTi's Afficient AFK v1.0");
  34. }
  35. #else
  36. hook roAFK_OnGameModeInit()
  37. {
  38. print("Your gamemode is using RollTi's Afficient AFK v1.0");
  39. }
  40. #endif
  41. stock TogglePlayerAFK(playerid, bool:toggle)
  42. {
  43. static Float:hp; GetPlayerHealth(playerid, hp);
  44. if(!toggle)
  45. {
  46. TogglePlayerControllable(playerid, 1);
  47. SetPlayerHealth(playerid, hp);
  48. KillTimer(AFKTimer[playerid]);
  49. AFKing{playerid} = false;
  50. }
  51. if(toggle == true)
  52. {
  53. AFKTimer[playerid] = SetTimerEx("OnPlayerAFK", 60000*5, false, "d", playerid);
  54. SetPlayerHealth(playerid, 9999999.9);
  55. TogglePlayerControllable(playerid, 0);
  56. AFKing{playerid} = true;
  57. }
  58. return 1;
  59. }
  60.  
  61. stock GetPlayerAFKToggle(playerid)
  62. {
  63. return AFKing{playerid};
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement