Hi i am having trouble coding my entity it works fine but there's one problem.
you can spam E to get tons of money.
I want it so that you can press e every 5 seconds or so to get $5
i cant seem to find out how to use the timer.create script can someone help ?
I am also using self:SetUseType(SIMPLE_USE)
[CODE]function ENT:Use(activator,caller)
activator:AddMoney(5)
activator:SendLua("GAMEMODE:AddNotify(\"You Make $5 worth of illegal goods.\", NOTIFY_GENERIC, 2)")
self:EmitSound("npc/roller/mine/rmine_chirp_quest1.wav");
return
end[/CODE]
Where have you put self:SetUseType(SIMPLE_USE)?
Its here, the entity activates once when pressed but
id like it to be so that players can only use it for money every 5 seconds, etc
[CODE]function ENT:Initialize()
self:SetModel( "models/props_junk/PlasticCrate01a.mdl" )
self:PhysicsInit( SOLID_VPHYSICS ) -- Make us work with physics,
self:SetMoveType( MOVETYPE_VPHYSICS ) -- after all, gmod is a physics
self:SetSolid( SOLID_VPHYSICS ) -- Toolbox
self:SetUseType(SIMPLE_USE)
self.damage = 300
self.sparking = false
self.CanUse = true
local phys = self:GetPhysicsObject()
if (phys:IsValid()) then
phys:Wake()
end
end[/CODE]
bump
Sorry, you need to Log In to post a reply to this thread.