Sign in to follow this  
Hugos

Question of show text

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

Share this post


Link to post

onClientCharacter

Example:

local text = ""

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

 

  • Like 1

Share this post


Link to post
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"?
 

Share this post


Link to post

yes its possible

you can make new function for this

Share this post


Link to post
1 minute ago, salh said:

yes its possible

you can make new function for this

What function?

Share this post


Link to post
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?
)

 

Share this post


Link to post
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
)

 

Share this post


Link to post
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 )

 

Share this post


Link to post
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

Share this post


Link to post
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)

Share this post


Link to post

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

Share this post


Link to post
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

?

Share this post


Link to post

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
)

 

Share this post


Link to post
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)

Share this post


Link to post
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

Share this post


Link to post
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!

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.