• Why my entity is not showing in Q menu?
    2 replies, posted
Hi guys, i started scripting in Lua recently and i have problem with creating the entity: [B]path: \Steam\steamapps\common\GarrysMod\garrysmod\lua\entities\testent[/B] shared.lua: [CODE] ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "TestEntity" ENT.Spawnable = true ENT.Category = "Fun+Games" [/CODE] init.lua [CODE]AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel("models/props_interiors/BathTub01a.mdl") self:PhysicsInit(SOLID_VPHYSICS) self:SetMoveType(MOVETYPE_VPHYSICS) self:SetSolid(SOLID_VPHYSICS) self:SetColor(Color(0, 255, 0)) local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end end [/CODE] cl_init.lua [CODE]function ENT:Draw() self:DrawModel() end [/CODE]
You didn't incude shared.lua in cl_init.lua, which makes ENT.Spawnable = true on client which is what's necessary for it to appear in the spawnlist.
I believe your client file also needs to include the shared file. Are you able to spawn the entity using other means? For example using the ent_create console command. Edit: Ninja'd like the bitch i am.
Sorry, you need to Log In to post a reply to this thread.