Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- **** AFK System - UberEverywhere ****
- */
- #define FILTERSCRIPT
- #include <a_samp>
- new AFK[MAX_PLAYERS];
- public OnFilterScriptInit()
- {
- print(" ._._._._._._._._._._._._._._._._._.");
- print(" AFK System by UberEverywhere loaded");
- print(" .-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- AFK[playerid] = 0;
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new pname[24], str[128];
- GetPlayerName(playerid, pname, 24);
- if(!strcmp(cmdtext, "/afk", true))
- {
- if(AFK[playerid] == 1)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are already AFK! Type /back to get back from AFK");
- return 1;
- }
- SendClientMessage(playerid, -1, "You are now AFK! Type /back to get back from AFK");
- format(str, sizeof(str), "%s [%d] is now AFK!", pname, playerid);
- SendClientMessageToAll(-1, str);
- TogglePlayerControllable(playerid, 0);
- AFK[playerid] = 1;
- return 1;
- }
- if(!strcmp(cmdtext, "/back", true))
- {
- if(AFK[playerid] == 0)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are not AFK! Type /afk to go AFK");
- return 1;
- }
- SendClientMessage(playerid, -1, "Welcome back :)");
- TogglePlayerControllable(playerid, 1);
- format(str, sizeof(str), "%s [%d] is now back from AFK!", pname, playerid);
- SendClientMessageToAll(-1, str);
- AFK[playerid] = 0;
- return 1;
- }
- return 0;
- }
- public OnPlayerText(playerid, text[])
- {
- if(AFK[playerid] == 1)
- {
- SendClientMessage(playerid, -1, "{FF0000}ERROR:{FFFFFF} You are AFK. Type /back to talk again.");
- return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement