Author Topic: Detecting when a player is damaged  (Read 1132 times)

In a gamemode, I need to detect if a player is damaged, then increase the damager's score.
If the function for that is Armor::onDamage, then what are the arguments and what do they mean?
If not, then how do you detect damage?

Not going to tell you because you can literally search and find the args for the function.

Not going to tell you because you can literally search and find the args for the function.
I've already spent 15 minutes searching.
How does your post help? Also, I'm not a coding help topic spammer.
« Last Edit: May 16, 2013, 01:06:21 PM by hammereditor² »

From like 5 minutes research I would suggest you use Armor::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType)

I haven't worked with this function before but I assume %obj is what has been damaged and %sourceObject is what caused the damage.

Code: [Select]
package Bleh
{
function Armor::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType)
{
if(%obj.client.getClassName() $= "GameConnection")
{
if(%sourceObject.client.getClassName() $= "GameConnection")
%scourceObject.client.incscore(%damage);
}
return Parent::Damage(%this,%obj,%sourceObject,%position,%damage,%damageType);
}
};
activatepackage(Bleh);

If my assumption is correct that should add the amount of damage dealt to a player to the amount of points the person who caused the damage.
« Last Edit: May 17, 2013, 11:51:14 AM by Danny Boy »