viewing paste checkidle | C

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
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;
}
 
BUILDIN_DEF(checkidle,"?"),
Viewed 634 times, submitted by Streusel.