overextended/ox_core

User id is already active

CeebDev opened this issue · 4 comments

If someone try to connect to the server and quit during the loading phase, the user seems not deleted from active users
Then if this player try to reconnect it get "This user id is already active"

You need to disable ox debug to be able to see this.
With debug, it will just create another user and ask to create a new character

https://github.com/overextended/ox_core/blob/main/server/player/loading.ts#L44-L48

You need to wait for the player to stop existing according to fxserver.

Then it's a CFX issue, because he tried to relaunch fivem, wait + 30min and still active

And when i restarted the server, he came without any issue

Modified the function the add a log :

setInterval(() => {
  for (const tempId in connectingPlayers) {
    console.log(tempId, DoesPlayerExist(tempId));
    if (!DoesPlayerExist(tempId)) delete connectingPlayers[tempId];
  }
}, 10000);

image

Then the tempId is deleted from connectingPlayers but still can't connect

image

Ok so connectingPlayers user key is deleted but class instance still exist in OxPlayer

You can try with :

setInterval(() => {
  console.debug(connectingPlayers);
  console.debug(OxPlayer.getAll());

  for (const tempId in connectingPlayers) {
    if (!DoesPlayerExist(tempId)) delete connectingPlayers[tempId];
  }
}, 10000);