• Question about fire
    5 replies, posted
Is there a way i can keep checking if a player is on fire then put it out?
[url]http://wiki.garrysmod.com/page/Entity/IsOnFire[/url] [url]http://wiki.garrysmod.com/page/Entity/Extinguish[/url]
But how do i keep checking if they're on fire?
Think hook?
Example?
You could use a timer to check continuously: [lua] timer.Create( "FireExtinguisher", 2, 0, function() for k, v in pairs( players.GetAll() ) do if v:IsOnFire() then v:Extinguish() end end end ) [/lua] Or you could use the think hook: [lua] hook.Add( "Think", "FireExtinguisher", function() for k, v in pairs( players.GetAll() ) do if v:IsOnFire() then v:Extinguish() end end end ) [/lua]
Sorry, you need to Log In to post a reply to this thread.