Skip to content

setObjectBreakable is unreliable #483

@ArranTuna

Description

@ArranTuna

Describe the bug
Objects set as unbreakable can still be broken.

To Reproduce
Xenius said:

Example from mta wiki:

function toggleObjectVulnerability()
	local object = createObject(3036, 1479.55078125, -1761.5847167969, 13.546875)
	if isObjectBreakable(object) then
		setObjectBreakable(object, false)
		outputChatBox("The object is now not breakable.")
	else
		setObjectBreakable(object, true)
		outputChatBox("The object is now breakable.")
	end
end
addEventHandler("onClientResourceStart", resourceRoot, toggleObjectVulnerability)

If you hit this object, you can break it.

I tested with that object, punching it works as intended. Ramming it works as intended. Spawning a vehicle that lands on it causes it to break (falls through the ground, not into pieces)

To reproduce

  • crun setElementPosition(localPlayer, 1480.522, -1704.648, 14.047)
  • crun a = createObject(3036, 1476, -1710, 14) setObjectBreakable(a, false)

I noticed that adding this:

crun addEventHandler("onClientObjectBreak", a, function() outputChatBox("broken") cancelEvent() end)

And then when I make a car spawn on top of it and it falls through the ground onClientObjectBreak isn't even triggered.

Expected behavior
Object shouldn't be breakable.

MTA Client (please complete the following information):
1.5.2

MTA Server (please complete the following information):
1.5.2

Additional context
From https://bugs.mtasa.com/view.php?id=9293

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingfeedbackFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions