Jump to content

help save scores


Recommended Posts

Hello, I am trying to create a script to do that to save scores but do not know much mess with MYSQL could help me?

Code:

function onPlayerQuit() 
      local playerAccount = getPlayerAccount(source) 
      if (playerAccount) then 
            local playerScores = getElementData(source) 
            setAccountData(playerAccount, "kills", playerScores) 
      end 
end 
addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) 
  
function onPlayerLogin() 
      local playerAccount = getPlayerAccount(source) 
      if (playerAccount) then 
            local playerScores = getAccountData(playerAccount, "kills") 
            if (playerScores) then 
                  setElementData(source, playerScores) 
            end 
      end 
end 
addEventHandler("onPlayerLogin", getRootElement(), onPlayerLogin) -- add an event handler 

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