villr Posted July 27, 2011 Share Posted July 27, 2011 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? Link to comment
villr Posted July 28, 2011 Author Share Posted July 28, 2011 anyone that could help me? Link to comment
Jaysds1 Posted July 28, 2011 Share Posted July 28, 2011 (edited) 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 July 28, 2011 by Guest Link to comment
villr Posted July 28, 2011 Author Share Posted July 28, 2011 i dont want to blow all cars just the cars that its no peoples in.. and isent there anyway to make it go back without exploding it? Link to comment
bandi94 Posted July 28, 2011 Share Posted July 28, 2011 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
Castillo Posted July 28, 2011 Share Posted July 28, 2011 addEventHandler("onResourceStart",resourceRoot, function() for k, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do toggleVehicleRespawn( vehicle, true ) setVehicleIdleRespawnDelay( vehicle, 2000 ) end end) Link to comment
villr Posted July 29, 2011 Author Share Posted July 29, 2011 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
Jaysds1 Posted July 29, 2011 Share Posted July 29, 2011 i know that they blow up the cars and set the respawn delay to 1 or 10secs... but I don't know how to check if a player is in a vehicle, so they don't die. Link to comment
qaisjp Posted July 30, 2011 Share Posted July 30, 2011 Edit castillo's code, see the setVehicleIdleRespawnDelay, it is set to 2 seconds (2000ms = 2secs), you edit it yourself and try doing it Link to comment
bandi94 Posted July 30, 2011 Share Posted July 30, 2011 if isPedInVehicle(player) then ---- check if player is in vehicle or not ... Link to comment
villr Posted July 30, 2011 Author Share Posted July 30, 2011 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
villr Posted July 30, 2011 Author Share Posted July 30, 2011 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
bandi94 Posted July 30, 2011 Share Posted July 30, 2011 you write x,y,z where you wana to put the car if is idle or use random to don't put 2 cars on same place ex. setElementPosition(vehicle,1600,-2000,5) Link to comment
villr Posted July 30, 2011 Author Share Posted July 30, 2011 i want it come back where it spawned. Link to comment
AG Adam Posted August 2, 2011 Share Posted August 2, 2011 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
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