Jump to content

Bad argument @ triggerClientEvent


Recommended Posts

Estaba programando cuando fui a probar me salio ese error en la consola.

addEvent("onPlayerLoginBG", true) 
addEventHandler("onPlayerLoginBG", resourceRoot, 
    function(user, pass) 
        local contra = hash("sha512", string.sub(user, 0, math.floor(string.len(user)/2)) .. pass .. user) -- Crear el hash 
        dbQuery(--Comprobar que la cuenta no exista 
            function(hand) 
                local result, num_affected_rows, last_insert_id = dbPoll(hand, 0) 
                CheckConsulta(result, num_affected_rows, last_insert_id) 
                if result then 
                    if num_affected_rows == 0 then outputChatBox(" ** #fff714El nombre de usuario no existe.", client, 255, 0, 0, true) 
                    else 
                        for _, row in ipairs ( result ) do 
                            outputChatBox("Password: " .. row["Password"], client, 255, 0, 0, true) 
                            if row["Password"] == contra then 
                                outputChatBox("#ffffffBienvenido a #ff0000Blod Gamer", client, 0, 0, 0, true) 
                                triggerClientEvent(getRootElement(), "OnPlayerFinishLogin", getRootElement()) 
                                -- Obtener datos de la db y guardarlos 
                                for column, value in pairs ( row ) do 
                                    exports.LoginRegister:set_data(client, column, value) 
                                end 
                            else outputChatBox("#fff714La contraseña es incorrecta", client, 0, 0, 0, true) end 
                        end    
                    end 
                end 
            end, 
        MYSQL, "SELECT `Password` FROM `userdata` WHERE `Cuenta` = ?", user) -- Si existe o no la cuenta 
    end 
) 

En la linea:

triggerClientEvent(getRootElement(), "OnPlayerFinishLogin", getRootElement()) 

Lo solucione colocando getRootElement(), pero con source, client y resourceRoot no funciona. (Antes me funcionaba con "client" pero ahora no, miren y veran: https://forum.multitheftauto.com/viewtopic.php?f=146&t=87998 )

¿Que palabra debo usar para no utilizar getRootElement()?

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...