altv-issues
altv-issues copied to clipboard
Ped newOwner natives problem
Description of the problem
I encounter this strange issues when applying some natives on a Ped, using its netOwner. The problem is that the natives don't always apply to the Ped, without using a timeout. When using a timeout for 5 seconds, the natives apply correctly. The scriptID also is correct with / without the timeout.
Reproduction steps
alt.onServer("testEvent", (animalPed: alt.Ped) => {
alt.log(animalPed.scriptID);
native.setEntityAsMissionEntity(animalPed.scriptID, true, false);
native.freezeEntityPosition(animalPed.scriptID, false);
native.setPedCanRagdoll(animalPed.scriptID, false);
native.taskSetBlockingOfNonTemporaryEvents(animalPed.scriptID, true);
native.setBlockingOfNonTemporaryEvents(animalPed.scriptID, true);
native.setPedFleeAttributes(animalPed.scriptID, 0, false);
native.setPedCombatAttributes(animalPed.scriptID, 17, true);
native.setEntityInvincible(animalPed.scriptID, false);
native.setPedSeeingRange(animalPed.scriptID, 0);
native.taskStartScenarioInPlace(animalPed.scriptID, 'WORLD_DEER_GRAZING', -1, true);
});
alt.on('netOwnerChange', (animalPed: alt.Entity, pedOwner: alt.Player | null, oldPedOwner: alt.Player | null) => {
pedOwner.emitRaw('testEvent', animalPed);
});
Expected behaviour
The natives should work without applying a timeout.
Additional context
https://discord.com/channels/371265202378899476/1208762717754753074
Operating system
Windows
Version
release & latest dev (16.0.0-dev.247)
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.