Advertisement
Guest User

Untitled

a guest
Feb 9th, 2010
626
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.67 KB | None | 0 0
  1. /*
  2. *----------------^_^--------------*
  3. | |
  4. | AFK System |
  5. | |
  6. *----------------^_^--------------*
  7. */
  8. //------------------------------------------------------------------------------
  9. #include <a_samp>
  10. //------------------------------------------------------------------------------
  11. new Text3D: AFK[MAX_PLAYERS];
  12. new AFKS[MAX_PLAYERS];
  13. //------------------------------------------------------------------------------
  14. forward SetPlayerToTeamColor(playerid);
  15. forward OnPlayerConnect(playerid);
  16. //------------------------------------------------------------------------------
  17. #define COLOR_WHITE 0xFFFFFFAA
  18. #define COLOR_AFK 0x595858AA
  19. #define COLOR_LIGHTRED 0xFF6347AA
  20. #define COLOR_LIGHTGREEN 0x9ACD32AA
  21. //------------------------------------------------------------------------------
  22. public OnFilterScriptInit()
  23. {
  24. print("\n-----------------------------------------------------");
  25. print(" Advanced AFK System by Razvann was Loaded with succes!");
  26. print("-------------------------------------------------------\n");
  27. }
  28. public OnPlayerConnect(playerid)
  29. {
  30. AFKS[playerid] = 0;
  31. }
  32. //------------------------------------------------------------------------------
  33. public OnFilterScriptExit()
  34. {
  35. print("\n-------------------------------------------------------");
  36. print(" Advanced AFK System by Razvann was Unloaded with succes!");
  37. print("---------------------------------------------------------\n");
  38. }
  39. //------------------------------------------------------------------------------
  40. public OnPlayerCommandText(playerid, cmdtext[])
  41. {
  42. if (strcmp("/afk", cmdtext, true) == 0)
  43. {
  44. AFKS[playerid] = 1;
  45. TogglePlayerControllable(playerid, 0);
  46. SendClientMessage(playerid, COLOR_WHITE, "You're now afk, type /back to be back!");
  47. AFK[playerid] = Create3DTextLabel("AFK",0x008080FF,0.0,0.0,0.0,20,0,1);
  48. Attach3DTextLabelToPlayer(AFK[playerid], playerid, 0.0, 0.0, -0.6);
  49. SetPlayerColor(playerid, COLOR_AFK);
  50. return 1;
  51. }
  52. if (strcmp("/back", cmdtext, true) == 0)
  53. {
  54. AFKS[playerid] = 0;
  55. TogglePlayerControllable(playerid, 1);
  56. SendClientMessage(playerid, COLOR_WHITE, "You're now back, type /afk to be AFK!");
  57. Delete3DTextLabel(Text3D:AFK[playerid]);
  58. SetPlayerToTeamColor(playerid);
  59. return 1;
  60. }
  61. if(strcmp("/afkhelp", cmdtext, true) == 0)
  62. {
  63. SendClientMessage(playerid, COLOR_WHITE, "** AFK ** /afk /back /afklist");
  64. return 1;
  65. }
  66. if(strcmp(cmdtext, "/afklist", true) == 0)
  67. {
  68. if(IsPlayerConnected(playerid))
  69. {
  70. new count = 0;
  71. SendClientMessage(playerid, COLOR_LIGHTGREEN, "AFKS Online:");
  72. for(new i=0; i < MAX_PLAYERS; i++)
  73. {
  74. if(IsPlayerConnected(i))
  75. {
  76. if(AFKS[i] == 1)
  77. {
  78. new string[256];
  79. new giveplayer[MAX_PLAYER_NAME];
  80. GetPlayerName(i, giveplayer, sizeof(giveplayer));
  81. format(string, sizeof(string), "[%d]%s", i,giveplayer);
  82. SendClientMessage(playerid,COLOR_WHITE,string);
  83. count++;
  84. }
  85. }
  86. }
  87. if(count == 0)
  88. {
  89. SendClientMessage(playerid,COLOR_LIGHTRED,"* Currently no AFKS online.");
  90. }
  91. }
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. //------------------------------------------------------------------------------
  97. public SetPlayerToTeamColor(playerid)
  98. {
  99. if(IsPlayerConnected(playerid))
  100. {
  101. SetPlayerColor(playerid, COLOR_WHITE);
  102. }
  103. }
  104. //------------------------------------------------------------------------------
  105. /*
  106. *----------------^_^--------------*
  107. | |
  108. | AFK System |
  109. | |
  110. *----------------^_^--------------*
  111. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement