Advertisement
Guest User

Untitled

a guest
Feb 14th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.17 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. #define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == '\0') && (dcmd_%1(playerid, ""))) || (((%3)[(%2) + 1] == ' ') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
  4.  
  5. #pragma tabsize 0
  6.  
  7.  
  8. #define COLOR_WHITE 0xFFFFFFAA
  9. #define COLOR_GREEN 0x00FF00AA
  10. #define COLOR_RED 0xFF0000AA
  11. #define COLOR_LIGHTBLUE 0x33CCFFAA
  12. #define COLOR_YELLOW 0xFFFF00AA
  13. enum Player
  14. {
  15. AFKstatus
  16. }
  17. new PlayerInfo[MAX_PLAYERS][Player];
  18. public OnFilterScriptInit()
  19. {
  20. return 1;
  21. }
  22.  
  23. public OnFilterScriptExit()
  24. {
  25. return 1;
  26. }
  27.  
  28. dcmd_afk(playerid, params[])
  29. {
  30. #pragma unused params
  31. new string[256];
  32. if (PlayerInfo[playerid][AFKstatus] == 1)
  33. {
  34. SendClientMessage(playerid, COLOR_RED, "ERROR: You are all ready AFK!");
  35. return 1;
  36. }
  37.  
  38. else if (PlayerInfo[playerid][AFKstatus] == 0)
  39. {
  40. new pname[MAX_PLAYER_NAME];
  41. GetPlayerName(playerid, pname, sizeof(pname));
  42. format(string, sizeof(string), "%s (ID:%d) Is away from the keyboard!", pname,playerid);
  43. SendClientMessageToAll(COLOR_YELLOW, string);
  44. TogglePlayerControllable(playerid,0);
  45. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
  46. PlayerInfo[playerid][AFKstatus] = 1;
  47. return 1;
  48. }
  49. return 0;
  50. }
  51.  
  52. dcmd_back(playerid, params[])
  53. {
  54. #pragma unused params
  55. new string[256];
  56. if (PlayerInfo[playerid][AFKstatus] == 1)
  57. {
  58. SendClientMessage(playerid, COLOR_RED, "ERROR: You are all ready BACK!");
  59. return 1;
  60. }
  61.  
  62. else if (PlayerInfo[playerid][AFKstatus] == 0)
  63. {
  64. new pname[MAX_PLAYER_NAME];
  65. GetPlayerName(playerid, pname, sizeof(pname));
  66. format(string, sizeof(string), "%s (ID:%d) Writing aigan keyboard", pname,playerid);
  67. SendClientMessageToAll(COLOR_GREEN, string);
  68. TogglePlayerControllable(playerid,0);
  69. SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
  70. PlayerInfo[playerid][AFKstatus] = 1;
  71. return 1;
  72. }
  73. return 0;
  74. }
  75.  
  76. public OnPlayerDisconnect(playerid, reason)
  77. {
  78. PlayerInfo[playerid][AFKstatus] = 0;
  79. return 1;
  80. }
  81.  
  82.  
  83.  
  84. public OnPlayerText(playerid, text[])
  85. {
  86. if (PlayerInfo[playerid][AFKstatus] == 1)
  87. {
  88. SendClientMessage(playerid, COLOR_RED, "Dude!! use /back to speak!");
  89. return 0;
  90. }
  91.  
  92. else if (PlayerInfo[playerid][AFKstatus] == 0)
  93. {
  94. return 1;
  95. }
  96. return 1;
  97. }
  98.  
  99. public OnPlayerCommandText(playerid, cmdtext[])
  100. {
  101. dcmd(afk,3,cmdtext);
  102. dcmd(back,3,cmdtext);
  103. return 0;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement