i want to add afk check to my nametag, but i dont know how  i tried this, but doesn't working  
 
	--server
 
function checkAFKPlayers() 
    for index, thePlayer in ipairs(getElementsByType("player")) do
        if (getPlayerIdleTime(thePlayer) > 300000) then
            AFKCheck = "AFK"  
            end 
    end 
end 
setTimer(checkAFKPlayers, 30000, 0)
	--client (only the two line)
 
local AFKCheck = {}
dxDrawColorText ("#00BAFF" .. getPlayerName(player) .. " (" .. AFKState .. ")", sx-w, sy - offset, sx, sy - offset, tocolor(r,g,b,textalpha), player ~= g_Me and textscale*NAMETAG_TEXTSIZE or (textscale*NAMETAG_TEXTSIZE)/1.5, srfont, "center", "bottom", false, false, false )
	how to make this working?  /sorry for my bad english:c/