09.05.2015, 23:04
galera e o seguinte to tentando fazer um sistema de verificar o player de esc. pelo q andei lendo onplayerupdate decha de ser atualizado quando o player fica esc. O problema e que o status do player depois q da esc nao muda.
PHP код:
enum AFKInfo
{
AFKTimerEx,
AFKPause,
AFKPlay
};
new CheckAFKInfo[MAX_PLAYERS][AFKInfo];
public OnPlayerConnect(playerid)
{
CheckAFKInfo[playerid][AFKPlay] = 1;
CheckAFKInfo[playerid][AFKPause] = 0;
CheckAFKInfo[playerid][AFKTimerEx] = SetTimerEx("CheckPausePlayer", 500, true, "i",playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
KillTimer(CheckAFKInfo[playerid][AFKTimerEx]);
return 1;
}
public OnPlayerUpdate(playerid)
{
CheckAFKInfo[playerid][AFKPlay] = 1;
CheckAFKInfo[playerid][AFKPause] = 0;
return 1;
}
stock CheckPausePlayer(playerid)
{
CheckAFKInfo[playerid][AFKPlay]++;
if(CheckAFKInfo[playerid][AFKPlay] > 4)
{
CheckAFKInfo[playerid][AFKPause] = 1;
CheckAFKInfo[playerid][AFKPlay] = 0;
}
else
{
CheckAFKInfo[playerid][AFKPause] = 0;
CheckAFKInfo[playerid][AFKPlay] = 1;
}
return 1;
}
stock PlayerPause(playerid)
{
if(CheckAFKInfo[playerid][AFKPause] == 1 && CheckAFKInfo[playerid][AFKPlay] == 0)
{
return 1;
}
return 0;
}
stock PlayerPlay(playerid)
{
if(CheckAFKInfo[playerid][AFKPause] == 0 && CheckAFKInfo[playerid][AFKPlay] == 1)
{
return 1;
}
return 0;
}