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
- #define green 0x00FF00C8
- #define EMBED_RED {AA3333}
- #define EMBED_BLUE {0FFDD3}
- #define EMBED_GREEN {00FF00}
- new pName[24]; //Setting up the variables.
- new str[128]; //^^
- new pName2[24]; //^^
- new str2[128]; //^^
- new CantTalk[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 without any errors.");
- print("--------------------------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- IsAFK[playerid] = 0; //Makes it so the player is not already AFK on connect.
- }
- CMD: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 {00FF00}AFK! {0FFDD3}(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;
- }
- CMD: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 {0FFDD3}back from being {00FF00}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, red, "You are not AFK!"); //The error message it will send if the player is not already AFK.
- return 1;
- }
- CMD: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, red, "{0FFDD3}Players Currently {00FF00}AFK:");
- GetPlayerName(playerid, pName3, sizeof(pName3));
- format(pString, sizeof(pString), "%s", pName3);
- SendClientMessage(playerid, red, pString);
- }
- }
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- IsAFK[playerid] = 0;
- }
- public OnPlayerText(playerid, text[])
- {
- if(IsAFK[playerid] == 1)
- format(CantTalk, 128, "You are currently in AFK (Away From Keyboard) Mode. You cannot talk until you type /Back.");
- SendClientMessage(playerid, red, CantTalk);
- return 0;
- }
- /*
- ---------------------------------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-----------------------------------------
- */
- /*CHANGELOG V1.2
- Added some embedded colors.
- Fixed some indentation issues.
- Added so when a player tries to talk, while AFK, they get a message saying they cannot talk, and their message won't be sent.
- Made it so the AFK Variable is set to 0 when the player disconnects.
- Pruned the script.
- */
Advertisement
Add Comment
Please, Sign In to add comment