Hi, i would like to create a nui script, but somehow the RegisterNUICallback event not beeing trigered
the resource name: characterSelect
libary structure:
-
characterSelect
-
client
-
html
- characterSelect.js
- index.html
- style.css
-
characterSelect_c.lua
-
-
__resource.lua
-
characterSelect_c.lua (client)
RegisterNUICallback('inf', function(data, cb)
SetNuiFocus(false,false)
TriggerEvent("chat:addMessage", {
color = {0, 255, 0},
multiline = true,
args = {"[SUCESS]: ", "something"}
})
cb('ok')
end)
characterSelect.js
$(function(){
$('#wrapper').hide();
window.addEventListener('message', function(event){
var item = event.data;
if (item.command && item.command == 'enableUI'){
$('#wrapper').show();
}else if(item.command && item.command == 'disableUI'){
$('#wrapper').hide();
}
},false);
$('#third').click(function() {
$.post('http://characterSelect/inf', JSON.stringify({}));
$('#wrapper').hide();
});
});
The click event is working, because it hides the wrapper div
I don’t know what’s wrong