Jump to content

[SOLVED] Vehicle respawn when drowned.


BrianDUTCH

Recommended Posts

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 ! :wink:

Edited by Guest
Link to comment

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 by Guest
Link to comment
  • Moderators
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

Link to comment

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...