BrianDUTCH Posted September 11, 2014 Posted September 11, 2014 (edited) Hello all , I can't figure out how to respawn the vehicle when it is drowned.. I added respawn vehicle if it has been idle for 5 minutes, and after blow up it respawns.. But I need help to make the vehicle respawn when it drown.. Hope u guys can help me ! Edited September 12, 2014 by Guest
Jusonex Posted September 11, 2014 Posted September 11, 2014 Since there is no suitable event, the only way you can do it is calling https://wiki.multitheftauto.com/wiki/IsElementInWater within short intervalls.
BrianDUTCH Posted September 11, 2014 Author Posted September 11, 2014 Since there is no suitable event, the only way you can do it is calling https://wiki.multitheftauto.com/wiki/IsElementInWater within short intervalls. I tried to do this but it didn't work.. maybe I don't know the code.. I am newbie in lua
BrianDUTCH Posted September 11, 2014 Author Posted September 11, 2014 (edited) Show your scripts/code. script removed Edited September 12, 2014 by Guest
BrianDUTCH Posted September 11, 2014 Author Posted September 11, 2014 (edited) solved. Edited September 12, 2014 by Guest
BrianDUTCH Posted September 12, 2014 Author Posted September 12, 2014 As u see the code above it works fine it respawn when it drown, but it also respawn when a player is inside the car how can I stop that? If players are in the car I don't want it respawn only when nobody is in the car !
Moderators IIYAMA Posted September 12, 2014 Moderators Posted September 12, 2014 if isElementInWater ( vehicle ) and not next(getVehicleOccupants (vehicle)) then Vervang deze regel. (regel 4)
BrianDUTCH Posted September 12, 2014 Author Posted September 12, 2014 if isElementInWater ( vehicle ) and not next(getVehicleOccupants (vehicle)) then Vervang deze regel. (regel 4) Thanks ! werkt bedankt
BrianDUTCH Posted September 12, 2014 Author Posted September 12, 2014 (edited) I have a another problem, I made the value's of respawn time in settings. But when I change the time in-game settings to 1 second then it doesn't work it still respawn every 15 seconds. please help ! Meta.xml removed removed Please help ! EDIT: SOLVED Edited September 12, 2014 by Guest
Moderators IIYAMA Posted September 12, 2014 Moderators Posted September 12, 2014 local blow = tonumber(get("blowTime")) or 15000 local idle = tonumber(get("idleTime")) or 300000 local water = tonumber(get("waterTime")) or 40000 That is because you only gets strings as returns. So if you fill in 15000 in the previously code. This is the value you get. local blow = "15000" But this is what you want. local blow = 15000 So you convert them to a number with the tonumber() function. and if you fill in something which isn't a number at all, it will do: or 15000 so will be reset a default. In debugscript 3 you would have seen this error. Command: /debugscript 3 and about this, this can crash your server: (infinity timers) function respawnExplodedVehicle() setTimer( respawnExplodedVehicle, blow, 1, otherElements ) end addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle) Just simply use the wiki example: https://wiki.multitheftauto.com/wiki/RespawnVehicle
BrianDUTCH Posted September 12, 2014 Author Posted September 12, 2014 Thanks for help IIYAMA, it works good. I use the simple respawnVehicle now thanks.
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