Jump to content

[HELP] Best Method for making all vehicles damage proof


Rouzbeh

Recommended Posts

Posted

exactly, else you can just you know getElementsWithinInterior(0) and undamageproof it :D then make it damageable when he enters the car, you can do it with variables too ;)

Posted
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) 

Posted

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 

Posted

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?

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

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