Hey guys any ideas why setnuifocus function not working?
function uzdarytiui()
SetNuiFocus( false )
SendNUIMessage({message = "hide"})
end
RegisterNUICallback('iseiti', function(data, cb)
uzdarytiui()
cb('ok')
end)
$(".close").click(function(){
$.post('http://narkotikai/iseiti', JSON.stringify({}));
});
NUI dissapears, but mouse still keeps on screen, tried use false,false, still not working, any ideas?
Yeah because SetNuiFocus takes 2 arguments.
SetNuiFocus
// 0x5B98AE30
// SET_NUI_FOCUS
void SetNuiFocus(bool hasFocus, bool hasCursor);
I know it works fine. I use it in all of my NUI Projects.
I fixed it, just make it close with ESCAPE button, but now I have another problem, button not working, just does nothing.
$(".acetonas").click(function() {
$.post('http://narkotikai/acetone', JSON.stringify({}));
});
<h2><a href="#" class="acetonas">Acetonas</a></h2>
RegisterNUICallback('acetone', function(data, cb)
uzdarytiui()
cb('ok')
end)
I don’t use JQuery so you will need to wait until someone comes through and see what I probably wont.
You don’t always have to provide all parameters if not provided it will just false
Is the resource name right? Like no uppercase letters or something? Is the click called? (add debug console log)
1 Like
No, but I fixed it , and I fixed buttons almost, but when I press on button, it clicks twice, how I should fix it? Because when I press on button it calls server event, and it calls same event three or two times, any fix?
RegisterNUICallback('ammonia', function(data, cb)
TriggerServerEvent('ammonia')
cb('ok')
end)
RegisterNUICallback('sodium', function(data, cb)
TriggerServerEvent('sodium')
cb('ok')
end)
$("#amoniakas").click(function() {
$.post('http://narkotikai/ammonia', JSON.stringify({}));
});
$("#natris").click(function() {
$.post('http://narkotikai/sodium', JSON.stringify({}));
});
<div class="block-content" id="amoniakas">
<div id="block">
<div id="icon"><img src="img/ammonia.png"></div>
<h2>Amoniakas</h2>
</div>
</div>
<div class="block-content" id="natris">
<div id="block">
<div id="icon"><img src="img/sodium.png"></div>
<h2>Natris</h2>
</div>
</div>
1 Like
I was thinking fixed it, but still same problem.
When I open NUI first time, it clicks once, when I open second time, it clicks twice. Any fix? I’m new at this thing.