Jump to content

Object


TorNix~|nR

Recommended Posts

Posted

Hello everyone, I want to know how to make the object frozen like in the editor

I'm using

createObject

is there anyway to make it frozen?

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

Posted

Hello TorNix~|nR,

could you explain the problem that you are facing? I would like to know why you need to freeze an object. Is there something wrong with how the object is interacting with game world entity collisions? By default GTA SA objects are not moving unless they are touched by other entities.

8MF74XW.pngZr2Ufps.png

Developer of Magic.TXD • Developer of MTA:Eir, Eir Lua • Company owner of EirDev

Posted (edited)

I made a gate using the object number (990) it can be broken for example by a car, I want to fix it

when I used the editor resource just to test it, I made it frozen and it worked (it can not be damaged)

Edited by TorNix~|nR

76561198387870432.png

ZI ZOMBIE INFECTION: mtasa://5.196.7.163:22003

560x95_FFFFFF_FF9900_000000_000000.png

Posted
28 minutes ago, TorNix~|nR said:

(...) it can be broken (...)

(...) I made it frozen (...)

You might be using the wrong terminology here. Did you know what "frozen" and "breakable" are two different things? I think you mean "breakable" instead of "frozen".

To set an object unbreakable, you should try using the setObjectBreakable function.

8MF74XW.pngZr2Ufps.png

Developer of Magic.TXD • Developer of MTA:Eir, Eir Lua • Company owner of EirDev

Posted
2 minutes ago, TorNix~|nR said:

is there anyway to use the setObjectBreakable function. in server-side?

The breakable-property of objects does not appear to be synchronized by the MTA server based on the Lua functions. In that case you should try manually triggering a remote clientside event handler with the object as source parameter which would set your object unbreakable on each connected client. You should do that for each connected and each connecting client.

  • Like 1

8MF74XW.pngZr2Ufps.png

Developer of Magic.TXD • Developer of MTA:Eir, Eir Lua • Company owner of EirDev

  • Moderators
Posted
2 hours ago, TorNix~|nR said:

is there anyway to use the setObjectBreakable function. in server-side?

 

You can also cancel the object-break of the current resource.

-- clientside
addEventHandler("onClientObjectBreak", resourceRoot, -- resourceRoot so that it only triggers for elements of the same resource
	function()
		cancelEvent()
		setObjectBreakable ( source, false ) -- optional
	end
)

 

Or make use of a propagation call for all elements of the whole resource:

-- clientside (important for this method here is that you create the elements on serverside without delay > not on onResourceStart)
addEventHandler("onClientResourceStart", resourceRoot, 
function () 
	setObjectBreakable ( source, false )
end, false)

 

Options enough.

 

  • Thanks 1

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

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