overextended / ox_core

Player and vehicle management and persistence for FiveM.
https://overextended.dev/ox_core
GNU Lesser General Public License v3.0
152 stars 124 forks source link

User id is already active #137

Closed CeebDev closed 5 months ago

CeebDev commented 5 months ago

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

thelindat commented 5 months ago

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.

CeebDev commented 5 months ago

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

CeebDev commented 5 months ago

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

CeebDev commented 5 months ago

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);