Using PData with derma.

So I know you can’t use PData clientside, so what I need to do is find a way to use my functions on the client. So here’s a function I created, ( and this is also the function I want to call on the client, through derma. )

function PMeta:GetUsername()
local data = tostring( self:GetPData(“Username”) );

if ( data == nil ) then
ErrorNoHalt( "SOVIET - PMeta:GetUsername was called, but failed due to the field being nil.
" )
return data

And basically I need a way to call that function through a derma button, but I’m pretty sure I can’t call it directly because it has something to do with PData inside of it, how can I call it through my menu? A quick response would be great, thanks!

Here’s how I would need to call it,

function Initial_Menu()

if ( !GetUsername() == nil ) then – How would I call getusername here?
Initial_Menu = vgui.Create( “DFrame” )
Initial_Menu:SetPos( 50,50 )
Initial_Menu:SetSize( 1000, 900 )
Initial_Menu:SetTitle( “Soviet: Initial Creation” )
Initial_Menu:SetVisible( true )
Initial_Menu::SetBackgroundBlur( true )
Initial_Menu:SetDraggable( true )
Initial_Menu:ShowCloseButton( true )

you can use COOKIE_S clientside




Not the question, and I can’t use cookies, I need to use PData, this is for a roleplay gamemode and you can edit cookies easily, aka making money, names etc. hackable. I need a way to use PData, could I use concommands.


oh thats what you want make the client run a command to change their name

Well, no but I need to be able to get and set the PData fields.

Also can you give me an example with umsg? I’ve never really used it, surprisingly.

Read the wiki, it’s quite clear.


This the easiest most safest way your most likely gonna get. PData also saves in the format sql lite. Which is okay but I personally hate it.