Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define FILTERSCRIPT //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
- #include <a_samp> //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
- #include <zcmd> //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
- #define blue 0x0FFDD349 //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
- #define red 0xAA3333AA //MAKE SURE YOU HAVE THESE INCLUDES IN YOUR PAWNO INCLUDES FOLDER
- new pName[24]; //Setting up the variables.
- new str[128]; //^^
- new pName2[24]; //^^
- new str2[128]; //^^
- new IsAFK[MAX_PLAYERS]; //^^
- public OnFilterScriptInit() //Everything in the brackets below this is called when the Script loads.
- {
- print("\n-----------------------------------------------------------"); //Prints a message on samp-server.exe saying the script has loaded successfully.
- print(" NoahF's Simple AFK System has loaded with no problems.");
- print("-----------------------------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit() //Everything in the brackets below this is called when the script loads.
- {
- print("\n----------------------------------"); //Prints a message on samp-server.exe saying the script has unloaded successfully.
- print(" NoahF's AFK System has unloaded.");
- print("------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- IsAFK[playerid] = 0; //Makes it so the player is not already AFK on connect.
- }
- command(afk, playerid, params[]) //The AFK Command
- {
- if(IsAFK[playerid] == 0) //Checks if the player is not already AFK.
- {
- TogglePlayerControllable(playerid,0); //Makes the player not controllable on the /afk command.
- GetPlayerName(playerid, pName, 24);
- format(str, 128, "%s has gone AFK! (Away from keyboard)", pName); //The message it will send when a player types /afk.
- SendClientMessageToAll(blue, str); //Sends the message to all players
- IsAFK[playerid] = 1; //Tells the system the player is AFK.
- }
- else return SendClientMessage(playerid, blue, "You are already AFK!"); //Sends an error message if the player is already AFK.
- return 1;
- }
- command(back, playerid, params[]) //The Back Command
- {
- if(IsAFK[playerid] == 1) //Checks to see if the player is AFK.
- {
- TogglePlayerControllable(playerid,1); //Makes the player controllable on the /back command.
- GetPlayerName(playerid, pName2, 24);
- format(str2, 128, "%s is now back from being AFK!", pName2); //The message it will send when the player types /back.
- SendClientMessageToAll(blue, str2); //Sends the message to all players.
- IsAFK[playerid] = 0; //Tells the system the player is not AFK.
- }
- else return SendClientMessage(playerid, blue, "You aren't AFK!"); //The error message it will send if the player is not already AFK.
- return 1;
- }
- command(afklist, playerid, params)
- {
- new pString[MAX_PLAYER_NAME], pName3[MAX_PLAYER_NAME];
- for(new pID = 0; pID < MAX_PLAYERS; pID ++)
- {
- if(IsPlayerConnected(pID))
- {
- if(IsAFK[pID] == 1)
- {
- SendClientMessage(playerid, 0xFFFFFFFF, "Players currently AFK:");
- GetPlayerName(playerid, pName3, sizeof(pName3));
- format(pString, sizeof(pString), "%s", pName3);
- SendClientMessage(playerid, 0xFFFFFFFF, pString);
- }
- }
- }
- return 1;
- }
- /*
- ---------------------------------DO NOT REMOVE------------------------------------------
- NoahF's AFK system made on 8/25/2012.
- Please don't remove these credits!
- Feel free to post constructive criticism on this forum post so I can improve the script! Thanks, NoahF.
- ---------------------------------END OF CREDITS-----------------------------------------
- */
Advertisement
Add Comment
Please, Sign In to add comment