BriGhtx3 Posted January 27, 2012 Posted January 27, 2012 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%
drk Posted January 27, 2012 Posted January 27, 2012 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
BriGhtx3 Posted January 27, 2012 Author Posted January 27, 2012 yes Currently working on gamemodes : Reallife Script 70% Breakout Script 10%
drk Posted January 27, 2012 Posted January 27, 2012 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
Castillo Posted January 27, 2012 Posted January 27, 2012 He's talking about these objects that can be destroyed. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted January 27, 2012 Posted January 27, 2012 Destroyed by the client(player) or the server/script? EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted January 27, 2012 Posted January 27, 2012 The client. You know the glass objects, some fences, etc. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted January 27, 2012 Posted January 27, 2012 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
Evil-Cod3r Posted January 27, 2012 Posted January 27, 2012 i think like this function damage () if getElementType == "object" then cancelEvent() end addEventHandler ( "onResourceStart", getRootElement(), damage) 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)
Castillo Posted January 27, 2012 Posted January 27, 2012 No offense Evil-Cod3r, but that's a REAL mess. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted January 28, 2012 Posted January 28, 2012 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
Castillo Posted January 28, 2012 Posted January 28, 2012 The object health won't change even if you punch, fire at it. You can wait and see if this get's accepted: http://bugs.mtasa.com/view.php?id=4893 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
SDK Posted January 28, 2012 Posted January 28, 2012 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!
DarkLink Posted January 28, 2012 Posted January 28, 2012 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.. Borderpatrol Project Gamemode - Under Development (80%)
DiSaMe Posted January 28, 2012 Posted January 28, 2012 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. -
BriGhtx3 Posted January 28, 2012 Author Posted January 28, 2012 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%
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