AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   un-killing Players (https://forums.alliedmods.net/showthread.php?t=57153)

purple_pixie 06-29-2007 08:04

un-killing Players
 
I'll try and keep this one as short as I can ...

I want a strength stat to adjust the damage dealt on hit.

I'm fairly sure I have extra damage working, and even killing player if this extra damage should take them to hp <= 0.
But I haven't really figured how I can get it so that if damage (without adjustment) would have killed player, but with the decreased damage would not kill them then the player should not be killed.

I'm not overly familiar with the events, but I'm pretty sure that when we get the client_damage() event, the client has already been damaged / killed, making this a fair bit of hassle ...

So is this at all easy to do?

(I don't think posting my code would actually help anyone, but if it would just say)

stupok 06-29-2007 14:51

Re: un-killing Players
 
You can only do this with the Ham Sandwich Module.

Here's an example:

Code:
#include <amxmodx> #include <hamsandwich> #define PLUGIN "Damage Half" #define VERSION "1.0" #define AUTHOR "stupok69" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         RegisterHam(Ham_TakeDamage, "player", "player_hurt") } public player_hurt(this, idinflictor, idattacker, Float:damage, damagebits) {     if(is_user_alive(idattacker))     {         damage *= 0.5 //half damage                 ExecuteHam(Ham_TakeDamage, this, idinflictor, idattacker, damage, damagebits)         return HAM_SUPERCEDE     }         return HAM_IGNORED }

purple_pixie 06-29-2007 19:13

Re: un-killing Players
 
Very handy - thank you.


All times are GMT -4. The time now is 21:25.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.