Hyland

[FS] AFK System

Nov 27th, 2014
511
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #include a_samp
  2. #define COLOR_RED 0xFF0000FF
  3. #define COLOR_GREEN 0x008000FF
  4. #define COLOR_BLUE 0x0000FFFF
  5. #define COLOR_ORANGE 0xFF8000FF
  6. new AFK[MAX_PLAYERS];
  7. new Float:OldHealth;
  8.  
  9.  
  10. public OnFilterScriptInit()
  11. {
  12. print("\n**************************************");
  13. print("*****Simple AFK FS By PsyCho************");
  14. print("**************************************\n");
  15. return 1;
  16. }
  17.  
  18.  
  19.  
  20. public OnPlayerText(playerid, text[])
  21. {
  22. if(AFK[playerid] ==1)
  23. {
  24. SendClientMessage(playerid,COLOR_RED,"You're In AFK You Can't Talk");
  25. return 0;
  26. }
  27. return 1;
  28. }
  29.  
  30. public OnPlayerCommandText(playerid, cmdtext[])
  31. {
  32. if (strcmp("/AFK", cmdtext, true, 10) == 0)
  33. {
  34. if(AFK[playerid] == 1)
  35. {
  36. return SendClientMessage(playerid,COLOR_RED,"You're Already In AFK");
  37. }
  38. new string[128];
  39. new PNAME[MAX_PLAYER_NAME];
  40. new vehicleid;
  41. vehicleid = GetPlayerVehicleID(playerid);
  42. AFK[playerid] = 1;
  43. SetPlayerHealth(playerid,999999999);
  44. SetVehicleHealth(vehicleid,9999999999);
  45. GetPlayerHealth(playerid,OldHealth);
  46. GetVehicleHealth(vehicleid,OldHealth);
  47. SendClientMessage(playerid,COLOR_RED,"You're Now In AFK");
  48. GetPlayerName(playerid, PNAME, MAX_PLAYERS);
  49. format(string, sizeof(string), "%s Is Now In AFK", PNAME);
  50. SendClientMessageToAll(COLOR_BLUE,string);
  51. TogglePlayerControllable(playerid,0);
  52. return 1;
  53. }
  54.  
  55. if (strcmp("/Back", cmdtext, true, 10) == 0)
  56. {
  57. if(AFK[playerid] == 0)
  58. {
  59. return SendClientMessage(playerid,COLOR_RED,"You're Not In AFK To Use This Command");
  60. }
  61. new string[128];
  62. new PNAME[MAX_PLAYER_NAME];
  63. AFK[playerid] = 0;
  64. new vehicleid;
  65. vehicleid = GetPlayerVehicleID(playerid);
  66. SetPlayerHealth(playerid,OldHealth);
  67. SetVehicleHealth(vehicleid,OldHealth);
  68. SendClientMessage(playerid,COLOR_GREEN,"You're Back From AFK");
  69. GetPlayerName(playerid, PNAME, MAX_PLAYERS);
  70. format(string, sizeof(string), "%s Back From AFK", PNAME);
  71. SendClientMessageToAll(COLOR_ORANGE,string);
  72. TogglePlayerControllable(playerid,1);
  73. return 1;
  74. }
  75. return 0;
  76. }
Advertisement
Add Comment
Please, Sign In to add comment