Entity takes damage, give player 1 star

Well, title explains it abit.

If player has 0 stars and does damage to a entity give him 1 star trough AddStars(1)
and if he already has 1 star, then return false.

So it will go like this:

player does damage to entity, give him 1 star if he does NOT have 1 already, elseif he has 1 star or more then dont do anything.

Should be simple, but I just cant find the function for entity taking damage.



You didn’t search very hard, did you? :v:

[lua]hook.Add( “EntityTakeDamage”, “someUniqueNameGoesHere”, function( target, inflictor, attacker, damage, info )
if attacker:IsPlayer() and attacker:GetStars() < 1 then
attacker:AddStars( 1 )
end )[/lua]

Well I found many founctions with Entities, but not that. Thanks :stuck_out_tongue: