Jump to content

[HELP] echo outputPressedCharacter


Hugos

Recommended Posts

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)?

Link to comment

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)

 

Edited by salh
Link to comment
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
 

Link to comment
-- 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*

 

Link to comment
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, "")"

Link to comment
12 minutes ago, salh said:

why you make this local


salh = guiCreateLabel(453, 0, 476, 78, character, false) -- this is gui you can use local ut not Necessary

 

The text is displayed not in a string, but in a single character on top of another. What to do?

Edited by Hugos
Link to comment

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...