Jump to content

[HELP] echo outputPressedCharacter


Hugos

Recommended Posts

Posted

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

Говорю на русском. Sorry for bad english.
 

Posted (edited)

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

Говорю на русском. Sorry for bad english.
 

Posted
Just now, salh said:

вы хотите, если игрок нажмите кнопку показать текст илисимвол?

эта работа со мной

text

Говорю на русском. Sorry for bad english.
 

Posted
-- 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*

 

Posted
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, "")"

Говорю на русском. Sorry for bad english.
 

Posted (edited)

+ The text is displayed not in a string, but in a single character on top of another

Edited by Hugos

Говорю на русском. Sorry for bad english.
 

Posted

why you make this local

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

 

Posted (edited)
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

Говорю на русском. Sorry for bad english.
 

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