Dreft

Real health loss(damage).

Recommended Posts

Hello.

Using onPlayerDamage(attacker, weapon, bodypart, loss), for example when I have 100hp and shot near me with rocket launcher, loss is 75, but if I have for example 50hp and shot rocket launcher, loss is 50(because thats how much HP I have). How to get same 75 loss/damage with low hp, because rocket launcher does that damage?

I know that loss could not be more than I have HP, but maybe there is a way to get real damage that weapon does despite HP I have 🙄

Edited by Dreft

Share this post


Link to post

Inspecting the source code, the server event onPlayerDamage only checks for a difference in last known health value and new health value from sync packets, and calculates a loss from that. Perhaps the client version, onClientPlayerDamage provides a more accurate damage HP but I haven't tested that, and the client side source is a little too complicated for me to trace what is exactly happening.

Share this post


Link to post

Hmm, I check later what client side event returns for loss and is it different from client side..

Share this post


Link to post
4 hours ago, Dreft said:

Hmm, I check later what client side event returns for loss and is it different from client side..

It is not possible based on health loss as you noticed. If you want this, you need to apply an overwrite.

For explosion you can cancel the explosion event. Replace the explosion with create createexplosion + damage disabled. After that calculate the damage based on the distance. Do this for players, peds and vehicles.

Weapon damage is a bit easier, just maintain a static damage value per weapon. (With custom conditions if you desire that).

Fire and fall damage are the only damage types that can't be managed very well.

 

 

Edited by IIYAMA

Share this post


Link to post
35 minutes ago, IIYAMA said:

It is not possible based on health loss as you noticed. If you want this, you need to apply an overwrite.

For explosion you can cancel the explosion event. Replace the explosion with create createexplosion + damage disabled. After that calculate the damage based on the distance. Do this for players, peds and vehicles.

Weapon damage is a bit easier, just maintain a static damage value per weapon. (With custom conditions if you desire that).

Fire and fall damage are the only damage types that can't be managed very well.

 

 

Ok, thanks for such detailed answer 👍 I,ll try my best :)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.