Discord
Steam
/
Garry's Mod
/
Developers
/
Cant use multi..
Login/Join
Event Log
Cant use multiple printers
0 replies, posted
Search
In This Thread
[B][U]cl_init.lua[/U][/B] [CODE]include("shared.lua") include("bprinters_config.lua") surface.CreateFont( "Font", { font = "Arial", extended = false, size = 45, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "upFont", { font = "Arial", extended = false, size = 45, weight = 10, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "nameFont", { font = "Arial", extended = false, size = 40, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "statFont", { font = "Arial", extended = false, size = 30, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "SmallerFont", { font = "Arial", extended = false, size = 30, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) surface.CreateFont( "XSmallerFont", { font = "Arial", extended = false, size = 22.5, weight = 500, blursize = 0, scanlines = 0, antialias = true, underline = false, italic = false, strikeout = false, symbol = false, rotary = false, shadow = false, additive = false, outline = false, } ) function ENT:Draw() self:DrawModel() local ang = self:GetAngles() local Pos = self:GetPos() local Ang = self:GetAngles() Ang:RotateAroundAxis(Ang:Up(), 90) cam.Start3D2D(Pos + Ang:Up() * 10.7, Ang, 0.11) local owner = self:Getowning_ent() owner = (IsValid(owner) and owner:Nick()) or DarkRP.getPhrase("unknown") draw.SimpleText(owner,"SmallerFont",-124,-95,Color(255, 255, 255,255),0,0) draw.WordBox(2.5,-125,-140,CONFIG.BronzePrinterName,"nameFont",Color(150, 150, 150,150),Color(255, 255, 255,255)) local maxholdLVL = (CONFIG.BronzeCapacity) local interval = CONFIG.BronzePrintTime if interval <= 1 then draw.SimpleText("Speed: " .. math.Round(interval , 1) .. "sec","XSmallerFont",-125,-50,Color(255, 255, 255,255),0,1) elseif interval > 1 and interval < 60 then draw.SimpleText("Speed: " .. math.Round(interval , 1) .. "secs","XSmallerFont",-125,-50,Color(255, 255, 255,255),0,1) elseif interval >= 60 and interval < 120 then local printtime = math.Round(interval , 1) / 60 draw.SimpleText("Speed: " .. printtime .. " min","XSmallerFont",-125,-50,Color(255, 255, 255,255),0,1) elseif interval >= 120 then local printtime = math.Round(interval / 60 , 1) draw.SimpleText("Speed: " .. printtime .. " mins","XSmallerFont",-125,-50,Color(255, 255, 255,255),0,1) end local printamountLVL = math.Round(CONFIG.BronzePrintAmount) local maxholdLVL = math.Round(CONFIG.BronzeCapacity) draw.SimpleText("Paper: " .. DarkRP.formatMoney(printamountLVL),"XSmallerFont",-125,-20,Color(255,255,255,255),0,1) if CONFIG.BronzeCapacity > 0 then draw.SimpleText("Capacity: " .. DarkRP.formatMoney(maxholdLVL),"XSmallerFont",-125,10,Color(255,255,255,255),0,1) elseif CONFIG.BronzeCapacity == 0 then draw.SimpleText("Capacity: Unlimited","XSmallerFont",-125,10,Color(255,255,255,255),0,1) end cam.End3D2D() Ang:RotateAroundAxis(Ang:Forward(), 90) cam.Start3D2D(Pos + Ang:Up() * 16.95, Ang, 0.11) local interval = CONFIG.BronzePrintTime local timeleftbar = math.Clamp((self:GetNWFloat("PrintDone",0) - CurTime()) * (267.5 / interval) , 0 , 267.5) draw.RoundedBox(0,-137.5,-95,277.5,90,Color(100,100,100,255)) draw.RoundedBox(0,-132,-90,timeleftbar,80,Color(125,125,125,255)) draw.SimpleText(DarkRP.formatMoney(self:GetMoneyAmount()),"nameFont",0,-70,Color(255,255,255,255),1,0) cam.End3D2D() end [/CODE] [U][B]init.lua[/B][/U] [CODE]AddCSLuaFile("shared.lua") include("shared.lua") include("bprinters_config.lua") function ENT:StartSound() self.sound = CreateSound(self, Sound("ambient/levels/labs/equipment_printer_loop1.wav")) self.sound:SetSoundLevel(52) self.sound:PlayEx(1, 100) end function ENT:Initialize() self:SetModel("models/props_c17/consolebox01a.mdl") self:SetColor(CONFIG.BronzePrinterColor) self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self.timer = CurTime() local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end self:StartSound() end function ENT:OnTakeDamage(dmg) self:TakePhysicsDamage(dmg) if self.burningup then return end self.damage = (self.damage or 100) - dmg:GetDamage() if self.damage <= 0 then local rnd = math.random(1, 10) if rnd < 3 then self:BurstIntoFlames() else self:Destruct() self:Remove() end end end function ENT:Destruct() local vPoint = self:GetPos() local effectdata = EffectData() effectdata:SetStart(vPoint) effectdata:SetOrigin(vPoint) effectdata:SetScale(1) util.Effect("Explosion", effectdata) if IsValid(self:Getowning_ent()) then DarkRP.notify(self:Getowning_ent(), 1, 4, "Your " .. CONFIG.BronzePrinterName .. " has been destroyed!") end end local printTime = 1 local printDone = -1 function ENT:Think() local maxholdLVL = math.Round(CONFIG.BronzeCapacity) local printamountLVL = math.Round(CONFIG.BronzePrintAmount) local moneytakemaxhold = (self:GetMoneyAmount() - maxholdLVL) local interval = CONFIG.BronzePrintTime if CONFIG.BronzeCapacity > 0 then if self:GetMoneyAmount() < maxholdLVL then if(printDone < 0) then printDone = CurTime() + interval self:SetNWFloat("PrintDone", printDone) end if(CurTime() >= printDone ) then self:SetMoneyAmount(self:GetMoneyAmount() + printamountLVL) printDone = CurTime() + interval self:SetNWFloat("PrintDone", printDone) end elseif self:GetMoneyAmount() > maxholdLVL then self:SetMoneyAmount(self:GetMoneyAmount() - moneytakemaxhold) end elseif CONFIG.BronzeCapacity == 0 then if(printDone < 0) then printDone = CurTime() + interval self:SetNWFloat("PrintDone", printDone) end if(CurTime() >= printDone ) then self:SetMoneyAmount(self:GetMoneyAmount() + printamountLVL) printDone = CurTime() + interval self:SetNWFloat("PrintDone", printDone) end end end function ENT:Use(act , call) local money = self:GetMoneyAmount() self:SetMoneyAmount(0) call:addMoney(money) if money > 0 then DarkRP.notify(self:Getowning_ent(), 1, 4, "You have taken: " .. DarkRP.formatMoney(money) .. " from your " .. CONFIG.BronzePrinterName) end /*function ENT:StartSound() self.sound = CreateSound(self, Sound("ambient/levels/labs/equipment_printer_loop1.wav")) self.sound:SetSoundLevel(25) self.sound:PlayEx(1, 100) end*/ end function ENT:OnRemove() if self.sound then self.sound:Stop() end end [/CODE] [B][U]shared.lua[/U][/B] [CODE]ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Bronze Money Printer" ENT.Spawnable = true function ENT:SetupDataTables() self:NetworkVar("Int" , 0 , "MoneyAmount") self:NetworkVar("Int", 1, "PrintRate") self:NetworkVar("Entity", 2, "owning_ent") self:NetworkVar("Int", 3, "timer") end [/CODE] Basically when I spawn one printer of one type it works fine, when I spawn all 3 p
Sorry, you need to
Log In
to post a reply to this thread.