Jump to content

Hugos

Members
  • Posts

    172
  • Joined

  • Last visited

Posts posted by Hugos

  1.  

    3 hours ago, salh said:

    use

    guiGetText?

    
    --try this
    
    local screenWidth, screenHeight = guiGetScreenSize ( )
    
    editBox = guiCreateEdit( 0.3, 0.1, 0.4, 0.1, "", true )
    
    function salh()
    dxDrawText ( guiGetText(editBox),44,  41, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.0, "pricedown" )
    end
    addEventHandler ( "onClientRender", root, salh)
    

     

    Thank! Text is not displayed. Added timer:

        setTimer ( function()
            dxDrawText ( guiGetText(editBox),44,  41, screenWidth, screenHeight, tocolor ( 255, 255, 255, 255 ), 1.0, "pricedown" ) 
        end, 1, 0 )

     

    I already have one function (displays "dxDrawRectangle", "dxDrawText"). How to print "function salh ()" over?

  2. 2 hours ago, MRmihailZH said:

    Hi, sorry for bad english.
    I have a question about DGS.
    I create a window in which I create a button (buttonWindow) and add an event to it, but the function works even if you clicked on the window (wnd).

    
    wnd = dgsCreateWindow (...)
    buttonWindow = dgsCreateButton (...,wnd)
    addEventHandler ("onDgsMouseClick", buttonWindow, buttonWindowFunction)
    
    function buttonWindowFunction ()
    ...
    end
    


    How can I fix this?
    Thank you in advance! :) 

     

    Didn't understand the code a bit, but try so!
    function button()
    	buttonWindow = dgsCreateButton()
    	addEventHandler("onDgsMouseClick", buttonWindow, buttonWindowFunction)
    end
    addEventHandler("onClientResourceStart", root, button)
    
    function buttonWindowFunction()
    	dgsCreateWindow()
    end

     

    write the required parameters in parentheses:

    https://wiki.multitheftauto.com/wiki/DgsCreateButton

    https://wiki.multitheftauto.com/wiki/DgsCreateWindow

  3. 9 hours ago, Hugos said:

    Help. I need to create a "guiCreateEdit", focus on it (so that you can enter text immediately) and make it transparent. How?

    With that sorted out, i found my mistakes. There is such a question:
    How do I display text (guiGetText) on the screen when the user enters text in "guiCreateEdit" (in real time)?

  4. 40 minutes ago, salh said:

    use this:

    
    
    id = guiCreateEdit(414, 226, 353, 90, "", false)
    guiSetAlpha(id, 0.00)
    
    addEventHandler("onClientRender", root,
        function()
            dxDrawRectangle(412, 223, 365, 98, tocolor(7, 39, 0, 121), false)
            dxDrawText(guiGetText(id), 411, 224, 777, 316, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false)
        end
    )
    

     

    It not suitable)

  5. 34 minutes ago, DNL291 said:
    
    local text = ""
    
    addEventHandler( "onClientCharacter", root, function ( character )
    	if character == "backspace" then
    		text = text:sub( 1, -2 )
    	else
    		text = text .. character
    	end
    end )
    

     

    I don't know why, but "backspace" doesn't work. (For example, if you change the character to y, q, d, f or s -  works)

  6. 8 hours ago, salh said:
    
    local text = ""
    
    addEventHandler( "onClientCharacter", root, function ( character )
    	text = text .. character
    end )
    
    
    
    addEventHandler("onClientRender", root,
        function()
            dxDrawText(text, 398, 71, 817, 192, tocolor(255, 255, 255, 255), 2.00, "default", "center", "center", false, false, false, false, false)
        end
    )
    

     

     Thank!

  7. 20 hours ago, DNL291 said:

    onClientCharacter

    Example:

    
    local text = ""
    
    addEventHandler( "onClientCharacter", root, function ( character )
    	text = text .. character
    end )
    

     

    can the resulting text be output to "DxDrawText"? If so, then how to do it?

    (Can be example on opportunities?
    )

     

  8. You must set a variable with this function: The user enters the characters on the keyboard and they are shown with one line on the screen
    How can this be done?
    (A variable is a string of text)
     

  9. 1 hour ago, salh said:
    
    -- 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)
    

    thsi code make the text show

    this*

     

    this script does not work. (Show black display)

    1 hour ago, salh said:
    
    -- 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)
    

    thsi code make the text show

    this*

     

    Understood. Find errors.
    Necessary:

    local salh = guiCreateLabel(453, 0, 476, 78, character, false)

    instead "salh = guiCreateLabel(453, 0, 476, 78, character, false)" and must be before "guiSetText(salh, "")"

×
×
  • Create New...