Event when any player is shot by another player

Started by Anik, Oct 12, 2016, 08:53 AM

Previous topic - Next topic

Mötley

@Xmair, I told him to store the players health in a array while on the server..... I know this..
The Killer with God mode might still get away.

function onPlayerUpdate() if it exist in vcmp would help with this.

Either way if there were a onPlayerShot/ onClientShot function then it would be similar to

http://forum.liberty-unleashed.co.uk/index.php/topic,2070.0.html

DizzasTeR

local lastDamage = null;

function Player::PlayerShoot(player, weapon, hitEntity, hitPosition) {
    if( hitEntity && hitEntity == OBJ_PLAYER ) {
        local damaged_player = hitEntity;
        local shooting_player = player;
       
        if( !lastDamage ) {
            lastDamage = { Name = damaged_player.Name, HP = damaged_player.Health };
        }
        else {
            if( damaged_player.Name == lastDamage.Name && damaged_player.Health >= lastDamage.HP ) {
                // Same HP after getting shot
            }
        }
    }
}

Untested, and I just coded this to give you an idea how it can be done on client-side.