Estevam2d Posted October 30, 2013 Share 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. Link to comment
Estevam2d Posted October 30, 2013 Author Share Posted October 30, 2013 I already tried to put on and do not know how. how do? Link to comment
Castillo Posted October 30, 2013 Share 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 ) Link to comment
xScatta Posted October 30, 2013 Share 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. Link to comment
Castillo Posted October 30, 2013 Share Posted October 30, 2013 "JOBpl" is not a valid resource state. Link to comment
Estevam2d Posted October 30, 2013 Author Share Posted October 30, 2013 Not started. The feature I want one so the JOBpl Link to comment
Castillo Posted October 30, 2013 Share Posted October 30, 2013 Have you tried my code? Link to comment
Estevam2d Posted October 31, 2013 Author Share 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. Link to comment
Castillo Posted October 31, 2013 Share Posted October 31, 2013 My code will restart the resource "JOBpl" if exists every minute. Link to comment
Estevam2d Posted October 31, 2013 Author Share Posted October 31, 2013 started and is running You helped guide me Very Thanks Again Link to comment
ixjf Posted October 31, 2013 Share Posted October 31, 2013 Why do you even require the resource to be restarted from time to time in the first place? Link to comment
Estevam2d Posted October 31, 2013 Author Share 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. Link to comment
TAPL Posted October 31, 2013 Share Posted October 31, 2013 How about destroy the vehicle when it exploded? onVehicleExplode destroyElement Link to comment
Estevam2d Posted October 31, 2013 Author Share Posted October 31, 2013 Very good. Thank you, you helped me a lot. It was very simple and fast. Link to comment
Estevam2d Posted October 31, 2013 Author Share Posted October 31, 2013 vehicles that are not destroyed are also disappearing Link to comment
TAPL Posted November 1, 2013 Share 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) Link to comment
isa_Khamdan Posted November 2, 2013 Share 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. Link to comment
Estevam2d Posted November 2, 2013 Author Share Posted November 2, 2013 I knew it would give lag. now fix the problem thanks to everyone who helped me 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