If damaged teammate more then 100 or 50 HP, print a message
Hey guys, I did a script, just like the title says, and hooked it up as a HAM, and for some wierd reason, after g_IsStarted is being set to true, when someone shoots his teammate's leg, which is way less than 100 or 50 HP, it is printing both messages at the same time, and for some reason it detects that the damage the player did to his teammates (which is stored in g_LeftKills) is more than 100.... someone can see the bug?
PHP Code:
PHP Code:
|
Re: If damaged teammate more then 100 or 50 HP, print a message
What is the value of damage when you shoot him in the leg? What is the value of g_LeftKills[killer] when you shoot him in the left (before adding damage)?
Also, the damage variable is a float so you must treat it as such (meaning that g_LeftKills must be declared as float) and you must compare to floats and not integers (100.0 instead of 100). You could also consider http://www.amxmodx.org/funcwiki.php?go=func&id=896 |
Re: If damaged teammate more then 100 or 50 HP, print a message
also use
set ham param float. to set damage to 0 if you dchange the value of damage you need to return HAM_SUPERCEDE or OVERRIDE. |
Re: If damaged teammate more then 100 or 50 HP, print a message
@fysiks - at public client_connect g_LeftKills[id] is being set to 0, besides, there's no place in the code where the leftkills is being set (except 0) besides the "tk" public. And I'll make sure to treat all its values to floats.
@Doc-Holiday, I really dont know that much in Ham, can you please expand more about what were you trying to say? I didn't understand what were you trying to tell me. |
Re: If damaged teammate more then 100 or 50 HP, print a message
Quote:
|
Re: If damaged teammate more then 100 or 50 HP, print a message
Use client_damage csx forward, will make your life easier and you will get correct damage value (it is not the case with TakeDamage forward unless you hook it post and you retrieve dmg_take value)
|
Re: If damaged teammate more then 100 or 50 HP, print a message
I swear I debugged, fysiks, didn't help. and Connor, im really confused of your post, and you expand and explain?
|
Re: If damaged teammate more then 100 or 50 HP, print a message
So what you do, is suggesting me, to use public client_damage instead of the registerham? and that it'll return the correct value of damage?
Edit: is the value of damage in client_damage equals to float aswell? |
| All times are GMT -4. The time now is 03:28. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.