Jump to content

Return Nil SQL


Sasu

Recommended Posts

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 
) 

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