Guest User

AFKSystem by NoahF v1.0

a guest
Aug 24th, 2012
376
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 3.38 KB | None | 0 0
  1. #define FILTERSCRIPT         //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
  2. #include <a_samp>            //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
  3. #include <zcmd>              //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
  4. #define blue 0x0FFDD349      //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
  5. #define red 0xAA3333AA       //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
  6.  
  7.     new pName[24]; //Setting up the variables.
  8.     new str[128]; //^^
  9.     new pName2[24]; //^^
  10.     new str2[128]; //^^
  11.     new IsAFK[MAX_PLAYERS]; //^^
  12.  
  13.     public OnFilterScriptInit() //Everything in the brackets below this is called when the Script loads.
  14.     {
  15.             print("-----------------------------------------------------------"); //Prints a message on samp-server.exe saying the script has loaded successfully.
  16.             print(" NoahF's Simple AFK System has loaded with no problems.");
  17.             print("-----------------------------------------------------------");
  18.             return 1;
  19.     }
  20.     public OnFilterScriptExit() //Everything in the brackets below this is called when the script loads.
  21.     {
  22.             print("/n----------------------------------"); //Prints a message on samp-server.exe saying the script has unloaded successfully.
  23.             print(" NoahF's AFK System has unloaded.");
  24.             print("------------------------------------");
  25.             return 1;
  26.     }
  27.    
  28.     public OnPlayerConnect(playerid)
  29.     {
  30.         IsAFK[playerid] = 0; //Makes it so the player is not already AFK on connect.
  31.     }
  32.  
  33.     command(afk, playerid, params[]) //The AFK Command
  34.     {
  35.         if(IsAFK[playerid] == 0) //Checks if the player is not already AFK.
  36.         {
  37.             TogglePlayerControllable(playerid,0); //Makes the player not controllable on the /afk command.
  38.             GetPlayerName(playerid, pName, 24);
  39.             format(str, 128, "%s has gone AFK! (Away from keyboard)", pName); //The message it will send when a player types /afk.
  40.             SendClientMessageToAll(blue, str); //Sends the message to all players
  41.             IsAFK[playerid] = 1; //Tells the system the player is AFK.
  42.         }
  43.         else return SendClientMessage(playerid, blue, "You are already AFK!"); //Sends an error message if the player is already AFK.
  44.         return 1;
  45.     }
  46.  
  47.     command(back, playerid, params[]) //The Back Command
  48.     {
  49.         if(IsAFK[playerid] == 1) //Checks to see if the player is AFK.
  50.         {
  51.             TogglePlayerControllable(playerid,1); //Makes the player controllable on the /back command.
  52.             GetPlayerName(playerid, pName2, 24);
  53.             format(str2, 128, "%s is now back from being AFK!", pName2); //The message it will send when the player types /back.
  54.             SendClientMessageToAll(blue, str2); //Sends the message to all players.
  55.             IsAFK[playerid] = 0; //Tells the system the player is not AFK.
  56.         }
  57.         else return SendClientMessage(playerid, blue, "You aren't AFK!"); //The error message it will send if the player is not already AFK.
  58.         return 1;
  59.     }
  60.  
  61. /*
  62. ---------------------------------DO NOT REMOVE------------------------------------------
  63. NoahF's AFK system made on 8/25/2012.
  64. Please don't remove these credits!
  65. Feel free to post constructive criticism on this forum post so I can improve the script! Thanks, NoahF.
  66. ---------------------------------END OF CREDITS-----------------------------------------
  67. */
Advertisement
Add Comment
Please, Sign In to add comment