Jump to content

Problem with onPlayerLogin


Dazee

Recommended Posts

addEventHandler("onPlayerQuit",root, 
function() 
     local acc = getPlayerAccount(source) 
     if (acc) and not isGuestAccount(acc) then 
          local x,y,z = getElementPosition(source) 
          local money = getPlayerMoney(source) 
          setAccountData(acc,"PosX",x) 
          setAccountData(acc,"PosY",y) 
          setAccountData(acc,"PosZ",z) 
          setAccountData(acc,"account.money",money) 
     end 
end) 
  
function loggedIn(_,acc) 
if getAccountData(acc,"ever.logerin") == 1 then 
     local x,y,z = getAccountData(acc,"PosX"),getAccountData(acc,"PosY"),getAccountData(acc,"PosZ") 
     local Money = getAccountData(acc,"account.money") or 0 
     setPlayerMoney(source,Money) 
     spawnPlayer(source,x,y,z) 
     else 
     setAccountData(acc,"ever.logerin",1) 
     setPlayerMoney(source,15000) 
     end 
         fadeCamera(source, true) 
         setCameraTarget(source) 
    end 
addEventHandler("onPlayerLogin",root,loggedIn) 

The problem is that it does not log the player in if it's else what should I do here.

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...