Advertisement
Guest User

Untitled

a guest
May 23rd, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. -- Enable with ---[[ and disable with --[[
  2. ---[[
  3. local oldCreateThread = Citizen.CreateThread
  4. function Citizen.CreateThread(f)
  5. local trace = debug.traceback("Thread was added here", 2)
  6. local res = GetResourceName()
  7.  
  8. oldCreateThread(function()
  9. local c = coroutine.create(f)
  10. while coroutine.status ~= "dead" do
  11. local start = GetGameTimer()
  12. local res, err = coroutine.resume(c)
  13. local time = GetGameTimer()
  14.  
  15. if time > 150 then
  16. print("["..res.."] A thread took "..time.."ms, wtf u doin?")
  17. print(debug.traceback(c, "Thread yielded here"))
  18. print(trace)
  19. end
  20. if not res then
  21. print("["..res.."] A thread errored, fix it")
  22. print(debug.traceback(c, err))
  23. else
  24. coroutine.yield(res)
  25. end
  26. end
  27. end)
  28. end
  29. --]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement