Jump to content

idle cars?


villr

Recommended Posts

this will look nooby beacuse im a noob in scripting but how can i make so a car that nodoy have been in for maybe 20 seconds?

how do i make it respawn?

or else if i can get help so i can do with a command so the idle cars get back?

any tips helps codes? :D

Link to comment
addEventHandler("onResourceStart",getRootElement(), 
function() 
    local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table 
        for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... 
            resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time 
            setTimer(function() blowVehicle(vehicle ) end,30000,0) 
        end 
end) 

Edited by Guest
Link to comment
  
addEventHandler("onResourceStart",getRootElement(), 
function() 
local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table 
for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... 
resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time 
setTimer(function() setElementPosition(vehicle,x,y,z)  end,30000,0) 
end 
end) 

Link to comment
addEventHandler("onResourceStart",resourceRoot, 
function() 
    for k, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do 
        toggleVehicleRespawn( vehicle, true ) 
        setVehicleIdleRespawnDelay( vehicle, 2000 ) 
    end 
end) 

Link to comment

have anybody played saes?

they got something so they can make all cars that nobody are in to respawn somehow without blow them i think.

somebody out there that knows how?

castillos script was best but noth enough beacuse u needed to go away veeery long for making it respawn.

i really need this script beacuse we are recreating a big stunt server from samp and we got so many players and they need cars ;)

Link to comment
Edit castillo's code, see the setVehicleIdleRespawnDelay, it is set to 2 seconds (2000ms = 2secs), you edit it yourself and try doing it ;)

the problem is that you need to get so long away from the car and then it have respawn..

Link to comment
  
addEventHandler("onResourceStart",getRootElement(), 
function() 
local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table 
for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following... 
resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time 
setTimer(function() setElementPosition(vehicle,x,y,z)  end,30000,0) 
end 
end) 

your code dident work

it dont have any posiston of the car so it cant set it back.

Link to comment

addEventHandler("onResourceStart",getRootElement(),

function()

local vehicles = getElementsByType ( "vehicle" ) -- Return all the vehicles in a table

for k, vehicle in ipairs ( vehicles ) do -- For every vehicle do the following...

resetVehicleIdleTime ( vehicle ) -- Reset the vehicle's idle time

setTimer(function() respawnVehicle(vehicle) end,30000,0)

end

end)

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