AFK.pwn 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. BB AFK System
  3. By BlackBomb
  4. Version v0.1
  5. */
  6. //Includes
  7. #include <a_samp>
  8. #include <zcmd>
  9. //Define Colours
  10. #define green 0xFF0000
  11. #define red 0xFF0000FF
  12. #define orange 0xFF9900AA
  13. #define COLOR_GREEN 0x33AA33AA
  14. #define COLOR_ORANGE 0xFF9900AA
  15. #define COLOR_WHITE 0xFFFFFFAA
  16. #define COLOR_RED 0xFF0000AA
  17. #define COLOR_LIGHTBLUE 0x33CCFFAA
  18. #define COLOR_YELLOW 0xFFFF00AA
  19. new AFK[MAX_PLAYERS];
  20. new Float:xpos,Float:ypos,Float:zpos;
  21. new Float:hp[MAX_PLAYERS];
  22. new Float:armour[MAX_PLAYERS];
  23. CMD:afk(playerid, params [])
  24. {
  25. if(AFK[playerid] == 1)
  26. {
  27. return SendClientMessage(playerid,COLOR_RED,"You are Already AFK.");
  28. }
  29. TogglePlayerControllable(playerid, 0);
  30. new string[64], pName[MAX_PLAYER_NAME];
  31. GetPlayerName(playerid, pName, MAX_PLAYER_NAME);
  32. GetPlayerPos(playerid,xpos,ypos,zpos);
  33. GetPlayerHealth(playerid,hp[playerid]);
  34. GetPlayerArmour(playerid,armour[playerid]);
  35. AFK[playerid] = 1;
  36. SetPlayerHealth(playerid,100000);
  37. SetPlayerArmour(playerid,100000);
  38. SetPlayerInterior(playerid,17);
  39. SetPlayerPos(playerid, 486.890991,-14.522799,1000.679687);
  40. GameTextForPlayer(playerid,"~G~ You're ~P~Now ~Y~AFK",3000,3);
  41. ApplyAnimation(playerid,"DANCING","dance_loop", 4.1,1,1,1,1,1);
  42. format(string, sizeof(string), "%s {33CCFF}is now {33AA33}Away From His Keyboard.",pName);
  43. SendClientMessageToAll(red,string);
  44. SendClientMessage(playerid, COLOR_YELLOW, "[AFK] - When you come back, use /back!");
  45. return 1;
  46. }
  47. CMD:back(playerid, params [])
  48. {
  49. if(AFK[playerid] == 0)
  50. {
  51. return SendClientMessage(playerid,COLOR_RED,"You Must be AFK to use this Command.");
  52. }
  53. new string[129], pName[MAX_PLAYER_NAME];
  54. GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
  55. AFK[playerid] = 0;
  56. SetPlayerPos(playerid,xpos,ypos,zpos);
  57. SetPlayerHealth(playerid,hp[playerid]);
  58. SetPlayerArmour(playerid,armour[playerid]);
  59. ClearAnimations(playerid);
  60. SetPlayerInterior(playerid,0);
  61. GameTextForPlayer(playerid,"~G~ Well~P~Come ~Y~Back",3000,3);
  62. format(string,sizeof string, "%s {33CCFF}is no longer {33AA33}Away From His Keyboard.",pName);
  63. SendClientMessageToAll(red,string);
  64. TogglePlayerControllable(playerid, 1);
  65. SendClientMessage(playerid, COLOR_WHITE, "Welcome Back!");
  66. return 1;
  67. }
  68. CMD:afkhelp(playerid, params [])
  69. {
  70. SendClientMessage(playerid, red, "___________________________BB-AFK System Help___________________________");
  71. SendClientMessage(playerid, COLOR_LIGHTBLUE, "To Get in AFK Status Use: /AFK ");
  72. SendClientMessage(playerid, COLOR_LIGHTBLUE, "To Get Back Into the normal status ( not afk any more ) Use: /Back");
  73. SendClientMessage(playerid, red, "_________________________________________________________________________");
  74. return 1;
  75. }
  76. public OnPlayerText(playerid,text[])
  77. {
  78. if(AFK[playerid] == 1) return SendClientMessage(playerid, red, "You Cannot Talk, while You're AFK."), 0;
  79. return 1;
  80. }