Jump to content

Not saving dimension


Recommended Posts

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

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 by pa3ck
Link to comment
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...