• How would I make primary fire heal a player?
    2 replies, posted
I'd really like to know. By the way, heal another player, not the one firing it.
[lua] local eyetrace = self.Owner:GetEyeTrace() local healAmount = 10 if( eyetrace.Hit && eyetrace.Entity:IsPlayer()) { math.Clamp(eyetrace.Entity:SetHealth(eyetrace.Entity:Health + healAmount),0,eyetrace.Entity:GetMaxHealth()) } [/lua] Untested and written inside the forum reply box but it should work
[lua] local ent = self.Owner:GetEyeTrace().Entity local heal = 10 if ValidEntity(ent) and ent:IsPlayer() then ent:SetHealth(math.Clamp(ent:Health()+heal,0,ent:GetMaxHealth())) end [/lua] Fixed quincy18's code (you got the right idea, but man the syntax, THE SYNTAX!!:byodood:)
Sorry, you need to Log In to post a reply to this thread.