Damages
#1

Hello,
This script is not working properly for some reason. Everytime I shoot someone, it gives back player's health/armor. It's supposed to take more damage when shot to head and default damage when shot to any other bodypart (e.g deagle takes 65 dmg to head and 45 dmg to other bodyparts). Anybody knows what's the problem? When I set only one damage value for a weapon (e.g case 24: damage = 45; ) then it works good.
Here's the code: http://pastebin.com/hamuRN4r
Reply
#2

Have you tried : OnPlayerTakeDamage(playerid, damagedid, Float:amount, weaponid, bodypart) instead of OnPlayerGiveDamage ?
Reply
#3

Yeah, but I'm not going to use it.
Reply
#4

Quote:
Originally Posted by GoldenLion
Посмотреть сообщение
Yeah, but I'm not going to use it.
why?
Reply
#5

Try using the ternary operator:
PHP код:
damage = (bodypart == 9) ? 30 20
Or, if you want to do it real easy for all weapons, you can multiply the damage by 1.5 after having established the base damage.
Reply
#6

Also when the target is in a vehicle it works good.

EDIT: Not anymore.
Reply
#7

Found the problem, I had a same script under OnPlayerTakeDamage for melee weapons, means I didn't have the guns' damages defined.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)