• Timer issues on Entity
    0 replies, posted
Okay so I'm having an issue with my entity. I made a timer on it when the entity spawns on the map. This timer is paused as soon as it is created so that it doesn't repeat forever. In the Ent:Think I made it so that it would unpause the timer. This isn't working for some reason. This is my code. [CODE]AddCSLuaFile( "cl_init.lua" ) -- Make sure clientside AddCSLuaFile( "shared.lua" ) -- and shared scripts are sent. include('shared.lua') function ENT:Initialize() self:SetModel( "models/props_borealis/bluebarrel001.mdl" ) self:SetSolid( SOLID_VPHYSICS ) -- Toolbox local phys = self:GetPhysicsObject() if phys:IsValid() then phys:Wake() end timer.Create( "flag" .. self:EntIndex(), 5, 0, function() MsgN( "capped" ) end) timer.Pause( "flag" .. self:EntIndex() ) end function ENT:Use( activator, caller ) return end function ENT:Think() for k,v in pairs( ents.FindInSphere( self:GetPos(), 100 ) ) do if v:IsValid() and v:IsPlayer() then timer.UnPause( "flag" ..self:EntIndex() ) if v:Team() == 3 then MsgN(v:Team() .. "can not capture the flag!") end end end end[/CODE] I don't see what I did wrong. Maybe it's just a small overlooked thing. Any help would be greatly appreciated. Thanks!
Sorry, you need to Log In to post a reply to this thread.