28.11.2010, 12:10
Quote:
What if somebody hasn't assigned alt? (He can ALT TAB and you won't see it)
What if somebody has asigned another key to slow walking? (He will be shown as ALT Tabber, although hes isn't) IT IS NOT WORKING! If you want to make an AFK detection, you can do it with OnPlayerUpdate, but not with checking keys. Edit: Don't use pVars! |
pawn Код:
public OnPlayerUpdate(playerid)
{
SetPVarInt(playerid, "TC", GetTickCount());
return 1;
}
public OnGameModeInit()
{
SetTimer("CheckAFK", 1500, 1);
return 1;
}
forward CheckAFK();
public CheckAFK()
{
new tc = GetTickCount();
for(new i; i < MAX_PLAYERS; i++)
{
if(tc - GetPVarInt(playerid, "TC") >= 1500)
{
//Do stuff with the AFK user here
}
}
}