Jump to content

Solved..


1LoL1

Recommended Posts

Posted (edited)

Hello, i created script but idk how to respawnVehicle if is in water. :( Can anyone help me please?

i tried this but not work :(

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), 
function ()  
car = createVehicle(id, x, y, z, rx, ry, rz) 
end) 
  
function RSP () 
if isElementInWater(car) then 
setTimer(respawnVehicle(car), 1000, 1) 
    end 
end 
  

This work normally.

addEventHandler("onVehicleExplode", getRootElement(), 
function () 
    setTimer(respawnVehicle, 5000, 1, source) 
end) 

Edited by Guest
Posted

change your timer to;

setTimer ( RSP, 5000, 1, source ) 

after that you might have to change the RSP() to RSP ( car ) since the car will most likely not stay global ( once it exploded, the element will not be the same anymore ).

Posted
change your timer to;
setTimer ( RSP, 5000, 1, source ) 

after that you might have to change the RSP() to RSP ( car ) since the car will most likely not stay global ( once it exploded, the element will not be the same anymore ).

Don't understand if i put this then where is respawnVehicle?

Posted
addEventHandler("onVehicleExplode", root, 
   function(theVehicle) 
       if isElementInWater(theVehicle) then 
           setTimer(respawnVehicle, 5000, 1, theVehicle) 
       end 
       setTimer(respawnVehicle, 5000, 1, source) 
    end 
) 

Posted

the "respawnVehicle" is inside the RSP function, all you need to do is pass the "source" ( the exploded vehicle ) as a parameter into that function and respawn it. The thing which Dominos7 said will not work since onVehicleExplode is not returning any parameters. Why do you want to check the waterstate though?

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...