Sasu Posted June 1, 2013 Posted June 1, 2013 It's return me "Nil". addEventHandler("onResourceStart", resourceRoot, function() local createTable = executeSQLQuery("CREATE TABLE IF NOT EXISTS level_system(account TEXT, exp INT, level INT, kills INT, dies INT)") end ) addEventHandler("onPlayerLogin", root, function(_, account) local accName = getAccountName(account) local statsTable = executeSQLQuery("SELECT kills,dies FROM level_system WHERE account=?", accName ) if ( #statsTable ~= 0 ) then setElementData(source, "Kills", statsTable["kills"]) setElementData(source, "Dies", statsTable["dies"]) outputChatBox(tostring(statsTable["dies"])) else executeSQLQuery("INSERT INTO level_system(account,kills,dies) VALUES(?,?,?)", accName, 0, 0 ) setElementData(source, "Kills", 0) setElementData(source, "Dies", 0) end end ) State: Inactive
Castillo Posted June 1, 2013 Posted June 1, 2013 That's because you forgot to add the row index, like this: statsTable [ 1 ] [ "kills" ] statsTable [ 1 ] [ "dies" ] San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Sasu Posted June 1, 2013 Author Posted June 1, 2013 That's because you forgot to add the row index, like this: statsTable [ 1 ] [ "kills" ] statsTable [ 1 ] [ "dies" ] Works. Thanks solid. State: Inactive
Castillo Posted June 1, 2013 Posted June 1, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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