Jump to content

setOBJECTDamageProof


BriGhtx3

Recommended Posts

addEventHandler('onPlayerTarget',root, 
  function(theTarget) 
       local health = getElementHealth(theTarget) 
        if (getElementType(theTarget) == "object") then 
          setElementHealth(theTarget, health+1000) 
     end 
end) 

I don't know if it's right, i've not tested it yet..

Link to comment

There's no real function for it yet, but there's an note here:

https://wiki.multitheftauto.com/wiki/SetObjectStatic (replaced with setElementFrozen)

Note2: Dynamic objects with a "destroyed" state are still destroyable. Use isElementOnScreen to detect, destroy, and recreate these objects.

So you could use onClientRender and isElementOnScreen to recreate the broken objects. As an extra you could run a timer which recreates every object every 5 seconds, depending on how important the objects are.

Link to comment

I made it using onClientRender event, and then checking if object is there or no using isLineOfSightClear, and if it returns true, I destroy that element and build it again :)

Do you understand ?

Its not damageproof.. but it gets rebuilded right on the time it gets destroyed, u dont even notice..

Link to comment

You can also try disabling object collisions, creating another object which has a similar shape and cannot be destroyed, and making it invisible (put it into another interior or use setElementAlpha). If I remember correctly, objects with disabled collisions cannot be destroyed even with explosions.

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