Jump to content

[HELP]Update Account


SavosAren

Recommended Posts

Hello! I'm working with SQL Instructions, with SQLLite registry.db

I Wanna make a money update, but its not work! :(:(:(:(

Look This:

  
function DinDinBanco(playerSource, command) 
local dindin = 5000 
  
local result = executeSQLQuery("UPDATE users SET usermoney = 'usermoney + dindin' WHERE username=?" , playerSource) 
        if(#result == 1) then 
            givePlayerMoney ( playerSource, dindin )     
            outputChatBox("You Got 5000") 
        else 
            outputChatBox("Error") 
        end 
end 
  
addCommandHandler("din", DinDinBanco) 
  
  

Thanks!

Link to comment
executeSQLQuery("CREATE TABLE IF NOT EXISTS users (usermoney INT, username TEXT)") 
  
function DinDinBanco(playerSource, command) 
    local dindin = 5000 
    local account = getPlayerAccount(playerSource) 
    if (account) and not (isGuestAccount(account)) then 
        local accountName = getAccountName(account) 
        local money = getPlayerMoney(playerSource) 
        local data = executeSQLQuery("SELECT * FROM users WHERE username=?", accountName) 
        if not (data) then 
            executeSQLQuery("INSERT INTO users (usermoney, username) VALUES(?, ?)", money, accountName) 
        end 
        if (executeSQLQuery("UPDATE users SET usermoney = ? WHERE username=?" , money+dindin, accountName)) then 
            givePlayerMoney ( playerSource, dindin )    
            outputChatBox("You Got 5000") 
        else 
            outputChatBox("Erro Porra") 
        end 
    else 
        outputChatBox("You need to be log-In") 
    end 
end 
addCommandHandler("din", DinDinBanco) 

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