itHyperoX Posted July 7, 2017 Share Posted July 7, 2017 Why not saving dimension? function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local dim = getElementDimension ( source ) -- get the player dim setAccountData ( playeraccount, "dimension", dim ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) if ( playeraccount ) then local dim = getAccountData ( playeraccount, "dimension" ) if ( dim ) then setElementDimension ( source, dim ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 (edited) Look at this topic next time to save yourself some time.. Put an outputChatBox / outputDebugString with the value of variable "dim" inside the if statement and come back with the result. Edited July 7, 2017 by pa3ck Link to comment
itHyperoX Posted July 7, 2017 Author Share Posted July 7, 2017 (edited) i tried nothing in debug. Tried with :outputServerLog("login "..getElementDimension(source).."") always 0 Edited July 7, 2017 by TheMOG Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 Check your meta, make sure the script is referenced and is set to type "server" Link to comment
itHyperoX Posted July 7, 2017 Author Share Posted July 7, 2017 its is.. <script src="codeS.lua" type="server" /> Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 addCommandHandler("changemydim", function(p) setElementDimension(p, 15) outputServerLog("You are in dim: " .. tostring(getElementDimension(p))) end) Add this function to your server side script, use "/changemydim" and quit and see what it returns. Link to comment
itHyperoX Posted July 7, 2017 Author Share Posted July 7, 2017 with this work. What can be the problem? Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 Maybe you set the dimension client side and it's not synced with the server? Not too sure.. How do you set the player's dimension, client or server? Link to comment
pa3ck Posted July 7, 2017 Share Posted July 7, 2017 You should set interior/dimension server side only. I had problems with this in the past as well. 1 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