Hey guys,
So i got a entity and i want to add a timer into the Initialize(). With this timer i want it to add like 1 point for every minite that the entity is spawned. Once the entity is alive for like 5 mins then i want to use the Use() and based on the timer's variable, i want to give the owner money. i tryed adding a variable to the timer in its function but it just gives me a nil value when i use the entity. Any help guys?
[code]function ENT:Initialize()
Use = false
timer.Simple(300, 1, function()
Use = true
end
end
-- all your other stuff
end
function ENT:Use( activator, caller )
if not Use then return else
if ( activator:IsPlayer() ) then
local money = activator:GetNWBool("money")
activator:SetMoney( money + 500 )
end
end
end
[/code]
Something like that
Sorry, you need to Log In to post a reply to this thread.