[QUOTE=raklatif;43860027][CODE]
printerMax = currentNormal + currentGold + currentRuby;
if ( printerMax > 10 )
{
chatPrint("Too Many Printers!");
hint("Printer Limit Reached!", 4);
}
[/CODE]
Basically...[/QUOTE]
... way to use { } when lua uses then end.
Anyway,
[CODE]
local valueorsomethin = {}
valueorsomethin["regular"] = 1
valueorsomethin["gold"] = 2
-- Change, add, whatever.
local maxprinterpoints = 10
-- You can put this in the ENT:Spawn or ENT:Init hook. But if you put it in the Init hook, you'll have to define "ply" by yourself.
-- function ENT:SpawnOrInit
if !ply.Printer_Limit then -- We're basically tying a variable to the player. It makes things kind of easier.
ply.Printer_Limit = 0 --Note that this doesn't save when the server restarts
end
if ply.Printer_Limit >= maxprinterpoints then
ply:SendLua("notification.AddLegacy(\"Too many printers!\", NOTIFY_ERROR, 5)") -- Give that nice little message with an (X) on it
ply:ConCommand("play buttons/button8.wav") -- Play a little error sound
else
ply.Printer_Limit = ply.Printer_Limit + valueorsomethin[self.DarkRPItem.printertype]
end
-- en
function ENT:OnRemove() -- You can plug this in your code (Assuming you have ply defined.)
ply.Printer_Limit = ply.Printer_Limit - valueorsomethin[self.DarkRPItem.printertype]
end
[/CODE]
Also, I noticed a lot of your strings use single quotes, not double.. this is VERY bad and will break your code.
Example:
[code]
(self.DarkRPItem.printertype == 'regular')
-- Should be changed to
(self.DarkRPItem.printertype == "regular")
[/code]
It's almost midnight so I'm going to bed soon. Hope this helps.
How and where would I do this?
Sorry, you need to Log In to post a reply to this thread.