How to intercept amount of damage?
How do you intercept the amount of damage that is about to be substracted from the receivers health and modify it?
|
you can modify bullet damage..
you can give players back the health they lose. dont know if thats what you want.. |
Actually yes.
At the moment I dont care what inflicts damage and how. I just want to intercept the amount of damage (caused by whatever) that is about to be substracted from the players health and modify it. How would you do that? |
if u dont want to add health back later on (coz the player could die before that :) ), u can directly modify the damage:
Code:
that should reduce the damage made to third of the original :o |
I see!!!
That gives me something to work with. Thanks! ++karma ; |
I see 2 flaws.
1. Damage caused by something else than weapons (gravity) isn't indicated. 2. The new health has also already been set. 2.1. Your Code:
There doesn't seem to be a way to do what I want to do. |
hmm.. events registered with register_message() are called just before they occur, so i dont see why modifying the damage doesnt work :?
although changing damagetype to something else works the function does get called for me when i fall, except when dmg >= health (the player dies, so thats another wrong assumption by me) also seems that the event cant even be blocked with PLUGIN_HANDLED, which is even more weird.. i just thought hooking it with register_message() would be as simple as any other message, guess i was wrong, sry :( |
Quote:
|
Quote:
Just too bad that this isnt possible. Is there a way to realize that through different module code? I mean writing a module that allows to do what I want to do? If yes, where am I gonna find a good introduction tutorial to module coding? If no, where am I gonna find it anyway? :D EDIT: Nvm my last 2 questions. Looks like the guide in the docs is pretty good. :oops: :D |
The only way I was able to intercept damage when I needed to was by setting every person's HP to 1024, and then working with their HP. This means that if you want them dead, you can just add some code that's basically like:
Code:
Or whatever. You can also reset their HP to 1024 every time they get hit. Or you can check if their HP is: Code:
You'll have to use messages to let clients know that they didn't just suicide. |
| All times are GMT -4. The time now is 05:12. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.