Item pick up needing help!

ok so i have a entity here and im trying to make it pick up then put it in your inventory

init.lua


AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include( "shared.lua" )

function ENT:Initialize()
	self.Entity:SetModel( getItems( self:GetNWString("itemName") ).model )
	
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.Entity:SetUseType(SIMPLE_USE)
	local phys = self.Entity:GetPhysicsObject()
	if phys and phys:IsValid() then phys:EnableGravity(true) phys:Wake() end
end

function ENT:SetItemName( name )
	self.itemName = name
end

function ENT:Use( activator, caller )
	getItems( self:GetNWString("itemName") ).use(activator, self)
end

function ENT:Touch( ent )
end

function ENT:OnRemove()
end

function ENT:Think()
end

cl_init.lua


include("shared.lua")

function ENT:Think()
end

function ENT:Draw()
	self:DrawModel()
end

shared.lua


ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.PrintName = "item"
ENT.Author = "xrayhunter"

Wouldn’t you use the ENT:Touch hook and run what you want in there. Since it returns the entity touching you can do something like this:
[lua]function ENT:Touch( ent )
if ( !ent:IsPlayer() ) then return end
– If the item is a weapon:
ent:Give( self:GetClass() )
– Then remove the entity
self:Remove()
end[/lua]

well i dont want my players running around and then you get items and you didn’t want them and there
inventory is full do you get i mean?

Ah, sorry, I can’t read.

by the way this is unsolved! guys so try to help i still have the same code from last time
init.lua:



AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include( "shared.lua" )

function ENT:Initialize()
	self.Entity:SetModel( getItems( self:GetNWString("itemName") ).model )
	
	self.Entity:PhysicsInit(SOLID_VPHYSICS)
	self.Entity:SetMoveType(MOVETYPE_VPHYSICS)
	self.Entity:SetSolid(SOLID_VPHYSICS)
	self.Entity:SetUseType(SIMPLE_USE)
	local phys = self.Entity:GetPhysicsObject()
	if phys and phys:IsValid() then phys:EnableGravity(true) phys:Wake() end
end

function ENT:SetItemName( name )
	self.itemName = name
end

function ENT:Use( activator, caller )
	getItems( self:GetNWString("itemName") ).use(activator, self)
end

function ENT:Touch( ent )
end

function ENT:OnRemove()
end

function ENT:Think()
end


cl_init.lua:



include("shared.lua")

function ENT:Think()
end

function ENT:Draw()
	self:DrawModel()
end


shared.lua:



ENT.Type = "anim"
ENT.Base = "base_entity"
ENT.PrintName = "item"
ENT.Author = "xrayhunter"


So what exactly is the problem? Does the entity not spawn? Does it not give people stuff?

making it not just go to your weapon bar in stand it goes to your inventory