Text help

Hello there i have started learning LUA and just wondering how i could make it so i could change my ingame name with this:

local DermaText = vgui.Create( “DTextEntry”, DermaPanel )
DermaText:SetPos( 20,25 )
DermaText:SetTall( 20 )
DermaText:SetWide( 450 )
DermaText:SetEnterAllowed( true )
DermaText.OnEnter = function()
Msg(“You entered -”…DermaText:GetValue()…"-!" ) – What happens when you press enter
DermaPanel:SetVisible( false )
end

So when you put your name in it changes it to that and displays it on your Guy thank you.

Well it’s a little more complex than that. You can’t force a client to change his steam name trough lua. You’ll need to setup a displayname system for that to be possible.

You could try something like this.


DermaText.OnEnter = function()
          RunConsoleCommand("setname",DermaText:GetValue()0
          DermaPanel:Close()
end

USE LUA TAGS!!! Tags = lua and /lua with them being surrounded by these

Doesn’t make much of a difference really. I only use lua tags on long pieces of code. [noparse][lua] and [/lua][/noparse] are pretty cool though. :V