15.02.2018, 22:39
I know its too late already, but i removed afktime=0 from OnPlayerUpdate and updated my code to this:
Note that POS_X POS_Y and POS_Z wasnt used before, I used them just for this. And this works with only one timer.
Result:
Код:
new Float:xx,Float:xy,Float:xz;
for(new i=0; i<MAX_PLAYERS; i++)
{
GetPlayerPos(i,xx,xy,xz);
if(USER[i][POS_X]!=xx && USER[i][POS_Y]!=xy && USER[i][POS_Z]!=xz)
{
afktime[i]=0;
}
else
{
afktime[i]++;
}
USER[i][POS_X]=xx;
USER[i][POS_Y]=xy;
USER[i][POS_Z]=xz;
if(afktime[i]==150)
{
new text[128];
format(text,sizeof(text),"%s has been kicked for being afk.",GetName(i));
SendClientMessageToAll(COLOR_RED,text);
SetTimerEx("regkick",500,0,"i",i);
}
}
return 1;
Result:

