• Wierd model problem
    2 replies, posted
I started learning lua today, so I might not understand many terms, so if you answer please explain how and what things do and how to use them. I am getting this error with my code: ERROR: Can't draw studio model models/props_c17/oildrum001.mdl because CBaseEntity is not derived from C_BaseAnimating init.lua: [code] AddCSLuaFile( "cl_init.lua" ) AddCSLuaFile( "shared.lua" ) include('shared.lua') ENT.AutomaticFrameAdvance = true ENT.Type = "point" AccessorFunc( ENT, "GunType", "Type" ) function ENT:KeyValue( key, value ) if ( key == "Type" ) then self:SetType( value ) end end function ENT:Initialize() self.Entity:PhysicsInit( SOLID_VPHYSICS ) self.Entity:SetMoveType( MOVETYPE_NONE ) self.Entity:SetSolid( SOLID_VPHYSICS ) self.Entity:SetModel("models/props_c17/oildrum001.mdl") if self:GetType() == "handgun" then self.Entity:SetColor(255, 255, 0, 255) end if self:GetType() == "rifle" then self.Entity:SetColor(255, 0, 255, 255) end if self:GetType() == "shotgun" then self.Entity:SetColor(0, 255, 255, 255) end if self:GetType() == "smg" then self.Entity:SetColor(255, 255, 255, 255) end print(spawntype) end function ENT:UpdateTransmitState() return TRANSMIT_ALWAYS end [/code] cl_init.lua: [code] include('shared.lua') function ENT:Draw() self.Entity:DrawModel() end [/code] shared.lua: [code]ENT.Type = "anim" ENT.PrintName = "mega deathmatch gunspawn" ENT.Author = "borisJake" ENT.Purpose = "For use in Mega Deathmatch" ENT.Spawnable = false ENT.AdminSpawnable = false [/code]
[code]ENT.Base = "base_anim"[/code] Need that in your shared. And take out the ENT.Type declaration in init.lua.
[QUOTE=Entoros;19961927][code]ENT.Base = "base_anim"[/code] Need that in your shared. And take out the ENT.Type declaration in init.lua.[/QUOTE] I love you.
Sorry, you need to Log In to post a reply to this thread.