Ham_TakeDamage
Ok, here's the problem:
I have this code: PHP Code:
I'm sure you noticed that it's quite impossible for me to have made r0cc0 that much damage, but that is what the message returned. I have other mistakes with the code too, but nothing I can't handle so this is the main problem. Hope you help. |
Re: Ham_TakeDamage
That code isn't even close to what you'll need to simulate something like that.
http://forums.alliedmods.net/showthread.php?t=121028 You can work off of that, though there are improvements I will be making shortly to the code. None of the improvements are too significant, so you should just work off the code that's there. |
Re: Ham_TakeDamage
dmgPlayer needs to be defined as float. Also, accurate damage can be obtained with pev_dmg_take; the damage passed to ham takedamage is full damage without considering armor that the player may have.
|
Re: Ham_TakeDamage
Thanks for the info, I'll start changing my code right away.
|
Re: Ham_TakeDamage
Quote:
- You need to hook Ham_TakeDamage post because pev_dmg_take will not hold the damage value until then. You can also use an integer to store this damage value. - You will need a 2-dimension array so each players damage can be recorded for every other player. This array needs to be reset to 0 at each spawn (unless you want to store a cumulative value of damage, if so reset at client_disconnect). - You should retrieve a users name when he connects and store it a global array so you do not constantly need to retrieve their name. Try all of these revisions for yourself. Below is code with these fixes that you can refer to if you have problems. PHP Code:
|
Re: Ham_TakeDamage
Also, note that second param is not the weapon, but the attacker himself, except if it's nade, in that case it's the nade index.
|
| All times are GMT -4. The time now is 03:44. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.