All pastes #441337 Raw Edit

Unnamed

public lua v1 · immutable
·published 2007-04-15 17:04 UTC
rendered paste body
function SWEP:PrimaryAttack()	ent_trace = self.Owner:GetEyeTrace() -- make a trace from the player	ent_hit = ent_trace.Entity -- this is the entity we hit, if we hit anything at all		if( ent_hit:IsValid() and ent_hit:IsPlayer() ) then -- make sure our entity is fully valid and is a player		health = ent_hit:GetHealth() -- get their current health		heal_max = ent_hit:GetMaxHealth() -- get their max health, which is usually 100				newhealth = health + 10 -- our new health, you can change the value here				if( newhealth > heal_max ) then -- is our new health exceeding the max health?			ent_hit:SetHealth( heal_max ) -- set our health to our maximum		else -- our new health doesn't exceed the maximum			ent_hit:SetHealth( newhealth ) -- set health		end	end	end