villr Posted July 27, 2011 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? Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
villr Posted July 28, 2011 Author Posted July 28, 2011 anyone that could help me? Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
Jaysds1 Posted July 28, 2011 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 My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
villr Posted July 28, 2011 Author 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? Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
bandi94 Posted July 28, 2011 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) Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
Castillo Posted July 28, 2011 Posted July 28, 2011 addEventHandler("onResourceStart",resourceRoot, function() for k, vehicle in ipairs ( getElementsByType ( "vehicle" ) ) do toggleVehicleRespawn( vehicle, true ) setVehicleIdleRespawnDelay( vehicle, 2000 ) end end) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
villr Posted July 29, 2011 Author 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 Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
Jaysds1 Posted July 29, 2011 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. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
MTA Team qaisjp Posted July 30, 2011 MTA Team 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
bandi94 Posted July 30, 2011 Posted July 30, 2011 if isPedInVehicle(player) then ---- check if player is in vehicle or not ... Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
villr Posted July 30, 2011 Author 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.. Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
villr Posted July 30, 2011 Author 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. Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
bandi94 Posted July 30, 2011 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) Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
villr Posted July 30, 2011 Author Posted July 30, 2011 i want it come back where it spawned. Happy Owner/Leader of SELS:RPG | Cops and Gangsters | TRUE CRIME CITY with a lot of JOBS! Scripted since summer 2010
bandi94 Posted July 30, 2011 Posted July 30, 2011 then put your spawn x,y,z Ingame Name : |DGT|Puma DGT Clan Server 24/7 Owner/Scripter MultiGameMode in progress :
AG Adam Posted August 2, 2011 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) Scripting for free and for money
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