ESX Legacy: remove last location option from first start

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.
image
You would replace json.encode(xPlayer.getCoords()) with something like {x:144.4,y:144.4,z:144.4,heading:144.4}

Thanks for the reply ill give it a go

Where exactly am I looking for this code, what file name etc please

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

So Original Code

function Core.SavePlayer(xPlayer, cb)
  local parameters <const> = {
    json.encode(xPlayer.getAccounts(true)),
    xPlayer.job.name,
    xPlayer.job.grade, 
    xPlayer.group,
    json.encode(xPlayer.getCoords()),
    json.encode(xPlayer.getInventory(true)), 
    json.encode(xPlayer.getLoadout(true)),
    xPlayer.identifier
  }

Replace Code

function Core.SavePlayer(xPlayer, cb)
  local parameters <const> = {
    json.encode(xPlayer.getAccounts(true)),
    xPlayer.job.name,
    xPlayer.job.grade, 
    xPlayer.group,
    {x:144.4,y:144.4,z:144.4,heading:144.4},
    json.encode(xPlayer.getInventory(true)), 
    json.encode(xPlayer.getLoadout(true)),
    xPlayer.identifier
  }

So your solution is this correct way, as you have not really given me the precise code, as I dont want to break it…

If anyone has a solution for this I would really appreciate it.

All I want is my users to spawn in the exact place (That I specify)every time they login (Please Note my original post)

As Im using Multi character for my users to sign in…

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 LEGACY script: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.