Code:
-- Created by NoahtheBoah36 AKA Noah Engelmann
-- Redistribution/use/modification is allowed provided credit is given.
local ITEM = Clockwork.item:New();
ITEM.name = "Trap Test";
ITEM.model = "models/maxib123/chessboard.mdl";
ITEM.weight = 0.1;
ITEM.business = false;
ITEM.description = "DO NOT USE THIS ITEM.";
ITEM.category = "Junk";
--ITEM.spawnValue = 10;
--ITEM.spawnType = "junk";
ITEM.useText = "Scrap";
ITEM.batch = 1;
-- When the item is dropped.
function ITEM:OnDrop(player, position) end;
-- When the item is used.
function ITEM:OnUse(player, itemEntity)
local explode = ents.Create( "env_explosion" ) -- creates the explosion
explode:SetPos( eyetrace.HitPos ) -- this creates the explosion through your self.Owner:GetEyeTrace, which is why I put eyetrace in front
explode:SetOwner( self.Owner ) -- this sets you as the person who made the explosion
explode:Spawn() --this actually spawns the explosion
explode:SetKeyValue( "iMagnitude", "220" ) -- the magnitude
explode:Fire( "Explode", 0, 0 )
explode:EmitSound( "weapon_AWP.Single", 400, 400 ) -- the sound for the explosion, and how far away it can be heard
end;
ITEM:Register();
That's the above code of the item that isn't working. As you can see it's a test item but still, I need to get it to work before I can start applying it to other items. The purpose of the item is to explode the player when they use the item. The eventual application of this is to have certain items that are trap items, which look a lot like actual items, sometimes only being distinguishable when you use the examine command.
When I use the item, an error appears. I'm not sure if it's the item but its' appearance in the console appears to coincide with the usage (or, rather, attempted usage) of the item.
Code:
[HTML] http://forums.cloudsixteen.com/js/xenforo/xenforo.js?_v=073095e7:170: Uncaught TypeError: Property 'group' of object #<error> is not a function
Beyond the above, the only things to note really is that when I attempt to use the item, the item remains in my inventory and doesn't appear to do anything.
Edit: And yes I asked on Discord for some help but the people online at the time didn't know what to do so I figured I'd widen the net and ask on the forums.