So as the title says my entity is unable to be colided with as in i can simply walk through it. Also i am unable to press use on it. The walking throuhg it doesn’t bug me as much as it not registering my use as i need it to register that for my gamemode to work how i intend it to.
init.lua
[lua]AddCSLuaFile(“cl_init.lua”)
AddCSLuaFile(“shared.lua”)
include(“shared.lua”)
function ENT:Initialize()
self.Entity:SetModel(“models/weapons/w_357.mdl”)
self.Entity:PhysicsInit(SOLID_VPHYSICS)
self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
self.Entity:SetSolid(SOLID_VPHSYICS)
local phys= self.Entity:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
print(“its awake”)
else
print(“its dead jim”)
end
self.Entity:GetPhysicsObject():EnableGravity(false)
timer.Simple(.01,function() self.Entity:SetPos(self.Entity:GetPos()+Vector(0,0,32)) end)
timer.Create(“spinit”…self.Entity:EntIndex(),.01,0,function() self.Entity:SetAngles(self.Entity:GetAngles()+Angle(0,1,0)) end)
end
function ENT:use(acti, caller)
local samecount= 0
for k,v in pairs(acti:GetWeapons()) do
if v:GetClass() == “better_pistol” then
samecount= samecount+1
end
end
if samecount>=1 then
acti:GiveAmmo(100,“Pistol”,true)
elseif #acti:GetWeapons()<2 then
acti:Give(“decent_pistol”)
else
acti:StripWeapon(acti:GetActiveWeapon():GetClass())
acti:Give(“decent_pistol”)
end
timer.Remove(“spinit”…self.Entity:EntIndex())
self.Entity:Remove()
end
function ENT:Think()
end[/lua]
cl_init.lua
[lua]include(“shared.lua”)
function ENT:Draw()
self.Entity:DrawModel()
end[/lua]
and last but not least shared.lua
[lua]ENT.Type= “anim”
ENT.Base= “base_gmodentity”
ENT.PrintName = “spinning starter pistol”
ENT.Author = “cloudwolf”
ENT.Contact= “not provided”
ENT.Purpose=“give people weapons and looking cool”
ENT.Instructions =“f*ck the instructions”[/lua]
Btw the ent flaots how high i want it and spins how i want it. It doesn’t give me any errors in console and i have no idea why its not working.