Xizzaar

SA-MP Server Basic AFK System

Apr 24th, 2011
523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.27 KB | None | 0 0
  1. //            ***TiiX's Afk System***
  2. #include <a_samp>
  3.  
  4. #define COLOR_YELLOW 0xFFFF00AA
  5.  
  6. #if defined FILTERSCRIPT
  7.  
  8. public OnFilterScriptInit()
  9. {
  10.         print("\n-----------------------------------------");
  11.         print(" AFK Filterscript Created by TiiX ");
  12.         print("----------------------------------------\n-");
  13.         return true;
  14. }
  15.  
  16. public OnFilterScriptExit()
  17. {
  18.         return true;
  19. }
  20.  
  21. #else
  22.  
  23. main()
  24. {
  25.         print("\n-----------------------------------------");
  26.         print("  Afk Filterscript Created by TiiX  ");
  27.         print("-----------------------------------------\n");
  28. }
  29.  
  30. #endif
  31.  
  32. public OnPlayerCommandText(playerid, cmdtext[])
  33. {
  34.         if(strcmp(cmdtext, "/afk", true) == 0) {
  35.  
  36.                 new pName[MAX_PLAYER_NAME];
  37.                 new string [48];
  38.                 GetPlayerName(playerid, pName, sizeof(pName));
  39.                 format(string, sizeof(string), "You are AFK");
  40.                 SendClientMessage(playerid,COLOR_YELLOW, string);
  41.                 format(string, sizeof(string), "%s, %d is AFK)", pName);
  42.                 SendClientMessageToAll(COLOR_YELLOW, string);
  43.                 TogglePlayerControllable(playerid,0);
  44.  
  45.                 return true;
  46.         }
  47.         if(strcmp(cmdtext, "/back", true) == 0) {
  48.  
  49.                 new pName[MAX_PLAYER_NAME];
  50.                 new string[48];
  51.                 GetPlayerName(playerid, pName, sizeof(pName));
  52.                 format(string, sizeof(string), "You are back");
  53.                 SendClientMessage(playerid,COLOR_YELLOW, string);
  54.                 format(string, sizeof(string), "%s, %d is back", pName);
  55.                 SendClientMessageToAll(COLOR_YELLOW, string);
  56.                 TogglePlayerControllable(playerid,1);
  57.  
  58.                 return true;
  59.         }
  60.         if(strcmp(cmdtext, "/brb", true) == 0) {
  61.  
  62.                 new pName[MAX_PLAYER_NAME];
  63.                 new string [48];
  64.                 GetPlayerName(playerid, pName, sizeof(pName));
  65.                 format(string, sizeof(string), "You will be right back");
  66.                 SendClientMessage(playerid,COLOR_YELLOW, string);
  67.                 format(string, sizeof(string), "%s, %d will be right back)", pName);
  68.                 SendClientMessageToAll(COLOR_YELLOW, string);
  69.                 TogglePlayerControllable(playerid,0);
  70.  
  71.                 return true;
  72.         }
  73.         return false;
  74. }
Advertisement
Add Comment
Please, Sign In to add comment