Jump to content

Error


Msypon

Recommended Posts

Line 21: attempt to index field '?'

addEventHandler ( 'onResourceStart', resourceRoot, 
    function ( ) 
        executeSQLCreateTable ( 'SQLData', 'money INT, serial STRING' ) 
    end 
) 
  
addCommandHandler ( 'savesql', 
    function ( player ) 
        local serial = getPlayerSerial ( player ) 
        local money = getPlayerMoney ( player ) 
        executeSQLQuery ( 'UPDATE SQLData SET money = ? WHERE serial = ?', money, serial ) 
    end 
) 
  
addCommandHandler ( 'loadsql', 
    function ( player ) 
        local serial = getPlayerSerial ( player ) 
        local result = executeSQLQuery ( 'SELECT money FROM SQLData WHERE serial = ?', serial ) 
        if ( type ( result ) == "table" and #result == 0 ) or not result then 
            return  
            setPlayerMoney ( player, result[1].money ) 
        end 
    end 
) 

Link to comment
addCommandHandler ( 'loadsql', 
    function ( player ) 
        local serial = getPlayerSerial ( player ) 
        local result = executeSQLQuery ( 'SELECT money FROM SQLData WHERE serial = ?', serial ) 
        if ( type ( result ) == "table" and #result == 0 ) or not result then 
            return 
        end 
        setPlayerMoney ( player, result[1].money ) 
    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...