Jump to content

[fixed]server.lua:71: attempt to concatenate a boolean value


BumbiS*

Recommended Posts

Hey, users. I have a problem here, its about login with mysql. It shows a error and i cant fix it, thats why i'm asking for help. So here's the code

  
function loginHandler(parole) 
    if parole then 
        if (client) then 
            local res = mysql_query(sqlConnection,"SELECT * FROM users WHERE Name='"..getPlayerName(source).."' AND Pass='"..parole.."'") 
            if res then 
                if(mysql_num_rows(res)>0) then 
                    while true do 
                        local row = mysql_fetch_assoc(res) 
                        if(not row) then break end 
                        spawn(client) 
                        setPlayerMoney(client,row["Money"]) 
                        setElementModel(client,row["Skin"]) 
                    end 
                    mysql_free_result(res) 
                else 
                    outputChatBox("Nepareiza parole!",source) 
                    triggerClientEvent("ShowLoginGUI",client) 
                end 
            end 
        end 
    else 
        outputChatBox("Ievadiet paroli.",client) 
        triggerClientEvent("ShowLoginGUI",client) 
    end          
end 
  

And the error

Error: server.lua:71: attempt to concatenate a boolean value 

this is the error line

local res = mysql_query(sqlConnection,"SELECT * FROM users WHERE Name='"..getPlayerName(source).."' AND Pass='"..parole.."'") 

Edited by Guest
Link to comment

GUI is triggering it from client side.

function clientSubmitLogin(button,state) 
    if button == "left" and state == "up" then 
        local parole = guiGetText(edtUser) 
        if parole then 
            triggerServerEvent("submitLogin", getRootElement(), parole) 
            guiSetInputEnabled(false) 
            guiSetVisible(wdwLogin, false) 
            showCursor(false) 
        else 
            outputChatBox("Lūdzu ievadiet paroli.") 
        end 
    end 
end 

amm.. i thought that source is always the element who triggers the function.

FIXED!!!!

I just add a trigger argument to the event and used it as player variable. Now it works well. Thanks for responses.

Edited by Guest
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...