I’m making a money printer from scratch for my gamemode. The serverside code works fine, the money is added perfectly over time, as expected. However, I want to display how much money a specific printer is holding in it’s storage in cam3D2D.
The way im setting the variable for the printer’s storage/money is in the
function, and then
self.printer_storage = 0
Like I said above. Eveything works fine serverside as expected. I’ve tried adding in something that every time the printer’s money gets changed, it sends the new amount to the client, like this.
util.AddNetworkString( "PMUpdate" ) function PrinterMoneyUpdate( amount ) net.Start( "PMUpdate" ) net.WriteFloat( amount ) net.Broadcast() end
However, I do not know how to make it so it’s only for a specific printer.
The way im receiving it is like so
local cl_print_storage net.Receive( "PMUpdate", function() cl_print_storage = formatMoney( net.ReadFloat() ) end )
However, doing it this way I realize that it will work serverside, but it sends self.printer_storage however many times there are printers spawned in, causing the numbers to twitch/rapidly change.
How would I set the variable client-side so it’s for THAT SPECIFIC ent/printer?
If you want me to explain more just ask, thanks!
I’ve tried doing this in the clientside file, but it only updates every time the file is reloaded/loaded.
net.Receive( "PMUpdate", function() _print_storage = formatMoney( net.ReadFloat() ) end ) ENT.cl_print_storage = _print_storage
[editline]27th February 2016[/editline]
Solved. Used ENT:SetupDataTables as an alternative to networking it myself.