14.07.2015, 09:29
Hello all
I have this system to check if player is AFK(that clock symbol above his head)
If he is AFK(...) PlayerInfo[i][AFK] = 0;
When he is back PlayerInfo[i][AFK] = 1;
Why it doesn't work ?
Problem is that it doesn't shift from 0 to 1 or from 1 to 0
My timer for " UpdatePlayerStatus " is 1 second
I have this system to check if player is AFK(that clock symbol above his head)
If he is AFK(...) PlayerInfo[i][AFK] = 0;
When he is back PlayerInfo[i][AFK] = 1;
Why it doesn't work ?
Problem is that it doesn't shift from 0 to 1 or from 1 to 0
My timer for " UpdatePlayerStatus " is 1 second
PHP код:
new PlayerTick[MAX_PLAYERS];
function UpdatePlayerStatus(playerid)
{
CheckAFK();
//MY OTHER STUFF
//MY OTHER STUFF
//MY OTHER STUFF
//MY OTHER STUFF....
return 1;
}
function CheckAFK()
{
foreach(new i : Player)
{
new Tick;
Tick = GetTickCount();
if((Tick - PlayerTick[i]) > 750)
{
if(PlayerInfo[i][AFK] == 0)
{
PlayerInfo[i][AFK] = 1;
}
}
else
{
if(PlayerInfo[i][AFK] == 1)
{
PlayerInfo[i][AFK] = 0;
}
}
}
return 1;
}