Money printer (A.K.A level printer) reached the maximum /buylevelprinter
5 replies, posted
Hello facepunch.
I made a special printer for DarkRP, and I got this problem with it.
Then it gets destroyed it can't be spawned again, because you reached the maximum level...
I would like to know if this is a common thing, or if i messed something up.
Here's a video (Done uploading): [url]http://www.youtube.com/watch?v=itcvuDNlJig&feature=youtu.be[/url]
And a picture:
[thumb]http://puu.sh/2Wuhk.jpg[/thumb]
Well Mikkel, we can't read minds, post the code and we can help :P
For the removal code, you could throw in something [I][U]like[/U][/I] this, calling the function with RemoveKebab(self) . This is code from an old printer I did, and thus is hacky and probably broken in recent Gmod.
Note: I have no clue what the fuck I was thinking when I wrote it.
[code]
RemoveKebab = function(ent)
local cname = ent:GetClass()
local ply = self.dt.owning_ent
local cmdname = string.gsub(cname, " ", "_")
if not ply["max"..cmdname] then
ply["max"..cmdname] = 1
end
ply["max"..cmdname] = ply["max"..cmdname] - 1
end
[/code]
Make sure you have the shared.lua setup to set the owning_ent, like most darkrp printers out there already do.
[code]
function ENT:SetupDataTables()
self:DTVar("Int",0,"price")
self:DTVar("Entity",1,"owning_ent")
end
[/code]
Sorry, you need to Log In to post a reply to this thread.