Dreft Posted November 8, 2019 Share Posted November 8, 2019 (edited) 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 November 8, 2019 by Dreft Link to comment
Addlibs Posted November 8, 2019 Share Posted November 8, 2019 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. Link to comment
Dreft Posted November 8, 2019 Author Share Posted November 8, 2019 Hmm, I check later what client side event returns for loss and is it different from client side.. Link to comment
Moderators IIYAMA Posted November 8, 2019 Moderators Share Posted November 8, 2019 (edited) 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 November 8, 2019 by IIYAMA Link to comment
Dreft Posted November 8, 2019 Author Share Posted November 8, 2019 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 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now