SetNWInt & GetNWInt Problem

As the title says, I’ve been having problems with SetNWInt & GetNWInt, I created a Derma Menu with props you can buy, and when you purchase a selected prop it will say the correct amount. Five seconds later, it reverts back to it’s default number which is $500. I changed the value manually through the console server side, and it didn’t revert back to $500, but when I did it client side on the console it did.


I’ve spent hours trying to debug the problem, but found no solution to the problem. I’ve tried to completely stop using it, and debug it from the console. Nothing seemed to work.

local meta = FindMetaTable("Player")

function meta:SetMoney(amt)
	self:SetNWInt("Cash", amt)

function meta:GetMoney()
	return self:GetNWInt("Cash")

function meta:AddMoney(amt)
	self:SetMoney(self:GetMoney() + amt)

function meta:TakeMoney(amt)
	self:SetMoney(self:GetMoney() - amt)

Set the NWInt on SERVER, not CLIENT.

[editline]25th June 2014[/editline]

Also, post actual code where you call the functions, how are we supposed to help you otherwise?

[editline]25th June 2014[/editline]

Nice edit


function GM:PlayerInitialSpawn(ply)


Thank you for fast reply by the way. So specificly don’t set NWInt’s on the client at all? You’re not talking about initializing it only on the server right?

Setting NWInts on the client means that it stays on the client. It does not get sent to the server.

Damnit I hate it when the problem is as simple as this. Thank you!