AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to detect when somebody suicides on acid? (https://forums.alliedmods.net/showthread.php?t=133778)

AfteR. 07-28-2010 19:11

How to detect when somebody suicides on acid?
 
Topic tittle.

Any idea?

Mxnn 07-28-2010 19:31

Re: How to detect when somebody suicides on acid?
 
You can register the touch between player and func_water that contents acid

AfteR. 07-29-2010 00:13

Re: How to detect when somebody suicides on acid?
 
Quote:

Originally Posted by Mxnn (Post 1254581)
You can register the touch between player and func_water that contents acid

I dont know how to do that :|

Can you help me? :)

Arkshine 07-29-2010 04:46

Re: How to detect when somebody suicides on acid?
 
Hook Ham_Killed and check the m_bitsDamageType offset (76) is DMG_ACID.

AfteR. 07-29-2010 23:48

Re: How to detect when somebody suicides on acid?
 
Quote:

Originally Posted by Arkshine (Post 1254922)
Hook Ham_Killed and check the m_bitsDamageType offset (76) is DMG_ACID.

Arkshine, unfortunately I know nothing about offsets, could you tell me how to do it?

RedRobster 07-30-2010 03:34

Re: How to detect when somebody suicides on acid?
 
PHP Code:

if(dmgbits DMG_ACID)
{
      
//Do what you want



Bugsy 07-30-2010 08:51

Re: How to detect when somebody suicides on acid?
 
Untested.
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

public plugin_init() 
{
    
RegisterHamHam_Killed "player" "fw_HamKilled" );
}

public 
fw_HamKillediVictim iKiller ShouldGib )
{
    const 
m_bitsDamageType 76;

    new 
iDmgBits get_pdata_intiVictim m_bitsDamageType );
    
    if ( 
iDmgBits DMG_ACID )
    {
        
//Player died from acid damage
    
}



AfteR. 07-30-2010 14:37

Re: How to detect when somebody suicides on acid?
 
Bugsy, it didn't work. Thanks anyway, I could solve it with this:

PHP Code:

#include <amxmodx>
#include <hamsandwich>

const DMG_ACID 76

public plugin_init()
{
    
    
RegisterHamHam_TakeDamage"player""HamTakeDamagePre")
}

public 
HamTakeDamagePrevicinfattFloat:dmgdmgbits )
{
    if( 
dmgbits DMG_ACID )
        return 
HAM_SUPERCEDE;
        
    return 
HAM_IGNORED;



Arkshine 07-30-2010 15:11

Re: How to detect when somebody suicides on acid?
 
You should have said from the start you wanted to block damage...

Bugsy 07-30-2010 16:22

Re: How to detect when somebody suicides on acid?
 
Exactly, you asked how to detect acid suicide (death), not block damage.

Use this instead
PHP Code:

return ( dmgbits DMG_ACID ) ? HAM_SUPERCEDE HAM_IGNORED



All times are GMT -4. The time now is 00:15.

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