Bug with NUI (Duplicates)

Hellow, I have a little problem with LUA with NUI, one of you know how to prevent the repetition?

I explain:

Step 1.the player writes /api that makes a check in BDD before hand then its opens the NUI
Step 2. the player closes the NUI directly
Step 3. the player redoes the command /api it redoes the step 1.
Step 4. the player clicks in the nui (to join this safezone), of my side client its duplicates 2 times this function js (print X2).

(Other example), player type /api and close, and retype /api and reclose, and type /api and valid $.post entering is showing X3…

Movie : FiveM Bug NUI - YouTube

I don’t understand solved ;/ thanks for your help.
Shepard

Can you share your code?

1 Like

Use unbind function, before click

1 Like

Hi do you have a exemple ?

My function for click :

 $('.joinbase').click(function(){

        $.post(`https://${GetParentResourceName()}/joinbase`, JSON.stringify(
            {
                "SAFEZONE_ID"   : 1
            }
        ),function(data) {
            console.log(data)
        });
        return
       
    })	
 $('.joinbase').unbind('click').click(function(){

        $.post(`https://${GetParentResourceName()}/joinbase`, JSON.stringify(
            {
                "SAFEZONE_ID"   : 1
            }
        ),function(data) {
            console.log(data)
        });
        return
       
    })	
1 Like

Thanks ! LOL just this :smiley: let go to make similar system of game state of decay 2 :smiley:

Thanks for your help, this is the result :wink: Fivem Zombie Safezone Gestion inspired StateOFDECAY2 - YouTube

1 Like