daily pastebin goal
49%
SHARE
TWEET

Untitled

a guest Oct 11th, 2017 6 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local it = 0
  2. minetest.register_globalstep(function(dtime)
  3.  
  4.     it = it + dtime
  5.  
  6.     if it >= 5 then
  7.  
  8.         for _,cp in ipairs(minetest.get_connected_players()) do
  9.         local cpn = cp:get_player_name()
  10.         local controls = cp:get_player_control()
  11.  
  12.             if controls.up or controls.down or controls.left or controls.right then
  13.                 lasta[cpn] = os.time()
  14.             end
  15.  
  16.     local tdtostr = tonumber(lasta[cpn])
  17.     local idlediff = os.time()-tdtostr
  18.  
  19.     if idlediff < 10 then
  20.         local nit = (io.open(minetest.get_worldpath().."/idle/"..cpn..".txt", "w"))
  21.         nit:write(os.time())
  22.         nit:close()
  23.         lasta[cpn] = 0
  24.     end
  25.  
  26.         end --- LOOP END
  27.  
  28.     it = 0
  29.     end
  30. end)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top