#6

PHP код:
new IdleAfkTime[MAX_PLAYERS];
new 
Float:pLastpos[MAX_PLAYERS][2];
new 
afktimer[MAX_PLAYERS];
new 
playername[MAX_PLAYER_NAME];
public 
OnPlayerConnect(playerid)
{
    
IdleAfkTime[playerid] = 300;//Afk after 5 minutes
    
afktimer[playerid] = SetTimerEx("IdleAfk"10001"i"playerid);
    return 
1;
}
forward IdleAfk(playerid);
public 
IdleAfk(playerid)
{
        new 
Float:xFloat:yFloat:zstringsdata[20];
        if (
IsPlayerConnected(playerid))
        {
            
GetPlayerPos(playeridxyz);
            if ((
== pLastpos[playerid][0] && == pLastpos[playerid][1]) || ((!= pLastpos[playerid][0] || != pLastpos[playerid][1]) && GetPlayerState(playerid) != PLAYER_STATE_PASSENGER))
            {
                
IdleAfkTime[playerid] --;
                if (
IdleAfkTime[playerid] == 0)
                {
                            
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
                            
format(stringsdata,sizeof(stringsdata), "* %s is AFK."playername);
                            
SendClientMessageToAll(COLOR_YELLOWstringsdata);
                            
TogglePlayerControllable(playerid0);
                }
            }
        }
}
CMD:back(playeridparams[])
{
    
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    
format(stringsdata,sizeof(stringsdata), "* %s is Back."playername);
    
SendClientMessageToAll(COLOR_YELLOWstringsdata);
    
TogglePlayerControllable(playerid1);
    return ;

Reply


Messages In This Thread
Idea - by Shaheen - 20.11.2016, 19:14
Re: Idea - by sampkinq - 20.11.2016, 19:27
Re: Idea - by Kaliber - 20.11.2016, 19:34
Re: Idea - by TwinkiDaBoss - 20.11.2016, 21:11
Re: Idea - by iamjems - 21.11.2016, 09:06
Re: Idea - by IceBilizard - 21.11.2016, 09:17
Re: Idea - by Shaheen - 26.11.2016, 19:05

Forum Jump:


Users browsing this thread: 2 Guest(s)