Rouzbeh Posted February 19, 2015 Share Posted February 19, 2015 hi, whats the best method for make all Empty vehicles damage proof until a player enter a vehicle and then that vehicle be damageable? Link to comment
manve1 Posted February 19, 2015 Share Posted February 19, 2015 Set every vehicle damage proof, then use event "onVehicleEnter" to set the car damageable. Link to comment
Deepu Posted February 19, 2015 Share Posted February 19, 2015 exactly, else you can just you know getElementsWithinInterior(0) and undamageproof it then make it damageable when he enters the car, you can do it with variables too Link to comment
Rouzbeh Posted February 19, 2015 Author Share Posted February 19, 2015 i know this but i need an Example Link to comment
AMARANT Posted February 19, 2015 Share Posted February 19, 2015 local vehicles = getElementsByType("vehicle") for _,vehicle in pairs(vehicles) do setVehicleDamageProof(vehicle,true) end function onDamageProof(vehicle,seat,jacked) setVehicleDamageProof(vehicle,false) end addEventHandler("onPlayerVehicleEnter",root,onDamageProof) Link to comment
JR10 Posted February 19, 2015 Share Posted February 19, 2015 When looping through the vehicles, you should make sure that they're empty. if (not isElement(getVehicleController(vehicle)) then -- The vehicle is empty, make it damage proof Link to comment
Rouzbeh Posted February 19, 2015 Author Share Posted February 19, 2015 yes thanks, and another question,can i make this with OnClientVehicleDamage and cancelEvent in it too? i'm making a rpg server and i want have best performance in everything so which is better? Link to comment
Addlibs Posted February 20, 2015 Share Posted February 20, 2015 When looping through the vehicles, you should make sure that they're empty. if (not isElement(getVehicleController(vehicle)) then -- The vehicle is empty, make it damage proof Actually, assuming that this is for a deathmatch server, a player could enter a vehicle as a passenger and the vehicle would still be invincible... But whatever. 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