Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ______ _ _ ______
- //| ___ \ | | | |___ /
- //| |_/ / |__ __ _ _ __ | |_ ___ _ __ ___ / /
- //| __/| '_ \ / _` | '_ \| __/ _ \| '_ ` _ \ / /
- //| | | | | | (_| | | | | || (_) | | | | | |./ /___
- //\_| |_| |_|\__,_|_| |_|\__\___/|_| |_| |_|\_____/
- #include a_samp
- #define COLOR_RED 0xFF0000FF
- #define COLOR_GREEN 0x008000FF
- #define COLOR_BLUE 0x0000FFFF
- #define COLOR_ORANGE 0xFF8000FF
- new AFK[MAX_PLAYERS];
- new Float:OldHealth;
- public OnFilterScriptInit()
- {
- print("\nAfk System: Loading");
- print("Afk System: Loaded");
- print("Afk System Made by: PhantomZ\n");
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(AFK[playerid] ==1)
- {
- SendClientMessage(playerid,COLOR_RED,"You're AFK. You Can't talk");
- return 0;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/AFK", cmdtext, true, 10) == 0)
- {
- if(AFK[playerid] == 1)
- {
- return SendClientMessage(playerid,COLOR_RED,"You're already AFK");
- }
- new string[128];
- new PNAME[MAX_PLAYER_NAME];
- new vehicleid;
- vehicleid = GetPlayerVehicleID(playerid);
- AFK[playerid] = 1;
- SetPlayerHealth(playerid,999999999);
- SetVehicleHealth(vehicleid,9999999999);
- GetPlayerHealth(playerid,OldHealth);
- GetVehicleHealth(vehicleid,OldHealth);
- SendClientMessage(playerid,COLOR_RED,"You're now AFK");
- GetPlayerName(playerid, PNAME, MAX_PLAYERS);
- format(string, sizeof(string), "%s Is now AFK", PNAME);
- SendClientMessageToAll(COLOR_BLUE,string);
- TogglePlayerControllable(playerid,0);
- return 1;
- }
- if (strcmp("/Back", cmdtext, true, 10) == 0)
- {
- if(AFK[playerid] == 0)
- {
- return SendClientMessage(playerid,COLOR_RED,"You're not AFK, can'y use this command");
- }
- new string[128];
- new PNAME[MAX_PLAYER_NAME];
- AFK[playerid] = 0;
- new vehicleid;
- vehicleid = GetPlayerVehicleID(playerid);
- SetPlayerHealth(playerid,OldHealth);
- SetVehicleHealth(vehicleid,OldHealth);
- SendClientMessage(playerid,COLOR_GREEN,"You're not AFK");
- GetPlayerName(playerid, PNAME, MAX_PLAYERS);
- format(string, sizeof(string), "%s is back from AFK", PNAME);
- SendClientMessageToAll(COLOR_ORANGE,string);
- TogglePlayerControllable(playerid,1);
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement