/* BB AFK System By BlackBomb Version v0.1 */ //Includes #include #include //Define Colours #define green 0xFF0000 #define red 0xFF0000FF #define orange 0xFF9900AA #define COLOR_GREEN 0x33AA33AA #define COLOR_ORANGE 0xFF9900AA #define COLOR_WHITE 0xFFFFFFAA #define COLOR_RED 0xFF0000AA #define COLOR_LIGHTBLUE 0x33CCFFAA #define COLOR_YELLOW 0xFFFF00AA new AFK[MAX_PLAYERS]; new Float:xpos,Float:ypos,Float:zpos; new Float:hp[MAX_PLAYERS]; new Float:armour[MAX_PLAYERS]; CMD:afk(playerid, params []) { if(AFK[playerid] == 1) { return SendClientMessage(playerid,COLOR_RED,"You are Already AFK."); } TogglePlayerControllable(playerid, 0); new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid, pName, MAX_PLAYER_NAME); GetPlayerPos(playerid,xpos,ypos,zpos); GetPlayerHealth(playerid,hp[playerid]); GetPlayerArmour(playerid,armour[playerid]); AFK[playerid] = 1; SetPlayerHealth(playerid,100000); SetPlayerArmour(playerid,100000); SetPlayerInterior(playerid,17); SetPlayerPos(playerid, 486.890991,-14.522799,1000.679687); GameTextForPlayer(playerid,"~G~ You're ~P~Now ~Y~AFK",3000,3); ApplyAnimation(playerid,"DANCING","dance_loop", 4.1,1,1,1,1,1); format(string, sizeof(string), "%s {33CCFF}is now {33AA33}Away From His Keyboard.",pName); SendClientMessageToAll(red,string); SendClientMessage(playerid, COLOR_YELLOW, "[AFK] - When you come back, use /back!"); return 1; } CMD:back(playerid, params []) { if(AFK[playerid] == 0) { return SendClientMessage(playerid,COLOR_RED,"You Must be AFK to use this Command."); } new string[129], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); AFK[playerid] = 0; SetPlayerPos(playerid,xpos,ypos,zpos); SetPlayerHealth(playerid,hp[playerid]); SetPlayerArmour(playerid,armour[playerid]); ClearAnimations(playerid); SetPlayerInterior(playerid,0); GameTextForPlayer(playerid,"~G~ Well~P~Come ~Y~Back",3000,3); format(string,sizeof string, "%s {33CCFF}is no longer {33AA33}Away From His Keyboard.",pName); SendClientMessageToAll(red,string); TogglePlayerControllable(playerid, 1); SendClientMessage(playerid, COLOR_WHITE, "Welcome Back!"); return 1; } CMD:afkhelp(playerid, params []) { SendClientMessage(playerid, red, "___________________________BB-AFK System Help___________________________"); SendClientMessage(playerid, COLOR_LIGHTBLUE, "To Get in AFK Status Use: /AFK "); SendClientMessage(playerid, COLOR_LIGHTBLUE, "To Get Back Into the normal status ( not afk any more ) Use: /Back"); SendClientMessage(playerid, red, "_________________________________________________________________________"); return 1; } public OnPlayerText(playerid,text[]) { if(AFK[playerid] == 1) return SendClientMessage(playerid, red, "You Cannot Talk, while You're AFK."), 0; return 1; }