• Give health to a player every second
    2 replies, posted
So I'm trying to use CurTime to give a player health every second for a swep. Not working... Current code: [lua] local time = {} time.curtime = CurTime() function SWEP:Deploy() self.Owner:SetHealth(math.ceil(self.Owner:Health() + (time.curtime - CurTime()))) end [/lua] Im trying to avoid using timers and stick to just curtime.
Why would you avoid using timers? Why would you create a table and then put CurTime in there?
1. Because timers are more cpu expensive than subtracting from curtime. 2. to index curtime at the time its deployed. Ive realized that deploy isn't called every frame so i had to settle with a timer.
Sorry, you need to Log In to post a reply to this thread.