Damage player

Hello there.

Just wondering how I can drain health from another player.
I couldn’t find any information on how to do so.

Derp
niels22

Wrong Section.

Don’t sign your posts either.

What section then mr. derp.

Lua questions.

[lua]
function _R.Player.Damage(ply, int)

if int > ply:Health() or int == ply:Health() then

    ply:Kill()

else

    ply:SetHealth(ply:Health() - int)

end

end
[/lua]

FUNCTION: Player:Damage(int), damages a player with (“int”) as the amount of damage to inflict.

ALTERNATIVE: http://dreamboxstudios.co.uk/forums/index.php?topic=102

Or even http://maurits.tv/data/garrysmod/wiki/wiki.garrysmod.com/indexba9a.html?title=Entity.TakeDamageInfo