Jump to content

setOBJECTDamageProof


BriGhtx3

Recommended Posts

Posted

How can I set an object damage proof or that it doesn't lose health?

Do I have to use onClientRender and setElementHealth?

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%
Posted

I don't understand what you want. You want to set damaged proof in a object?

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

Objects don't lose health ;) Only players and vehicles. For players you can use setElementHealth to set a specified health, for vehicles you can use setVehicleDamageProof or setElementHealth too.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

He's talking about these objects that can be destroyed.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

The client.

You know the glass objects, some fences, etc.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Ah. I don't know if it's possible to set these objects damage proof. But in SA:MP if I set the vehicle health to more than 1000% It will be infinite health. Maybe its possible in MTA:SA...

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

i think like this

function damage () 
    if getElementType == "object" then 
    cancelEvent() 
end 
addEventHandler ( "onResourceStart", getRootElement(), damage) 

:roll:

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

No offense Evil-Cod3r, but that's a REAL mess.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

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.

Learn Lua - Learn to script - GUI scripting

Scripter tools - Find/fix errors yourself(!)

Don't pm me for scripting help, keep it for the Scripting subforum!

Posted

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.

-

Posted

Wow. Thank you guys ;)

I hope this functions get accepted, this would be real awesome.

Ill try to use onClientRender, and isElementOnScreen (or isLineOfSighClear)

Currently working on gamemodes :

  • Reallife Script 70%
  • Breakout Script 10%

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