Jump to content

Help with Vehicle godmode.


niemi

Recommended Posts

I need help with vehicle godmode, I found an example from the forums that makes player godmode:

function damag(attacker, weapon, bodypart) 
  
    cancelEvent() 
end 
addEventHandler("onClientPlayerDamage", getLocalPlayer(), damag) 

But i can't make it work for vehicles, I tried this:

function damag(attacker, weapon) 
  
    cancelEvent() 
end 
addEventHandler("onVehicleDamage", getRootElement(), damag) 

It doesn't work. I'm just beginning lua scripting, but i can't get that work.

Link to comment

And to explain why your code doesnt work is that canceling the vehicle damage has to be done server side, as onVehicleDamage is a server side event (and canceling it wouldn't make sense client side anyway.) You can use your code server side or use the function 50p linked to.

And btw, onVehicleDamage has only one parameter exported, loss. See http://development.mtasa.com/index.php? ... icleDamage for more about it

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