Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local await = coroutine.yield
- local loop = Loop()
- loop.max_runtime = 30 -- You can play a bit with these values
- loop.iteration_cooldown = 4000 -- This is the best one when you need to spam a bunch of tasks that are not that heavy!
- loop.accept_faster = true -- It runs it all as fast as it cans
- -- These tasks are very soft so this configuration will be one of the bests for it!
- local is_online = {}
- function eventPlayerDataLoaded(player, data)
- is_online[player] = true
- end
- function isOnline(player, handler)
- system.loadPlayerData(player)
- is_online[player] = false
- loop.sleep() -- waits for the next iteration
- handler(is_online[player])
- end
- function eventChatCommand(player, command)
- loop.add_task(Task(isOnline, command, function(is_online)
- tfm.exec.chatMessage(command .. " is o" .. (is_online and "n" or "ff") .. "line!")
- end))
- end
- function eventLoop()
- loop.run_tasks()
- end
Add Comment
Please, Sign In to add comment