checkidle()
hello, could someone help me with this problem that I have, I am using the checkidle command but, my problem is that I keep counting the tic even when you are dead, which keeps me counting the time to be AFK and throw them away even if they are dead Are there Any way that the command validates, if it is dead and stops counting, and when reviving the count is reset?
BUILDIN_FUNC(checkidle)
{
TBL_PC *sd = NULL;
if (script_hasdata(st, 2))
sd = map_nick2sd(script_getstr(st, 2));
else
sd = script_rid2sd(st);
if (sd)
script_pushint(st, DIFF_TICK(last_tick, sd->idletime));
else
script_pushint(st, 0);
return 0;
}