24.08.2018, 15:25
I dont know why, but my timer working too fast. I used printf to check, how it works. Timer must check every 1 second and if player is in same position, system should add AFKTIME 1 every second. When I watching samp-server.exe I see ( printfs ) that AFKTIME adding +1 not every second, but every ~0.3-0.5 sec ( very fast ).
Timer starts when player connect:
Timer starts when player connect:
Код:
SetTimerEx("UpdatePlayer", 1000, true, "d", playerid);
Код:
forward UpdatePlayer(playerid); public UpdatePlayer(playerid) { if(IsPlayerInRangeOfPoint(playerid, 2.0, PAFK[playerid][3],PAFK[playerid][4],PAFK[playerid][5])) { AFKTIME[playerid] ++,printf("AFK %i",AFKTIME[playerid]); if(AFKTIME[playerid] > 20){pInfo[playerid][afk]=1;} } else AFKTIME[playerid] = 0,pInfo[playerid][afk]=0,GetPlayerPos(playerid,PAFK[playerid][3],PAFK[playerid][4],PAFK[playerid][5]); return 1; }