Quote:
Originally Posted by thEsp
Code:
#include <amxmodx>
#include <hamsandwich>
#define DMG_DROWN (1<<14)
public plugin_init()
{
#if AMXX_VERSION_NUM < 190
RegisterHam(Ham_TakeDamage, "player", "@CBasePlayer_TakeDamage");
#else
RegisterHam(Ham_TakeDamage, "player", "@CBasePlayer_TakeDamage", .specialbot = true);
#endif
}
@CBasePlayer_TakeDamage(pev, pevInflictor, pevAttacker, Float:flDamage, bitsDamageType)
{
if (bitsDamageType & DMG_DROWN)
{
user_kill(pev);
return HAM_SUPERCEDE;
}
return HAM_IGNORED;
}
Tested on map de_mon and works perfectly fine, but doesn't work on de_survivor (since you get hurt by a specific entity, not water).
|
Thank you very much. I appreciate it. But it seems this wont work for bots.
I tried to make one for bots based on yours, but I failed.
Code:
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "X"
#define AUTHOR "X"
#define VERSION "X"
#define DMG_DROWN 1<<14
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
RegisterHam( Ham_TakeDamage, "player", "damage" )
}
public damage(this, idinflictor, idattacker, Float:damage, damagebits)
{
if(damagebits & DMG_DROWN)
user_kill
}