Satko Posted December 25, 2022 Share Posted December 25, 2022 local subTag = "o" local importantResources = {subTag .. ""} local excludeResources = { [subTag .. ""] = true, } local threadTimer local threads = {} local load_speed = 1000 -- Hány másodpercenként töltsön be load_speed_multipler számú resourceot local load_speed_multipler = 2 -- Hány resource-t töltsön be load_speed időnként local canConnect = false addEventHandler("onResourceStart", resourceRoot, function() for v, k in ipairs(importantResources) do local res = getResourceFromName(k) if res then startResource(res) outputDebugString(k.. " resource has started! (Important resource)", 2) end end for k,v in pairs(getResources()) do local subText = utfSub(getResourceName(v), 1, #subTag) if subText == subTag and not excludeResources[getResourceName(v)] and v ~= getThisResource() then threads[v] = true end end threadTimer = setTimer( function() local num = 0 for k,v in pairs(threads) do num = num + 1 if num > load_speed_multipler then break end startResource(k) threads[k] = nil outputDebugString(getResourceName(k).. " resource has started!", 2) end local length = 0 for k,v in pairs(threads) do length = length + 1 end if length == 0 then killTimer(threadTimer) outputDebugString("All resource started!", 3) threadTimer = nil canConnect = true end end, load_speed, 0 ) end ) addEventHandler("onPlayerConnect", root, function() if not canConnect then cancelEvent(true, "Sistem Ne možete se povezati dok se resursi ne učitaju!") end end ) What is wrong here? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now