Jump to content

set-getAccountData Help!!!


Recommended Posts

Hi Guys.

I have a problem.

Im make this but i can't save this with setElementData. When the players exit the server all the entries disappear. Help pls.

It's not give warning or error on debugscript ...

Code Removed 

Edited by Guest
Link to comment

Element data works throughout the player session, when he quits, the element no longer exists, so it's totally logical that the element's data will be lost. You need a different way to save the data. You can use SQL for this. Read more here and on the wiki.

dbQuery 
dbPoll 
dbConnect 
dbFree 
dbExec 

Link to comment

Your code is not clear, and obviously you don't even want to invest some time trying to learn, I posted a tutorial and the functions for you. Look around for codes that uses SQL, like the house_system on the community, it will give you a basic example. The wiki has examples too, try to learn from it. What you need is to have the data you want to save server-side and then use the SQL functions to save it. Try something and then post for help with the code.

Link to comment

It probably does save but the problem is you're not removing the old account data, so it's still being checked and will return true. You should use something like

setAccountData(account, 'hp', 1) 
setAccountData(account, 'hp', 2) 

And up to 6, that way you will only have the current one and will not have to worry about the old ones.

You should also use root in triggerServerEvent and client on server-side as the player, afaik there are security risks with using source.

triggerServerEvent ( "HPStats1", root) 

And server:

  
function HPLev1 () 
local playerAccount = getPlayerAccount( client ) 
... 
end 
  

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