Jump to content

Hugos

Members
  • Posts

    172
  • Joined

  • Last visited

Posts posted by Hugos

  1. 43 minutes ago, salh said:

    please clarify

    use this:

    
    -- gui
    Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false)
    
    
    function outputPressedCharacter(character)
    	if character==" " then --if the character is a space
    		character = "space" --change 'character' to 'space'
    	end
    	setTimer ( function()
    		guiSetText(salh, "")
    	end, 100, 1 )
    		salh = guiCreateLabel(453, 0, 476, 78, character, false)
    end
    
    
    addEventHandler("onClientGUIClick", root, function ()
        if source == Button then
    		addEventHandler("onClientCharacter", getRootElement(), outputPressedCharacter)
        end
    end)
    
    

     

    not work
     

  2. Help me, how to use functions "outputPressedCharacter" and this script:

    Button = guiCreateStaticImage(250, 250, 250, 30, "gfx/Button.png", false)
    addEventHandler("onClientGUIClick", Button, FButton, false)
    
    function FButton(button)
        if button == "left" then
        end
    end

    show text that the user types after clicking the button (text, not a single character)?

  3. 7 hours ago, R.I.P Logic said:

    My bad

    
    local label
    function fedit()
    	edit1 = guiCreateStaticImage(608, 544, 150, 40, "gfx/edit.png", false)
    	addEventHandler("onClientGUIClick", edit1, fedit1, false)
    end
    addEventHandler("onClientResourceStart", getRootElement(), fedit)
    
    function fedit1 (button)
        if button == "left" then
            label = guiCreateLabel( 608, 544, 200, 30, "Text", false)
            guiSetVisible( label, true)
        end
    end
    
    function removeLabel()
        guiSetVisible( label, false)
    end
    --What ever you need to addEventHandler or addCommandHandler or call the function ' removeLabel() '
    

     

    I don't need to print the text. Let's say this field is for login. The player clicks on the field and enters the login, it is displayed on top of the field.
     

    There is a "onClientCharacter"function. Don't know how to do the whole text, not per character.
     

  4. function fedit()
    	edit1 = guiCreateStaticImage(608, 544, 150, 40, "gfx/edit.png", false)
    	addEventHandler("onClientGUIClick", edit1, fedit1, false)
    end
    addEventHandler("onClientResourceStart", getRootElement(), fedit)
    
    function fedit (button)
        if button == "left" then
        
        end
    end

    User clicked "guiCreateStaticImage" >>> user typing text >>> displayed on top "guiCreateStaticImage".

    P.S: edit.png - rectangle (input field)

  5. I created the field using guiCreateStaticImage, need to attach function onClientGUIClick to when the button is pressed (guiCreateStaticImage), it was possible to write the text which would be displayed on the screen (in the field). Perhaps with the help dxDrawText? Help me, please!

  6. 12 hours ago, salh said:
    
    addEventHandler("onClientRender",  root,
        function dx()
            dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
            dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
            dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
            dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
        end
    )
    
    
    function F_BTN_GO (button)
        if button = =  "left" then
            guiSetVisible( BTN_L_A,  false)
        	guiSetVisible( BTN_R,  false)
            triggerServerEvent ("onGreeting",  getLocalPlayer())
        	removeEventHandler("onClientRender", getRootElement(), dx)  -- for remove the window dx
        end
    end
    

     

    
    local x, y =  guiGetScreenSize()
    Font =  dxCreateFont("fonts/GOTHIC.ttf",  20)
    function dx()
            dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
            dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
            dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
            dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
    end
    addEventHandler("onClientRender", getRootElement(), dx)  -- for add the window dx
    
    showCursor(true)
    outputChatBox("\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
    
    BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)
    BTN_R =  guiCreateStaticImage(458, 209, 140, 25, "img/btn_r.png", false)
    BTN_GO =  guiCreateStaticImage(608, 544, 150, 40, "img/btn_go.png", false)
    
    
    
    addEventHandler("onClientGUIClick",  root, function() -- event
      if(source ==  BTN_GO) then  -- if player click button or StaticImage
            guiSetVisible(BTN_L_A, false)
        	guiSetVisible(BTN_R, false)
    		guiSetVisible(BTN_GO, false)
    		showCursor(false)
    		removeEventHandler("onClientRender",getRootElement(),dx) -- for remove the window dx
    	end -- close if
    end) -- close function 
    

    try this

    after replacing  

    1. addEventHandler("onClientRender",  root,
    2. function ()

    for

    1. addEventHandler("onClientRender",  root,
    2. function dx()

    window are no longer displayed.?

  7. 4 часа назад салх сказал:

    окно, которое вы хотите закрыть

    Я не создавал окно
     

    local x,y = guiGetScreenSize()
    Font = dxCreateFont("fonts/GOTHIC.ttf", 20)
    
    addEventHandler("onClientRender", root,
        function()
            dxDrawRectangle(0, 0, x, y, tocolor(1, 1, 1), false)
            dxDrawRectangle(358, 159, 650, 450, tocolor(0, 0, 0), false)
            dxDrawRectangle(358, 159, 650, 50, tocolor(187, 255, 51), false)
            dxDrawText("WELCOM", 358, 159, 1008, 209, tocolor(0, 0, 0), 1, Font, "center", "center")
        end
    )
    
    function Connect()
        showCursor(true)
        outputChatBox("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n")
    
        BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)
        BTN_R = guiCreateStaticImage(458, 209, 140, 25, "img/btn_r.png", false)
    
        BTN_GO = guiCreateStaticImage(608, 544, 150, 40, "img/btn_go.png", false)
        addEventHandler("onClientGUIClick", BTN_GO, F_BTN_GO, false)
    end
    addEventHandler("onClientResourceStart", root, Connect)
    
    function F_BTN_GO (button)
        if button == "left" then
            guiSetVisible(BTN_L_A, false)
        	guiSetVisible(BTN_R, false)
            triggerServerEvent ("onGreeting", getLocalPlayer())
        end
    end

    My script

  8. 5 hours ago, salh said:
    
    addEventHandler("onClientGUIClick",  root, function()
      if(source ==  BTN_GO) then  
            outputChatBox("hi!")
            guiSetVisible( BTN_L_A,  false)
    	end
    end)
    
    --
    
    
    
    button_go =  guiCreateStaticImage( 419 ,  240 ,  185 ,  124 ,  ":gui/images/dx_elements/checkbox_tick.png",  false) 
    
    addEventHandler("onClientGUIClick",  root, function()
      if(source ==  button_go) then  
            outputChatBox("hi!")
    		guiSetVisible( button_go, false)
    	end
    end)
    

     

    and change your button name

    
    guiSetVisible( your window name, false)
    

     

    Window? 

  9. 1 час назад, #BrosS сказал:

    как называется кнопка, которая должна закрыть изображение

    BTN_GO = guiCreateStaticImage(608, 544, 150, 40, "img / btn_go.png", false)

  10. 10 hours ago, #BrosS said:

    I have a script like this (When you tap the text displayed and the gui is not removed)

    function F_BTN_GO (button)
        if button == "left" then
            outputChatBox("hi!")
            guiSetVisible(BTN_L_A, false)
        end
    end

    Button (  BTN_L_A = guiCreateStaticImage(358, 209, 100, 25, "img/btn_l_a.png", false)  )

  11. Hi everyone. I created image: guiCreateStaticImage(608, 544, 150, 40, "img/btn.png", false). How do I make a button from a picture. It is necessary that when clicked, the action is performed.

    How to do this?

×
×
  • Create New...