I am experimenting some with a timer.Simple and timer.Create.
I’ve been testing an entity that when used, activates Godmode by activator:GodEnable, removes itself then initiate a timer that when called disables the Godmode. The GodEnable works just perfectly fine, although the timer doesn’t seem to initiate.
Here is my current code in the init.lua
function ENT:Use(activator, caller)
activator:GodEnable()
self.Entity:Remove()
timer.Simple( 5, GodDisable )
end
the function GodDisable (I have put up in shared.lua, since it didn’t work in init.lua, and it doesn’t seem to work in shared.lua either. :P) gets called after 5 seconds.
ENT.Type = "anim"
ENT.Base = "base_gmodentity"
ENT.PrintName = "Adrenaline"
ENT.Author = "Test"
ENT.Category = "Chemical"
ENT.Spawnable = true
ENT.AdminSpawnable = true
function GodDisable(ply)
ply:GodDisable
end
I have tried numerous things, All doomed to fail.
Could anyone point me in the good direction? I’d be very thankful.