altv-issues
altv-issues copied to clipboard
[Server-side] After destroy any server object OnColShape event will never be triggered
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
- Subscribe to OnColShape event
- Create any server-side object
- Create any server-side colshape (for example, sphere)
- Enter/exit to colshape zone and ensure that OnColShape works fine (check log message)
- Destroy server-side object (for example, with server command "destroy")
- 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.
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();