altv-issues icon indicating copy to clipboard operation
altv-issues copied to clipboard

[Server-side] After destroy any server object OnColShape event will never be triggered

Open M1raclee opened this issue 1 year ago • 1 comments

Description of the problem

When you have colshape and object on server-side and destroy object -> OnColShape event breaks and not triggers ever

Code:

        Alt.OnColShape += (colshape, targetEntity, state) =>
        {
            Alt.Log($"Colshape: {colshape.Id}, {targetEntity.Id}, {state}");
        };
        Alt.OnConsoleCommand += (name, args) =>
        {
            if (name == "destroy")
            {
                _obj?.Destroy();
                Alt.Log("Obj destroyed");
            }
        };
        
        _obj = Alt.CreateObject(Alt.Hash("v_ret_ta_box"), new Position(10, 10, 74.5f), new Rotation(0, 0, 0));
        Alt.CreateColShapeSphere(new Position(10, 10, 75), 5);

Reproduction steps

  1. Subscribe to OnColShape event
  2. Create any server-side object
  3. Create any server-side colshape (for example, sphere)
  4. Enter/exit to colshape zone and ensure that OnColShape works fine (check log message)
  5. Destroy server-side object (for example, with server command "destroy")
  6. Enter to colshape again => OnColShape will be not triggered, you won't see log message

Expected behaviour

OnColShape works fine after destroy server-side objects

Additional context

It was working fine a couple weeks ago, but now it's broken. Tested with C# module

Operating system

Windows 10

Version

client/server: 16.0.0-dev.289, NuGet: 16.0.0-dev.30

Crashdump ID

No response

Confirmation of issue's presence

  • [X] By submitting this ticket, I affirm that I have verified the presence of this issue on the latest developer version available at the time of writing this ticket.

M1raclee avatar Mar 02 '24 12:03 M1raclee

Reproduced with this code on the latest 16.0.0-dev.290 (dev)

alt.on("entityEnterColshape", (colshape, entity) => {
    console.log('enter: ', entity, colshape);
})

globalThis.col = new alt.ColshapeSphere(player.pos.x, player.pos.y, player.pos.z, 20);

globalThis.obj = new alt.Object('v_ret_ta_box', player.pos, player.rot);

globalThis.obj.destroy();

litolax avatar Mar 04 '24 10:03 litolax