Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

222
Views
intente llamar a un valor nulo (upvalue 'successCB')

Hola, tengo un problema y dice intento de llamar a un valor nulo (upvalue 'successCB'). Probé diferentes métodos pero no funcionó, así que quiero saber si me pueden ayudar.

Aquí está la imagen del error.

y aqui esta main.lua:20

 RegisterNUICallback("main", function(data) SetNuiFocus(false, false) QBCore.Functions.Notify("Authorization Success" , 'success', 7500) successCb() end)

a continuación también hay una parte corta del código código JS

 $("#submit").click(function () { let inputValue = $("#input").val() if (inputValue.length > 4) { $.post("http://vny-lvaultcodes/error", JSON.stringify({ error: "Code cannot be greater than 4" })) $("#container").fadeOut(250); return } else if (!inputValue) { $.post("http://vny-lvaultcodes/error", JSON.stringify({ error: "You need to type a 4 digit code for submitting." })) $("#container").fadeOut(250); return } if(inputValue == code){ $.post('http://vny-lvaultcodes/main', JSON.stringify({text: inputValue,})); $("#container").fadeOut(250); } else { $.post('http://vny-lvaultcodes/failed', JSON.stringify({})); $("#container").fadeOut(250); }

también debajo hay una función para abrir la interfaz de usuario y esas cosas

 function openCode(show, code, success, fail) successCb = success failCb = fail display = true SetNuiFocus(true, true) SendNUIMessage({ type = "open", code = code, }) end
about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

No estoy familiarizado con Fivem, pero mirando la documentación, creo que ha definido su devolución de llamada incorrectamente.

https://docs.fivem.net/docs/scripting-manual/nui-development/nui-callbacks/

RegisterNUICallback no solo toma un valor de datos, sino también la devolución de llamada (cb en el documento).

En su caso, SuccessCb sería nulo, por lo tanto, cuando llama a SuccessCb (), se produce el error.

Como tal, probaría uno de los siguientes:

 RegisterNUICallback("main", function(data, successCb) SetNuiFocus(false, false) QBCore.Functions.Notify("Authorization Success" , 'success', 7500) successCb() end)
 RegisterNUICallback("main", function(data, cb) SetNuiFocus(false, false) QBCore.Functions.Notify("Authorization Success" , 'success', 7500) cb() end)

Espero que eso ayude.

about 4 years ago · Santiago Gelvez Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!