Jump to content

[HELP] Double problem


LabiVila

Recommended Posts

Posted

So I want this, once I click the object, it outputs: "You selected a guy", if I do it again, it outputs the same text again, but I have a problem, it doesn't reply only one time but a lot like here:

http://www.upload.ee/image/4432676/Untitled.png

function mainWindow () 
    main = guiCreateWindow (0.70, 0.20, 0.25, 0.25, "Auto-Converter", true) 
    selectButton = guiCreateButton (0.15, 0.40, 0.30, 0.30, "Click", true, main) 
    generate = guiCreateButton (0.60, 0.40, 0.30, 0.30, "G", true, main) 
    addEventHandler ("onClientGUIClick", selectButton, 
        function () 
            outputChatBox ("Must select a shade (3458 or 8558).", 255, 255, 255) 
            addEventHandler ("onClientClick", getRootElement(), 
                function (button, state, absoluteX, absoluteY, worldX, worldY, worldZ, element) 
                    if (state == "down") then 
                        if (getElementType (element) == "object") and (getElementModel (element) == 8558 or getElementModel (element) == 3458) then 
                            outputChatBox ("You selected a shade") 
                        return end 
                    end 
                end 
            )    
        end 
    ) 
    outputDebugString ("Program Started") 
end 
addEventHandler ("onClientResourceStart", getResourceRootElement(getThisResource), mainWindow) 
  
  

I'd appreciate any help

  • MTA Team
Posted

You have to set the parameter getPropagated from addEventHandler to false

addEventHandler("onClientGUIClick", selectButton, function () ... end, false) 

  • MTA Team
Posted

Use a variable (boolean), which will tell the script, if the player is supposed to click on an element or not.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

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