afk check doesnt work
#6

1. You already set playerid param why would you loop again through all players?
2. You must get the player position for the first time at spawn

PHP код:
public OnPlayerSpawn(playerid)
{
    
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]); 
    return 
1;
}
forward AFKCheck(playerid); 
public 
AFKCheck(playerid) 
{ 
  new 
Float:Pos[3];  
     if(
IsPlayerInRangeOfPoint(playerid,2,Pos[0],Pos[1],Pos[2]))  
     { 
        
AFK[playerid]++;  
     } 
     else 
GetPlayerPos(playerid,Pos[0],Pos[1],Pos[2]); 
     if(
AFK[playerid] == 60) 
     { 
        
AFK[playerid] = 0; 
        
Lounge[playerid] = true; 
        
SetPlayerPos(playerid, -794.806396,497.738037,1376.195312); 
        
SetPlayerInterior(playerid, 1); 
        
SetPlayerVirtualWorld(playerid,10); 
        
IsPlayerInLobby[playerid] = 1; 
        
SetPlayerHealth(playerid, 99999); 
        
ResetPlayerWeapons(playerid); 
        new 
string[250]; 
        
format(string, sizeof(string), "_AFK_%s", PlayerName[playerid]); 
        
SetPlayerName(playerid, string); 
        
SetPlayerColor(playerid, COLOR_GREY); 
      }  
  return 
1; 
} 
Reply


Messages In This Thread
afk check doesnt work - by severance - 02.09.2018, 22:20
Re: afk check doesnt work - by solstice_ - 02.09.2018, 22:32
Re: afk check doesnt work - by severance - 02.09.2018, 22:39
Re: afk check doesnt work - by RogueDrifter - 02.09.2018, 23:16
Re: afk check doesnt work - by severance - 02.09.2018, 23:21
Re: afk check doesnt work - by Shinja - 02.09.2018, 23:47

Forum Jump:


Users browsing this thread: 1 Guest(s)