• Addon not creating entity
    4 replies, posted
Here is the situation, i am creating my own addon and am putting MY addon folder in my gmod addons folder directly without making it a .gma My file structure goes like so Ammo_vendingMachine/ lua/ autorun and entities client and server(in autorun) Ammo_Machine(in entities) if more file structure info is needed i will provide Now comes the issue, the entity i have created in the entities folder (with the init.lua, cl_init.lua, and shared.lua) is not creating the entity i have provided in the code Init.lua AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel( "models/props_interiors/VendingMachineSoda01a.mdl" ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetUseType(SIMPLE_USE) local physics = self:GetPhysicsObject() if (physics:IsValid()) then physics:Wake() end shared.lua ENT.Type = "anim" ENT.Base = "base_gmodentity" ENT.PrintName = "Vending" ENT.Spawnable = true ENT.Category = "Ammo Vending Machine" cl_init.lua include("shared.lua") function ENT:Draw() self:DrawModel() end What errors am i making that restricts the addon from creating the entity in the q menu entities tab.
what's preventing it for loading is a scripting error, which you should've read in the console when you started up. you never end your ENT:Initialize() function.
The end is for the "if" statement that calls the entity to wake up if (physics:IsValid()) then physics:Wake() end Also i am not getting any errors showing up in console relating to my addon.
yes and your initialize function remains un-end-ed and yes there has to be an error saying something like "expected 'end' near <eof>"
AddCSLuaFile("cl_init.lua") AddCSLuaFile("shared.lua") include("shared.lua") function ENT:Initialize() self:SetModel( "models/props_interiors/VendingMachineSoda01a.mdl" ) self:PhysicsInit( SOLID_VPHYSICS ) self:SetMoveType( MOVETYPE_VPHYSICS ) self:SetSolid( SOLID_VPHYSICS ) self:SetUseType(SIMPLE_USE) local physics = self:GetPhysicsObject() if (physics:IsValid()) then physics:Wake() end function ENT:Use(caller, activator) print("someone Used me :(") end
Sorry, you need to Log In to post a reply to this thread.