altmp / altv-issues

Issues and roadmap for alt:V project
92 stars 17 forks source link

gameEntityDestroy is not triggered for local objects #2236

Closed xxshady closed 4 months ago

xxshady commented 4 months ago

Description of the problem

gameEntityDestroy is not triggered when local object is destreamed by alt:V

Reproduction steps

Use this code to reproduce it, 'destroyed [id]' will be logged when object scriptID becomes 0

image

import alt from 'alt-client'

alt.on('gameEntityCreate', (e) => {
    alt.log('gameEntityCreate', e, e.id)
    e.tick = alt.Utils.drawText3d(`${e.id}`, e.pos.add(0, 0, 0.3), 4, 0.5)

    const tick = new alt.Utils.EveryTick(() => {
        if (e.scriptID === 0) {
            alt.log('destroyed', e.id)
            tick.destroy()
            return
        }
    })
})

alt.on('gameEntityDestroy', (e) => {
    alt.log('gameEntityDestroy', e)
    e.tick?.destroy()
    e.tick = null
})

const obj = new alt.LocalObject('stt_prop_stunt_soccer_ball', new alt.Vector3(0, 1, 72), alt.Vector3.zero, true, false, true, 2)
obj.positionFrozen = true

Expected behaviour

/

Additional context

No response

Operating system

Windows 11

Version

16.0.0-dev.235

Crashdump ID

No response

Confirmation of issue's presence

xLuxy commented 4 months ago

Confirmed - same for RmlDocuments / RmlElements (children): https://github.com/altmp/altv-issues/issues/2234

Also, baseObjectCreate / baseObjectRemove module methods are not called either.

FabianTerhorst commented 4 months ago

Fixed in next dev build. (for localobjects, where this issue is about)