• Printer Help...
    3 replies, posted
Hello everyone, I am having some big trouble with my printers I am creating and I cannot seem to find the fix. The error is saying I have a corrupt entity but I don't because you can find it there in the entities folder. [B] Error I get when trying to spawn printer -[/B] [CODE][ERROR] gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:546: Entity 'kyle_printer' does not exist or is not valid. 1. error - [C]:-1 2. defaultSpawn - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:546 3. callback - gamemodes/darkrp/gamemode/modules/base/sh_createitems.lua:606 4. callback - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:17 5. unknown - gamemodes/darkrp/gamemode/modules/chat/sv_chat.lua:206 6. unknown - lua/includes/modules/concommand.lua:54[/CODE] [B] Now for my code... located in addons/kyles_printers/lua/entities/kyle_printer[/B] [B]---cl_init.lua---[/B] [CODE]include("shared.lua") function ENT:Draw() self:DrawModel() local Pos = self:GetPos() local Ang = self:GetAngles() local owner = self.dt.owning_ent owner = (ValidEntity(owner) and owner:Nick()) or "unknown" surface.SetFont("HUDNumber6") local TextWidth = surface.GetTextSize("Kyle's Printer") local TextWidth2 = surface.GetTextSize(owner) Ang:RotateAroundAxis(Ang:Up(), 90) cam.Start3D2D(Pos + Ang:Up() * 11.5, Ang, 0.11) draw.WordBox(2, -TextWidth*0.5, -30, "Kyle's Printer", "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255)) draw.WordBox(2, -TextWidth2*0.5, 18, owner, "HUDNumber6", Color(140, 0, 0, 100), Color(255,255,255,255)) cam.End3D2D() end[/CODE] [B]---init.lua---[/B] [CODE]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/props_c17/consolebox01a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end self.sparking = false self.damage = 200 self.IsMoneyPrinter = true timer.Simple(5, self.CreateMoneybag, self) end function ENT:OnTakeDamage(dmg) if self.burningup then return end self.damage = self.damage - 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) Notify(self.dt.owning_ent, 1, 4, "Your Golden Money Printer has exploded!") end function ENT:Fireball() if not self:IsOnFire() then return end local dist = math.random(30, 300) -- Explosion radius self:Destruct() for k, v in pairs(ents.FindInSphere(self:GetPos(), dist)) do if not v:IsPlayer() and not v.IsMoneyPrinter then v:Ignite(math.random(5, 22), 0) end end self:Remove() end local function PrintMore(ent) if ValidEntity(ent) then ent.sparking = true timer.Simple(1, ent.CreateMoneybag, ent) end end function ENT:CreateMoneybag() if not ValidEntity(self) then return end if self:IsOnFire() then return end local MoneyPos = self:GetPos() local amount = 1000 if amount == 0 then amount = 1000 end DarkRPCreateMoneyBag(Vector(MoneyPos.x + 15, MoneyPos.y, MoneyPos.z + 15), amount) self.sparking = false timer.Simple(math.random(100, 150), PrintMore, self) end function ENT:Think() if not self.sparking then return end local effectdata = EffectData() effectdata:SetOrigin(self:GetPos()) effectdata:SetMagnitude(1) effectdata:SetScale(1) effectdata:SetRadius(2) util.Effect("Sparks", effectdata) end[/CODE] [B]---shared.lua---[/B] [CODE]ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Kyle's Printers" ENT.Author = "Kyle" ENT.Spawnable = true ENT.AdminSpawnable = true function ENT:SetupDataTables() self:DTVar("Int",0,"price") self:DTVar("Entity",1,"owning_ent") end[/CODE] Thanks! Please get back soon! (This is not my code by the way, I just set up the folders and am using the code as a base. Code can be found at [URL="https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9268.html"]https://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/index9268.html[/URL])
[QUOTE=Kyle_1337;50114335] [B]located in addons/kyles_printers/lua/entities/kyle_printer[/B] *big post*[/QUOTE] [img]http://i.imgur.com/CRRK8GC.png[/img] nice
[QUOTE=kaliii;50115688][img]http://i.imgur.com/CRRK8GC.png[/img] nice[/QUOTE] Will try, thank you.
[QUOTE=kaliii;50115688][img]http://i.imgur.com/CRRK8GC.png[/img] nice[/QUOTE] Also, I was trying to auto run categories and entities so that's why I didn't put it there.
Sorry, you need to Log In to post a reply to this thread.