Posts: 617
	Threads: 129
	Joined: Feb 2014
	
	
 
	
	
		Ok guys im making an afk system but i want it like this, if i type /afk it will set my health to 100000 for example which i already know how to do that but i want when the playe type /back the old health restores how can i do that.
And if there is any way to avoid when a player pause and another player cant kill them even when they dont type /afk please tell me or set a link where i can find a tutorial on it
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 1,939
	Threads: 11
	Joined: Oct 2015
	
Reputation: 
0
	 
	
	
		store the health to a variable before he goes to afk and give the health using that variable on /back
	
	
	
	
		
	
 
 
	
	
	
		
	Posts: 617
	Threads: 129
	Joined: Feb 2014
	
	
 
	
	
		
Quote:
| 
					Originally Posted by Dayrion  Like this ?  
PHP код: 
new Float:afkHealth[MAX_PLAYER]
// AFK CMD | Get player health :
 GetPlayerHealth(playerid, afkHealth[playerid]);
 // Restore health
 SetPlayerHealth(playerid, afkHealth[playerid]);
 
 | 
 Ok i will be testing
	
 
	
	
	
		
	
 
 
	
	
	
		
	Posts: 617
	Threads: 129
	Joined: Feb 2014
	
	
 
	
	
		
Quote:
| 
					Originally Posted by Sreyas  that will work you can try it | 
 How Could i make it so if the player is /afk for 2-3 mins they get kick.
pawn Код:
CMD:afk(playerid,params[])
{
    if( pInfo[playerid][Spawned]    != 1)
    {
        ShowMessage(playerid, red, 9);
        return 1;
    }
    else
    {
        GetPlayerHealth(playerid, afkH[playerid]);
        TogglePlayerControllable(playerid,0);
        GetPlayerArmour(playerid, afkA[playerid]);
        SetPlayerHealth(playerid,300000);
        SetPlayerArmour(playerid,100000);
        AFK[playerid]++;
        SetTimer("AFKCheck",1000,1);
    }
    return 1;
}
CMD:back(playerid,params[])
{
    if( pInfo[playerid][Spawned]    != 1)
    {
        ShowMessage(playerid, red, 9);
        return 1;
    }
    else
    {
        TogglePlayerControllable(playerid,1);
        SetPlayerHealth(playerid, afkH[playerid]);
        SetPlayerArmour(playerid, afkA[playerid]);
        SendClientMessage(playerid,red,"Your status has been set to Playing.");
        AFK[playerid] =0;
    }
    return 1;
forward AFKCheck(playerid);
public AFKCheck(playerid)
{
    if(AFK[playerid] == 60)
    {
        AFK[playerid] = 0;
        format(astring,sizeof(astring),"Andre[BOT]: Player %s has been kicked. [Reason: Inactivity ]",GetName(playerid));
        SendClientMessageToAll(yellow,astring);
        SetTimerEx("KickPlayer",200,false,"d", playerid);
    }
}
}
 Because i attempt it but doesnt work