• [HELP] Setting Player name using DTextEntry
    11 replies, posted
So I have a DTextEntry [CODE] local FirstName = vgui.Create( "DTextEntry", Frame ) FirstName:SetPos( ScrW() / 3.8, 45 ) FirstName:SetSize( ScrW() / 1.8, 25 ) FirstName:SetText( "John" ) FirstName.OnEnter = function( self ) end [/CODE] And I want that to Override Player:Nick and Player:Name when I press a DButton [CODE] local Button = vgui.Create( "DButton", Frame ) Button:SetText( "Done" ) Button:SetTextColor( Color( 255, 255, 255 ) ) Button:SetPos( ScrW() / 1.2, ScrH() / 1.2 ) Button:SetSize( ScrW() / 6, 150 ) Button.Paint = function( self, w, h ) draw.RoundedBox( 0, 0, 0, w, h, Color( 91, 91, 91, 150 ) ) -- Draw a blue button end Button.DoClick = function() Frame:Close() end [/CODE]
BUMP*
Go to Steam>Settings>Friends then Profile Name. Boom you see a textentry to change your name then press OK. Have fun!
[QUOTE=kem008;51379693]Go to Steam>Settings>Friends then Profile Name. Boom you see a textentry to change your name then press OK. Have fun![/QUOTE] First of all, that just changes his steam name, and he probably wants it only to work with just in-game names for other players. Secondly, he made a menu for it, so its unlikely that its for a one-time namechange for himself. Is this for a gamemode or addon? If its for a gamemode, there is an easy way to do this, namely overwriting the name functions with your own system. That would be risky to do if its just for an addon though, since it could break some gamemodes that overwrote it themselves.
I remember when we could change name. But valve revamped it. Now connnected to steam. Dunno what name you want to see. Where? On scoreboard? Or on targetid??? You not tell is wtf you really want :D.
[QUOTE=kem008;51380290]I remember when we could change name. But valve revamped it. Now connnected to steam. Dunno what name you want to see. Where? On scoreboard? Or on targetid??? You not tell is wtf you really want :D.[/QUOTE] Going off of my best speculation, hes making a derma panel with a text entry panel so players could easily change their fake ingame name to something else, not their actual steam nickname.
I'm not sure if you can detour Nick function, you should try it, otherwise you will have to edit every element that shows player name so it shows the var you want to, save it inside a NWString, not sure how darkrp does it But i've been doing that, of course i've created custom elements like Scoreboard, chat box and target id as it
Default chatbox. Will be your real problem. You need for that a custom one. Also if you gonna override a basic function then you must save data through networking.
I have no idea what all of these replies are about, but Gonza is correct. You can see how DarkRP does it here: [url]https://github.com/FPtje/DarkRP/blob/353dc3286092cdb2efade2cc0f2145db5a6c2e69/gamemode/modules/base/sh_entityvars.lua#L102-#L110[/url] No need for a custom chat box or any of that rubbish
It's just someone who clearly has no clue what they're talking about. Just listen to Smithy.
im guessing since it says [LUA]self:getDarkRPVar("rpname")[/LUA] it is using a NetVar do I use my NetVar on things I'm using as names instead of default ply:GetName() but more or less [LUA]textentryname = self:GetTextEntryName()[/LUA]?
No, attach a variable to the player object
Sorry, you need to Log In to post a reply to this thread.