Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- /*++++++++++++++++++Made++++++++++++++++++++++++++++++++++++++++++++++*/
- /*++++++++++++++++++++++++by:+++++++++++++++++++++++++++++++++++++++++*/
- /*++++++++++++++++++++++++++++[KMA]Markx++++++++++++++++++++++++++++++*/
- /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
- /*Includes*/
- #include <a_samp>
- #include <zcmd>
- /*Colors*/
- #define COLOR_YELLOW 0xFFFF00FF
- #define COLOR_RED 0xFF0000FF
- /*New's*/
- new IsPlayerAfk[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print("AFK System Made by [KMA]Markx lunched!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print("AFK System Made by [KMA]Markx exited!");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- IsPlayerAfk[playerid] = 0;
- SendClientMessage(playerid, COLOR_YELLOW, "This Server is using AFK system made by: [KMA]Markx"); //Delete this if you want
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- IsPlayerAfk[playerid] = 0;
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(IsPlayerAfk[playerid] == 1)
- {
- SendClientMessage(playerid, COLOR_RED, "ERROR : You can not use chat when you're AFK. Use /back to be back!");
- return 0;
- }
- return 1;
- }
- /*-------------AFK Command-------------*/
- COMMAND:afk(playerid, params[])
- {
- new name[256];
- new afk[256];
- #pragma unused params
- if (IsPlayerAfk[playerid] == 0) {
- new string[64], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(string,sizeof string,".::%s is now Away From Keyboard(AFK)::.",pName);
- SendClientMessageToAll(COLOR_YELLOW,string);
- GetPlayerName(playerid,name, sizeof(name));
- format(afk, sizeof(afk), "~r~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ %s ~w~ is now AFK!", name);
- GameTextForAll(afk,4000,3);
- IsPlayerAfk[playerid] = 1;
- return true;
- }
- if (IsPlayerAfk[playerid] == 1) {
- SendClientMessage(playerid, COLOR_RED, "ERROR : You are alredy AFK! Use /back to be back!"); //Anti Spam
- }
- return true;
- }
- /*-------Back Command-------*/
- COMMAND:back(playerid, params[])
- {
- new name[256];
- new back[256];
- #pragma unused params
- if (IsPlayerAfk[playerid] == 1) {
- new string[64], pName[MAX_PLAYER_NAME];
- GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
- format(string,sizeof string,".::%s is now Back!::.",pName);
- SendClientMessageToAll(COLOR_YELLOW,string);
- GetPlayerName(playerid,name, sizeof(name));
- format(back, sizeof(back), "~r~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~n~ ~r~ %s ~w~ is now back.", name);
- GameTextForAll(back,4000,3);
- IsPlayerAfk[playerid] = 0;
- return true;
- }
- if (IsPlayerAfk[playerid] == 0) {
- SendClientMessage(playerid, COLOR_RED, "ERROR : You arent AFK! Use /afk to be AFK!"); //Anti Spam
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement