Jump to content

Question of show text


Hugos

Recommended Posts

Posted (edited)

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)
 

Edited by Hugos

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

Posted

onClientCharacter

Example:

local text = ""

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

 

  • Like 1

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
11 hours ago, DNL291 said:

onClientCharacter

Example:


local text = ""

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

 

Is it possible to delete the last character when clicking on "backspace"?
 

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

Posted
1 minute ago, salh said:

yes its possible

you can make new function for this

What function?

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

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

 

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

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

 

Posted
18 hours ago, Hugos said:

Is it possible to delete the last character when clicking on "backspace"?
 

local text = ""

addEventHandler( "onClientCharacter", root, function ( character )
	if character == "backspace" then
		text = text:sub( 1, -2 )
	else
		text = text .. character
	end
end )

 

Please do not PM me with scripting related question nor support, use the forums instead.

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

Edited by Hugos

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

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

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

Posted

becose the onClientCharacter hes job get the key

not make action for hem

if you want backspace you need make new function for new action

Posted
Just now, salh said:

becose the onClientCharacter hes job get the key

not make action for hem

if you want backspace you need make new function for new action

?

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

Posted

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
)

 

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

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

Posted
12 hours ago, Hugos said:

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)

"backspace" only works for the "onClientKey" event, my bad.

In this case, add this event for the "backspace" key and it should work.

  • Like 1

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
33 minutes ago, DNL291 said:

"backspace" only works for the "onClientKey" event, my bad.

In this case, add this event for the "backspace" key and it should work.

Thank!

Говорю на русском. 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...