AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Detect if player killed by water ? (https://forums.alliedmods.net/showthread.php?t=305310)

abdobiskra 02-15-2018 05:49

Detect if player killed by water ?
 
Hello, I hope everyone is fine.
Is there a way to Detect if player killed by water ?

HamletEagle 02-15-2018 06:19

Re: Detect if player killed by water ?
 
Hook Ham_Killed and check for pev_waterlevel > 0. I don't think player can not be in water if he was killed by water.

klippy 02-15-2018 07:47

Re: Detect if player killed by water ?
 
What do you mean by "by water"? Drowning?

Relaxing 02-15-2018 08:27

Re: Detect if player killed by water ?
 
Quote:

Originally Posted by HamletEagle (Post 2578291)
Hook Ham_Killed and check for pev_waterlevel > 0. I don't think player can not be in water if he was killed by water.

That will also count when he got killed by an enemy underwater.
He wants to catch when player takes DMG_DROWN damage.

abdobiskra 02-15-2018 08:35

Re: Detect if player killed by water ?
 
Quote:

Originally Posted by KliPPy (Post 2578297)
What do you mean by "by water"? Drowning?

exactly
I want to give the pressure of the button the floods water frags (This means that the victims of drowning are returning frag to the pressure of the button)
here video It shows the button and the flood of water :
https://youtu.be/qgUN-yOPo_0?t=114

i try this :


PHP Code:

new killer;

public 
plugin_init()
{
    
RegisterHam(Ham_Use"func_button""fw_UseStaticonary")
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled");
    
killer 0;
}
public 
fw_UseStaticonary(entitycalleractivatoruse_type){
    
    if(
is_user_connected(caller))
    {
        new 
find_ent_by_target(-1"watertrap_mm");// undertow map
        
        
if (entity == )
        {
            
server_print("*** entity == n ** ")
            
            if (
is_user_alive(caller))
            {
                
killer caller;
                new 
name[32];
                
get_user_name(killername31);
                
server_print("=======^nkiller = %s^n=======")
            }

        }
    }
    return 
HAM_IGNORED
}

public 
fw_PlayerKilled(id,ent){
    

    new 
s_TargetName[32]
    
peventpev_targetnames_TargetNamecharsmaxs_TargetName ))
    
    static 
classname[32]
    
entity_get_string(ent,EV_SZ_classname,classname,31)
        
    if(!
equal(classname,"worldspawn") && !equal(s_TargetName,"bigwater"))
        return 
HAM_IGNORED
        
    
if(is_user_connected(killer))
    {
        
SetHamParamEntity(2,killer)// set killer ID
        
client_print(killerprint_chat"*** You killed Successfully!")
            
    }
    return 
HAM_IGNORED


but it coming like that :
Quote:

abdobiskra killed test_player with worldspawn
But I want to determine exactly that he killed him with water not worldspawn.
Because if any victim dies with wordspawn will be counted for him frags (ex: fall die)

and here the setting in the map undertow :
Quote:

{
"model" "*19"
"rendercolor" "255 0 0"
"renderfx" "0"
"targetname" "bigwater"
"skin" "-3"
"unlocked_sentence" "0"
"locked_sentence" "0"
"unlocked_sound" "0"
"locked_sound" "0"
"health" "0"
"dmg" "0"
"lip" "332"
"wait" "4"
"stopsnd" "6"
"movesnd" "1"
"speed" "50"
"renderamt" "64"
"rendermode" "2"
"spawnflags" "32"
"angle" "-1"
"classname" "func_water"
}

HamletEagle 02-15-2018 09:54

Re: Detect if player killed by water ?
 
Quote:

Originally Posted by Relaxing (Post 2578299)
That will also count when he got killed by an enemy underwater.
He wants to catch when player takes DMG_DROWN damage.

Right, did not think about that. Then hooking TakeDamage and checking user health + DMG_DROWN should work.

abdobiskra 02-16-2018 04:28

Re: Detect if player killed by water ?
 
thank you all !


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

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