Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Simple afk system by Audi_Quattrix
- #define FILTERSCRIPT
- #include <a_samp>
- #include <zcmd>
- #if defined FILTERSCRIPT
- #define DRED 0xFF0000AA
- #define WHITE 0xFFFFFFFF
- new AFK[MAX_PLAYERS];
- new BRB[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" AFK system by Audi_Quattrix loaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n--------------------------------------");
- print(" AFK system by Audi_Quattrix unloaded");
- print("--------------------------------------\n");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- BRB[playerid] = 0;
- return 1;
- }
- CMD:afk(playerid)
- {
- if (AFK[playerid] == 1)
- {
- SendClientMessage(playerid,DRED,"You are already AFK!");
- }
- else
- {
- new string[128];
- format(string,sizeof(string)," %s is now Away From Keyboard (AFK)",GetPlayerNameEx(playerid));
- SendClientMessageToAll(WHITE,string);
- TogglePlayerControllable(playerid,0);
- SendClientMessage(playerid,WHITE,"You are now AFK!");
- AFK[playerid] = 1;
- }
- return 1;
- }
- CMD:brb(playerid)
- {
- if (BRB[playerid] == 1)
- {
- SendClientMessage(playerid,DRED,"You are already AFK!");
- }
- else
- {
- new string[128];
- format(string,sizeof(string)," %s will be right back (BRB)",GetPlayerNameEx(playerid));
- SendClientMessageToAll(WHITE,string);
- TogglePlayerControllable(playerid,0);
- SendClientMessage(playerid,WHITE,"You are now AFK!");
- BRB[playerid] = 1;
- }
- return 1;
- }
- CMD:back(playerid)
- {
- if (AFK[playerid] == 0 && BRB[playerid] == 0)
- {
- SendClientMessage(playerid,DRED,"You are already back!");
- }
- else
- {
- new string[128];
- format(string,sizeof(string)," %s is now back!",GetPlayerNameEx(playerid));
- SendClientMessageToAll(WHITE,string);
- TogglePlayerControllable(playerid,1);
- SendClientMessage(playerid,WHITE,"Welcome back!");
- AFK[playerid] = 0;
- BRB[playerid] = 0;
- }
- return 1;
- }
- CMD:afklist(playerid)
- {
- SendClientMessage(playerid,WHITE,"AFK players:");
- for(new i = 0; i < MAX_PLAYERS; i++)
- {
- if(IsPlayerConnected(i))
- {
- if(AFK[i] == 1 || BRB[i] == 1)
- {
- new name[MAX_PLAYER_NAME];
- new string[128];
- GetPlayerName(i,name,sizeof(name));
- format(string,sizeof(string),"Name: %s || Player ID: %i",name,i);
- SendClientMessage(playerid,WHITE,string);
- }
- }
- }
- return 1;
- }
- stock GetPlayerNameEx(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
- return Name;
- }
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement