Raised This Month: $7 Target: $400
 1% 

Solved Detect if player killed by water ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-15-2018 , 05:49   Detect if player killed by water ?
Reply With Quote #1

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

Last edited by abdobiskra; 02-16-2018 at 04:28.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-15-2018 , 06:19   Re: Detect if player killed by water ?
Reply With Quote #2

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.
__________________

Last edited by HamletEagle; 02-15-2018 at 06:20.
HamletEagle is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-15-2018 , 07:47   Re: Detect if player killed by water ?
Reply With Quote #3

What do you mean by "by water"? Drowning?
__________________
klippy is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 02-15-2018 , 08:27   Re: Detect if player killed by water ?
Reply With Quote #4

Quote:
Originally Posted by HamletEagle View Post
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.
__________________
Relaxing is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-15-2018 , 08:35   Re: Detect if player killed by water ?
Reply With Quote #5

Quote:
Originally Posted by KliPPy View Post
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"
}
__________________

Last edited by abdobiskra; 02-15-2018 at 09:04.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-15-2018 , 09:54   Re: Detect if player killed by water ?
Reply With Quote #6

Quote:
Originally Posted by Relaxing View Post
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.
__________________

Last edited by HamletEagle; 02-15-2018 at 09:54.
HamletEagle is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 02-16-2018 , 04:28   Re: Detect if player killed by water ?
Reply With Quote #7

thank you all !
__________________
abdobiskra is offline
Send a message via Skype™ to abdobiskra
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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