Advertisement
xXjuanloXx

SA-MP AFK System [FS]

Oct 26th, 2012
340
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.03 KB | None | 0 0
  1. /*
  2.  
  3. Filterscript created by: Phantom
  4. Credits:
  5. lelemaster for helping me while doing the script.
  6. V1ceC1ty for helping me while doing the script aswell.
  7. Akira297 for insipiring me to script.
  8. Note: If you release / use it on any webpage or gamemode give me credits.
  9. Feel free to Edit/remove/add lines of code to the FS.
  10. SA:MP Forums
  11.  
  12.  
  13. */
  14. #include <a_samp>
  15. new pAFK[MAX_PLAYERS] = 0;
  16. #if defined FILTERSCRIPT
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.         print("\n--------------------------------------");
  21.         print(" Away from keyboard FS Loaded");
  22.         print("--------------------------------------\n");
  23.         return 1;
  24. }
  25.  
  26. public OnFilterScriptExit()
  27. {
  28.         return 1;
  29. }
  30.  
  31. #else
  32.  
  33. main()
  34. {
  35.         print("\n----------------------------------");
  36.         print(" Away from keyboard FS Unloaded");
  37.         print("----------------------------------\n");
  38. }
  39. new Pafk[MAX_PLAYERS] = 0;
  40.  
  41. public OnPlayerCommandText(playerid, cmdtext[])
  42. {
  43.     if (strcmp("/afk", cmdtext, true, 10) == 0)
  44.     {
  45.         if(Pafk[playerid] == 1)
  46.         {
  47.             SendClientMessage(playerid, 0xEFEFF7AA, "You are already AFK! As you typed this, it means you are back!");
  48.             pAFK[playerid] == 0;
  49.         }
  50.         else if(Pafk[playerid] == 0)
  51.         {
  52.             SendClientMessage(playerid, 0xFFFFFFFF, "You are now AFK!");
  53.             SetPlayerVirtualWorld(playerid, 69696969);
  54.             pAFK[playerid] == 1;
  55.         }
  56.         return 1;
  57.     }
  58.     if (strcmp("/back", cmdtext, true, 10) == 0)
  59.     {
  60.         if(pAFK[playerid] == 0)
  61.         {
  62.             SendClientMessage(playerid, 0xEFEFF7AA, "You are not even AFK!!");
  63.         }
  64.         else if(pAFK[playerid] == 1)
  65.         {
  66.             pAFK[playerid] == 0;
  67.             SetPlayerVirtualWorld(playerid, 0);
  68.             SendClientMessage(playerid, 0xFFFFFFFF, "You are now back");
  69.         }
  70.         return 1;
  71.     }
  72.     return 0;
  73. }
  74.  
  75. public OnPlayerDisconnect(playerid)
  76. {
  77.     pAFK[playerid] = 0;
  78.     return 1;
  79. }
  80. public OnPlayerConnect(playerid)
  81. {
  82.         pAFK[playerid] == 0;
  83. }
  84. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement