Jump to content

attempt to compare number with boolean


Recommended Posts

na hora que es busco uma tabela do banco de dados, ele não está me retornando false nela, mas está dando erro.

ERROR: src_accounts2/assets/scripts/s.lua:44: attempt to compare number with boolean

 

addEvent("Preis:ColocarDadosBanco", true)
addEventHandler("Preis:ColocarDadosBanco", root, function(p, nome, sobrenome, idade, sexo)
    local sql = dbPoll(dbQuery(db, "SELECT * FROM persons WHERE ContaOficial=?", getAccountName(getPlayerAccount(source))), -1)
    if (not sql == false) then
        if (#sql > 0 and not string.find(sql[1].Conta, "_1") and not #sql > 4) then  -- essa é a linha 44 onde apareçe o erro
            dbExec(db,
                "INSERT INTO persons(ContaOficial, Conta, Nome, Sobrenome, Idade, Sexo, ACLs, Emprego, Banido, Premium, Online) VALUES(?,?,?,?,?,?,?,?,?,?,?)",
                getAccountName(getPlayerAccount(source)),
                getAccountName(getPlayerAccount(source)) .. (#sql > 0 and "_" .. (#sql + 1) or ""),
                nome,
                sobrenome,
                idade,
                sexo,
                _,
                "Desempregado",
                "Nao",
                "N",
                "N")
                addAccount(getAccountName(getPlayerAccount(source)) .. "_" .. (#sql + 1), "PreisOlympia")
        else
            dbExec(db,
            "INSERT INTO persons(ContaOficial, Conta, Nome, Sobrenome, Idade, Sexo, ACLs, Emprego, Banido, Premium, Online) VALUES(?,?,?,?,?,?,?,?,?,?,?)",
            getAccountName(getPlayerAccount(source)),
            getAccountName(getPlayerAccount(source)) .. (#sql > 0 and "_" .. (#sql + 1) or ""),
            nome,
            sobrenome,
            idade,
            sexo,
            _,
            "Desempregado",
            "Nao",
            "N",
            "N")
        end
        local sql2 = dbPoll(dbQuery(db, "SELECT * FROM Contas WHERE ContaOficial=?", getAccountName(getPlayerAccount(source))), -1)
        if (sql2) then
            local dracmas = ""
            for i,d in ipairs(sql2) do
                dracmas = d.Dracmas
            end
        end
        if (#sql > 0) then
            triggerClientEvent(source, "Preis:OpenCriadorPersonagem", source, sql, dracmas,"AcabouCriar")
        else
            triggerClientEvent(source, "Preis:OpenCriadorPersonagem", source, "SemPerson","AcabouCriar")
        end
    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...