Example program:christoferlevich wrote:I want a timer to start when a player enters an area/room, ..
and I want it to count time until the player exits
Code: Select all
if not t then t=0 say("Timer started") end players = find_player(3); if players then if t==0 then td=os.date("%Y-%m-%d %H:%M:%S\n") end t = t+1 n = #players p = table.concat(players," and ") msg = td..t..") players here: "..p say(msg) td="" else t=0 -- reset timer after players moved away end
start counting and list players within range.
Reset timer if nobody is in range.