Event when any player is shot by another player

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

Previous topic - Next topic

Anik

What about adding an event which will be called  when any player is shot by another player. I want it to prevent HP Hacks. Like Player1 shot Player2 but it didn't cause any damage to him. But he doesn't have any immunity or GodMode. So in order to prevent this we can do this by ourselves if the event is added. So it will be like this

onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )
And it will be more helpful if also weapon and body part is added. Like

onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor, wep, bodypart )

vito

It's already in client side. And this is not working with FPV.

Anik

Quote from: vito on Oct 12, 2016, 09:18 AMIt's already in client side. And this is not working with FPV.
But by whom it has been shot is not added. And also the HP and armour thingy.......

Xmair


Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

KAKAN

Quote from: Xmair on Oct 12, 2016, 02:39 PMI suggest you to read this again. http://forum.vc-mp.org/?topic=2719.msg20159#msg20159
Player::PlayerShoot(player, weapon, hitEntity, hitPosition)
It's there in the first spoiler. Check the type of hitEntity, if its an instance, send a stream to the server :D
oh no

Anik

Quote from: KAKAN on Oct 13, 2016, 05:37 AM
Quote from: Xmair on Oct 12, 2016, 02:39 PMI suggest you to read this again. http://forum.vc-mp.org/?topic=2719.msg20159#msg20159
Player::PlayerShoot(player, weapon, hitEntity, hitPosition)
It's there in the first spoiler. Check the type of hitEntity, if its an instance, send a stream to the server :D
That's okay but I want the oldHP and newHP. So that i can check if hp has decreased or not after shot.

 :edit: also it doesnt work for some weps like stubby, sniper. :/

vito

btw, use this checking only if hitPosition is "local player".

Anik

Quote from: vito on Oct 13, 2016, 10:48 AMbtw, use this checking only if hitPosition is "local player".
hitPosition returns VECTOR position.

vito


NicusorN5

QuotePlayer::PlayerShoot(player, weapon, hitEntity, hitPosition)
Parameter types: Player, int, entity, Vector. Return type: void.
Called when a player makes a shot. If something was hit, hitEntity points to that and hitPosition is the position of the collision. Otherwise, hitEntity is null and hitPosition is the end of the bullet trajectory.
-_-

Mötley

Maybe....
function onPlayerKill( Shotby, player, reason, bodypart )
{
   //Maybe you should store the players health/Armor in a timed array
    local oldHP = ...
    local newHP = ...
    local oldArmor = ...
    local newArmor = ...
    onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )

    return true;
}

function onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )
{
   /*Do It*/
   print("Did you do it?");

    return true;
}

Xmair

Quote from: Mötley on Oct 14, 2016, 12:08 AMMaybe....
function onPlayerKill( Shotby, player, reason, bodypart )
{
   //Maybe you should store the players health/Armor in a timed array
    local oldHP = ...
    local newHP = ...
    local oldArmor = ...
    local newArmor = ...
    onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )

    return true;
}

function onPlayerShot( player, Shotby, oldHP, newHP, oldArmor, newArmor )
{
   /*Do It*/
   print("Did you do it?");

    return true;
}
onPlayerKill is called when a player is killed by another player not shot.

Credits to Boystang!

VU Full Member | VCDC 6 Coordinator & Scripter | EG A/D Contributor | Developer of VCCNR | Developer of KTB | Ex-Scripter of EAD

Anik

What about if only CPlayer.LastHp and CPlayer.LastArmor is added?
Then we can compare between lasthp and current hp of the player.

KAKAN

Quote from: Anik on Oct 14, 2016, 11:09 AMWhat about if only CPlayer.LastHp and CPlayer.LastArmor is added?
Then we can compare between lasthp and current hp of the player.
Most shitty suggestion ever. You can do it pretty easily though
oh no

Anik

Quote from: KAKAN on Oct 14, 2016, 11:46 AM
Quote from: Anik on Oct 14, 2016, 11:09 AMWhat about if only CPlayer.LastHp and CPlayer.LastArmor is added?
Then we can compare between lasthp and current hp of the player.
Most shitty suggestion ever. You can do it pretty easily though
Show example