Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. local subTag = "saw_"
  2. local importantResources = {
  3. [subTag .. "mysql"] = false,
  4. [subTag .. "core"] = true,
  5. [subTag .. "interface"] = true,
  6. }
  7. local threadTimer
  8. local threads = {}
  9. local load_speed = 1000
  10. local load_speed_multipler = 2
  11. local canConnect = false
  12.  
  13. addEventHandler("onResourceStart", resourceRoot,
  14. function()
  15.  
  16. for k, v in pairs(importantResources) do
  17. local res = getResourceFromName(k)
  18. if res then
  19. startResource(res)
  20. outputDebugString(k.. " resource elindítva! (Elsodleges resource)", 2)
  21. end
  22. end
  23.  
  24. for k,v in pairs(getResources()) do
  25. local subText = utfSub(getResourceName(v), 1, #subTag)
  26. if subText == subTag and not importantResources[getResourceName(v)] and v ~= getThisResource() then
  27. threads[v] = true
  28. end
  29. end
  30.  
  31. threadTimer = setTimer(
  32. function()
  33. local num = 0
  34.  
  35. for k,v in pairs(threads) do
  36. num = num + 1
  37.  
  38. if num > load_speed_multipler then
  39. break
  40. end
  41.  
  42. startResource(k)
  43.  
  44. threads[k] = nil
  45.  
  46. outputDebugString(getResourceName(k).. " resource elinditva!", 2)
  47. end
  48.  
  49. local length = 0
  50. for k,v in pairs(threads) do length = length + 1 end
  51. if length == 0 then
  52. killTimer(threadTimer)
  53. outputDebugString("Összes Resource Elinditva!", 3)
  54. threadTimer = nil
  55. canConnect = true
  56.  
  57. if getResourceState(getResourceFromName("san_hud")) == "running" then
  58. restartResource(getResourceFromName("san_hud"))
  59. end
  60.  
  61. end
  62. end, load_speed, 0
  63. )
  64. end
  65. )
  66.  
  67. addEventHandler("onPlayerConnect", root,
  68. function()
  69. if not canConnect then
  70. cancelEvent(true, "Rendszer \n Nem tudsz felcsatlakozni amíg a mod nem tölt be!")
  71. end
  72. end
  73. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement