GameConnection::onDeath(%this,%sourceObject,%sourceClient,%damageType,%damageArea)
This - player who died
Source Object - projectile or player who killed you
Source Client - client who killed you
Damage Type - type of damage that killed you
Damage Area - "Body". All the time, for some reason.
Deaths by falling damage have no source object. Use this to detect the "X [slam] Y" deaths caused by shooting a rocket near somebody's feet and blasting them into a wall for a kill:
if(isObject(%player.lastpusher))
{
if(%player.lastpushtime - getSimTime() < 1000)
//player was thrown into a wall by someone
else
//player was thrown by someone, but too long ago to count as a kill
}
else
{
//player crashed into wall on his own
}
To stop all damage to a target, package/edit minigameCanDamage(%obj1,%obj2). Look at Team Deathmatch for an example, I detect various kinds of attacks and prevent team damage if Friendly Fire is off.