Hello, I'm having a problem loading a position from a player file into the script, I saved the position as a string and now I can't load it. Here's what I have
The string goes like this:
(I know that this will spawn me really high, that's not the point)I've tried splitting it like this:
local x,y,z = fileRead(playerPos,28)
split("x,y,z", ",")
setElementPosition(player,x,y,z)
And I just keep spawning at the same place, under the ground (As if the z coord equals to 0)
Also, I would like to know, since the position length can vary, how can I tell the script to grab the exact amount of numbers that are in the string?
For example: 0.000000,0.000000,100.000000 equals to 28 characters, but if it was 10.000000,0.000000,100.000000 it would equal to 29, how could I make the script know when is the end of the string? Because if I use fileRead(playerPos,29) and it's just 28 characters, it would grab the next thing on the file, making the Z coord unusable.
Thanks