esx-framework / esx_core

Official Repo For core resources for esx-legacy
https://documentation.esx-framework.org/
GNU General Public License v3.0
368 stars 733 forks source link

[Bug] - es_extended- Default Spawn Random Coords problem #1345

Closed DARKAOFF closed 4 months ago

DARKAOFF commented 5 months ago

Esx/fivem last version

Es_extended

the default spawn configuration of players at creation does not work badly several positions configure, the players all spawn in the same place

Thekuca commented 5 months ago

Send me your config.lua in es_extended and also check if you have a default value set on position in table users in database

DARKAOFF commented 5 months ago

config.txt

DARKAOFF commented 5 months ago

userData.coords = json.decode(result.position) or Config.DefaultSpawns[math.random(1, #Config.DefaultSpawns)]

with our correction it works now but there remains a problem, as this is random it is possible that a player spawns in the same place as another

Gellipapa commented 5 months ago

userData.coords = json.decode(result.position) or Config.DefaultSpawns[math.random(1, #Config.DefaultSpawns)]

with our correction it works now but there remains a problem, as this is random it is possible that a player spawns in the same place as another

Hi! Exactly because it can happen randomly that the two numbers are entered twice, such a solution is not integrated in es_extended to always have a different number.

However, you should check your user table in the database to see if position is not set by default because if it is, it won't use this random coordinate logic.

DARKAOFF commented 5 months ago

image

no I have nothing in the users table

Gellipapa commented 5 months ago

@DARKAOFF Hi! Do you always spawn there or is there a case where you spawn somewhere else?

Because if you have few coordinates you might get the same coordinate every time during testing, it's not guaranteed that math.random will be random in the current implementation, so it might be the same coordinate twice or three times or x times depending on the length of the table.

It might be worth trying with 8-10 coordinates to see what happens.

Gellipapa commented 4 months ago

Hi! @DARKAOFF The fix will be available soon on the main branch. Thanks for your patience.