koragg Posted November 8, 2016 Share Posted November 8, 2016 I'm lazy to turn off the 'clans' and 'nfsnos' resources before starting the 'cw' one (it is needed) so I wanted to make a few functions which do this for me. The first two work fine and stop the mentioned resources and then start the 'cw' one. BUT The third and fourth functions do not work as intended and idk why. They should stop the 'cw' resource and then start the 'clans' and 'nfsnos' ones so everything is like before. I saw in console that indeed they start the 2 resources when the 'cw' one stops, but both 'nfsnos' and 'clans' stop right after 'cw' stops, this idk how to fix. function stopclans() local res = getResourceFromName ( "clans" ) if getResourceState(res) == "running" then stopResource(res) end end addEventHandler("onResourceStart", resourceRoot, stopclans) function stopnfsnos() local res = getResourceFromName ( "nfsnos" ) if getResourceState(res) == "running" then stopResource(res) end end addEventHandler("onResourceStart", resourceRoot, stopnfsnos) function startclans() local res = getResourceFromName ( "clans" ) if getResourceState(res) == "loaded" then startResource(res) end end addEventHandler("onResourceStop", resourceRoot, startclans) function startnfsnos() local res = getResourceFromName ( "nfsnos" ) if getResourceState(res) == "loaded" then startResource(res) end end addEventHandler("onResourceStop", resourceRoot, startnfsnos) 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