Driving me crazy:
So I have esx legacy: and after selecting my character, it spawns me to last location.
2 Questions Really
1 how to change or completely remove last location
2. Set a specific spawn point each time (Not for new) as I know how to change location for a new Char
Help is appreciated, yes i searched but couldn’t find a solution to my mentioned needs.
Don’t attempt to remove last location logic. You need to listen for esx spawning the player and putting them in their last position, then after that happens you move them where you want them to spawn. Looking at the Github code for latest ESX Legacy, you should be able to simply wait for ESX.IsPlayerLoaded() to return true, and then put them where you wish.
Or, uhhhm maybe easier for you, you can adjust the saving of player data to just force your desired spawn location as the “last location” when the player exits the server. So on player drop or server shutdown, you force the last location to the spawn point you want.
You would replace json.encode(xPlayer.getCoords()) with something like {x:144.4,y:144.4,z:144.4,heading:144.4}
ES_Extended/server folder, I believe that is in the functions.lua
Your text editor should contain a “Find in all files” or “Open this folder in…” depending on what editor you use, and you can search the entire resource for .getCoords() to find the exact line
Fixed, I hope other people find this of some use.
I managed to sort this by experimenting and looking around & having a read.
So the steps I use are as follows.
1. Go to \es_extended>server>main.lua
2. in main.lua Go to roughly line 244 and look for
– Position
userData.coords = json.decode(result.position) or Config.DefaultSpawn
3. Replace with this:
– Position userData.coords = { x = 3063.97, y = 5608.88, z = 209.245 } or Config.DefaultSpawn
So Now you can use any coordinates you like by changing these > { x = 3063.97, y = 5608.88, z = 209.245 }<
Now every time your users login, even with multi Char, it will spawn them to these coords) This is for ESX LEGACYscript:es_extended] [INFO] ESX Legacy 1.9.3
Anyway i hope this has helped others.
BTW I am using Multi Character (illenium-appearance) Highly recommended it works perfectly.
I would like to thank the person who took the time to respond to my post… As it helped a lot.