/Save /Load position

Hello Guys,

I’m trying to create a simple system to save and load the last position from the player, saving information on MySql and loading from there (So that if you restart the server you can load the position saved).

I’ve already performed it to save correctly on the following format:
967.11120605468,2228.416015625,54.059741973876
(X,Y,Z)

But when I try to load this position and set it on the command SetEntityCoords it just doesn’t work properly, it can print correctly the cords but can’t set the position.

TriggerEvent(“chatMessage”, “[linha]:” … linha)
It shows the last position loaded from the MySql:
1

SetEntityCoords(GetPlayerPed(-1),linha,1,0,0,1)
Nothing happens :frowning:

Regards,

Why do you save coordinates (which are numbers) as a string ? Anyway, if you still want to save it as a string you should use json.encode and json.decode to format your string correctly.

Also, you need to convert the string back after grabbing it from the database, that’s why it is not working.

1 Like

Thank you for the explanation Elio :slight_smile: