mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add ability to detach object from Object ID: 1382

Open RidwanRF opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe.

So If i createObject with ID: 1382 which there is a working magnet in it, when It hits object or vehicle it automatically attaches to it. But there is no way to detach it than destroy element itself

Describe the solution you'd like

add ability to detect with isElementAttached or getElementAttachedTo and able to detachElements

Describe alternatives you've considered

No response

Additional context

Related issue: #2488

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

RidwanRF avatar Jun 08 '22 16:06 RidwanRF

You can detach it by setting it's position using setElementPosition. On testing changing its Z value to z-10 or similar won't detach it. Setting its position far away does. You could set the vehicle position far away and then bring it back:


function detachVehicleFromCrane(veh)
    local x, y, z = getElementPosition(veh)
    setElementPosition(veh, 10000, 10000, 10000)
    setTimer(setElementPosition, 500, 1, veh, x, y, z-5)
end

Tested and works just fine.

This object can't be created serverside btw.

PlatinMTA avatar Jun 08 '22 21:06 PlatinMTA