Raised This Month: $32 Target: $400
 8% 

[CS:GO] Detecting player death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 08-31-2017 , 16:45   [CS:GO] Detecting player death
Reply With Quote #1

Well, the question is simple:

What're your method(s) to detect ALL the deaths of a player?

When I say all, it means:
> Killed by another player.
> Suicide (Using "kill" for example).
> Killed by the bomb.
> ...

-----
OnTakeDamage / HookEvent("player_death") doesn't seem to detect everything. However a combination of both of them should do the trick.

I'm currently hooking "CCSPlayer::Event_Killed" (Linux offset: 71) with Dhooks, which seems to detect everything (Disadvantage: the offset can change because of a Valve update - but it shouldn't be all day ).

I would like to know if you have other reliable method(s) with or without Dhooks, to see what's available .
__________________
micapat is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-31-2017 , 17:02   Re: [CS:GO] Detecting player death
Reply With Quote #2

Whats wrong with a generic event hook?

https://wiki.alliedmods.net/Generic_...s#player_death
__________________
Neuro Toxin is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 08-31-2017 , 17:14   Re: [CS:GO] Detecting player death
Reply With Quote #3

For CS:GO - https://wiki.alliedmods.net/Counter-...s#player_death

I tested it, it doesn't detect the players killed by a bomb (The callback isn't called).

PHP Code:
public void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Post);
}

public 
void Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
PrintToChatAll("Event_PlayerDeath (%d)"GetClientOfUserId(event.GetInt("userid")));

__________________

Last edited by micapat; 08-31-2017 at 17:15.
micapat is offline
Starbish
AlliedModders Donor
Join Date: Oct 2011
Location: South Korea
Old 09-02-2017 , 01:15   Re: [CS:GO] Detecting player death
Reply With Quote #4

what about get a c4 entity id and treat it on OnTakeDamage
__________________
Starbish is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-02-2017 , 06:16   Re: [CS:GO] Detecting player death
Reply With Quote #5

[css] player death C4 explosion
https://forums.alliedmods.net/showthread.php?t=179830

Old topic... and code look funny.

SDKHook is better way to do it as @Starbish mentioned
__________________
Do not Private Message @me

Last edited by Bacardi; 09-02-2017 at 06:20.
Bacardi is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 09-02-2017 , 07:32   Re: [CS:GO] Detecting player death
Reply With Quote #6

Indeed, SDKHook_OnTakeDamage is good to detect deaths by players / bomb. Its only issue is to detect a suicide ("kill", "explode", switch_team, ...).
__________________
micapat is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-02-2017 , 07:48   Re: [CS:GO] Detecting player death
Reply With Quote #7

Quote:
Originally Posted by micapat View Post
Indeed, SDKHook_OnTakeDamage is good to detect deaths by players / bomb. Its only issue is to detect a suicide ("kill", "explode", switch_team, ...).
...you need check entity index, is attacker out of player indexs (entity > MaxClients)
Then you can look entity with GetEntityClassname is it planted_c4
__________________
Do not Private Message @me

Last edited by Bacardi; 09-02-2017 at 07:49.
Bacardi is offline
micapat
Veteran Member
Join Date: Feb 2010
Location: Nyuu, nyuu (France).
Old 09-02-2017 , 07:52   Re: [CS:GO] Detecting player death
Reply With Quote #8

lol yes I know, no issue here like I said in #6 to detect player deaths by another entity (player, bomb...) using SDKHook_TakeDamage. The issue is that it doesn't detect everything, aka death by the commands "kill", "explode", switch team (--> Suicide)...
__________________
micapat is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-02-2017 , 07:59   Re: [CS:GO] Detecting player death
Reply With Quote #9

Indeed.
You maybe can handle OnTakeDamagePost, then check is player alive.
If player is still alive, use RequestFrame to check again.

*...I'm going to quick look this later, will it work
__________________
Do not Private Message @me

Last edited by Bacardi; 09-02-2017 at 08:01.
Bacardi is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-02-2017 , 09:40   Re: [CS:GO] Detecting player death
Reply With Quote #10

*indeed not recognize suicide command....


Check this
Spoiler
__________________
Do not Private Message @me

Last edited by Bacardi; 09-02-2017 at 10:58.
Bacardi is offline
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 15:14.


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