FlyingSpoon Posted April 4, 2015 Share Posted April 4, 2015 SERVER SIDE function getPos() local account = getPlayerAccount(source) if (account) then local x,y,z = getElementPosition( source ) setAccountData( account, "save.position", x,y,z ) end end addEventHandler("onPlayerQuit", getRootElement(), getPos) function setPos() local account = getPlayerAccount(source) if (account) then local x,y,z = getAccountData( account, "save.position") if (position) then setElementPosition ( source, x, y, z ) end end end addEventHandler("onPlayerLogin", getRootElement(), setPos) Outputs no errors! Help! Link to comment
ALw7sH Posted April 4, 2015 Share Posted April 4, 2015 function getPos() local account = getPlayerAccount(source) if (account) then local x,y,z = getElementPosition( source ) setAccountData( account, "save.position", {x,y,z} ) -- x,y,z you cant save them like that, it's like 3 arguments when the function need just 1 argument end end addEventHandler("onPlayerQuit", getRootElement(), getPos) function setPos() local account = getPlayerAccount(source) if (account) then local position = getAccountData( account, "save.position") if (position) then -- also here if position then, but position wasn't defined setElementPosition ( source, position[1], position[2], position[3] ) end end end addEventHandler("onPlayerLogin", getRootElement(), setPos) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now