Open Heryshaf opened 4 years ago
It's normal that a scriptID can change, because it is verifying to the original GTA Entity ID. It's changing when the gta entity is changing.
But shouldn't altv fire the entity creation event after it has been created for the player already? so the entity scriptID should already be the new one? no?
Sounds Like a issue in dev Branch then.
@FabianTerhorst As stated, i tried on both release and latest dev, same behavior.
Can you try with a clean server with no other resources and code. So that no other code can influence that.
@FabianTerhorst I don't have any special things being used or editing the scriptID in anyway, the same ped model of the player is used before streaming in / out (and yeah it's not the free model), i've attached a simple test code for anyone to test in less than a minute. Would be glad if anyone with any script can test it up with anyone they know. Thanks.
@Heryshaf can you interact with the player using the "wrong" scriptid? e.g. setting the position or something
@martonp96 I've already tried to use some natives that use the 'wrong' scriptid and it won't work. I've also sent you them on discord.
I have the same issue, entity.scriptID is invalid unless you use alt.setTimeout() in gameEntityCreate: When gameEntityCreate is just called: [23:32:03] gameEntityCreate (BEFORE) entity.scriptID 17410
...2 seconds later (alt.setTimeout) [23:32:05] gameEntityCreate (AFTER) entity.scriptID 17666
As you can see entity.scriptID is different (the valid scriptID is the one after 2 seconds timeout)
I have the same issue, entity.scriptID is invalid unless you use alt.setTimeout() in gameEntityCreate: When gameEntityCreate is just called: [23:32:03] gameEntityCreate (BEFORE) entity.scriptID 17410
...2 seconds later (alt.setTimeout) [23:32:05] gameEntityCreate (AFTER) entity.scriptID 17666
As you can see entity.scriptID is different (the valid scriptID is the one after 2 seconds timeout)
does it happen when you re-create an entity? i experienced similar behavior when i re-created a vehicle (destroyed old one and after that created new one)
i think delaying deletion may help in that case
// serverside
// remove entity from the game
oldVehicle.streamed = false
// create new one
const newVehicle = new alt.Vehicle(...)
alt.setTimeout(() => {
oldVehicle.destroy()
}, 3000)
probably related: https://github.com/altmp/altv-js-module/issues/289
Client/server version
build #1286, branch release, also on 2.1-dev2 Current behavior
Trying to obtain an entity's scriptID when the event is called returns an invalid scriptID.. timeouting for some time will give you the proper scriptID for the entity. perhaps the event is called pre creation of the entity in the memory of other players thus its scriptID is invalid?
Expected behavior
that it works as expected.. Steps to reproduce