I am currently developing an entity for a certain gamemode and I want to run a certain script when a player collides with said entity
So far, after writing my own code for this, the entity works fine and rotates, yet it fails to do anything in the “ENT:Touch” hook.
Here is what I have so far in the init.lua file:
[lua]
AddCSLuaFile( “cl_init.lua” )
AddCSLuaFile( “shared.lua” )
include(‘shared.lua’)
function ENT:Initialize()
self:SetModel( "models/props_junk/watermelon01.mdl" )
self:PhysicsInit( SOLID_VPHYSICS )
self:SetMoveType( MOVETYPE_NONE )
self:SetSolid( SOLID_NONE )
self:DrawShadow(true)
end
function ENT:Use( activator, caller )
return
end
function ENT:Think()
self:SetAngles( self:GetAngles() + Angle(0, 30, 0)
end
function ENT:StartTouch( ent )
if ( ent:IsValid() and ent:IsPlayer() ) then
print(“Melon get!”)
self:Remove()
end
end
[/lua]