Estevam2d Posted October 30, 2013 Posted October 30, 2013 function restartAllResources() local allResources = getResources() for index, res in ipairs(allResources) do if getResourceState(res) == "JOBpl" then restartResource(res) end end end addCommandHandler( "pl", restartAllResources ) how can I put a time to start and stop automatically activated without charge? I think this script is wrong.
Castillo Posted October 30, 2013 Posted October 30, 2013 Use a timer. setTimer San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Estevam2d Posted October 30, 2013 Author Posted October 30, 2013 I already tried to put on and do not know how. how do?
Castillo Posted October 30, 2013 Posted October 30, 2013 You want to restart only the resource "JOBpl"? function restartRes ( ) local res = getResourceFromName ( "JOBpl" ) if ( res ) then restartResource ( res ) end end setTimer ( restartRes, 60000, 0 ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
xScatta Posted October 30, 2013 Posted October 30, 2013 Try this: setTimer(function () local allResources = getResources() for index, res in ipairs(allResources) do if getResourceState(res) == "JOBpl" then restartResource(res) end end end,60000,0) It will restart the resources after one minute. It's fine to celebrate success but it is more important to heed the lessons of failure.
Castillo Posted October 30, 2013 Posted October 30, 2013 "JOBpl" is not a valid resource state. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Estevam2d Posted October 30, 2013 Author Posted October 30, 2013 Not started. The feature I want one so the JOBpl
Castillo Posted October 30, 2013 Posted October 30, 2013 Have you tried my code? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Estevam2d Posted October 31, 2013 Author Posted October 31, 2013 I tried your script but not updated anything in the folder. I tried the script you sent and also not worked.
Castillo Posted October 31, 2013 Posted October 31, 2013 My code will restart the resource "JOBpl" if exists every minute. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Estevam2d Posted October 31, 2013 Author Posted October 31, 2013 started and is running You helped guide me Very Thanks Again
Castillo Posted October 31, 2013 Posted October 31, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
ixjf Posted October 31, 2013 Posted October 31, 2013 Why do you even require the resource to be restarted from time to time in the first place? I used to know how to code, but then I took an arrow in the knee. Project Redivivus - Remaking Old School MTA With New Code MTA 0.6 Nightly 1 released
Estevam2d Posted October 31, 2013 Author Posted October 31, 2013 not the admin script is failing when cars explode. is why do I need a script that makes updating the admin script.
TAPL Posted October 31, 2013 Posted October 31, 2013 How about destroy the vehicle when it exploded? onVehicleExplode destroyElement
Estevam2d Posted October 31, 2013 Author Posted October 31, 2013 Very good. Thank you, you helped me a lot. It was very simple and fast.
Estevam2d Posted October 31, 2013 Author Posted October 31, 2013 vehicles that are not destroyed are also disappearing
TAPL Posted November 1, 2013 Posted November 1, 2013 You want only vehicle created from JOBpl to be destroyed? You can use getResourceRootElement. addEventHandler("onVehicleExplode", getResourceRootElement(getResourceFromName("JOBpl")), function() destroyElement(source) end)
isa_Khamdan Posted November 2, 2013 Posted November 2, 2013 Restarting resources every minute will cause lag on your server , so you better go and try to fix it instead of restarting it.
Estevam2d Posted November 2, 2013 Author Posted November 2, 2013 I knew it would give lag. now fix the problem thanks to everyone who helped me
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