AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CS:GO] Detecting player death (https://forums.alliedmods.net/showthread.php?t=300839)

micapat 08-31-2017 16:45

[CS:GO] Detecting player death
 
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 :bee:).

I would like to know if you have other reliable method(s) with or without Dhooks, to see what's available :bacon!:.

Neuro Toxin 08-31-2017 17:02

Re: [CS:GO] Detecting player death
 
Whats wrong with a generic event hook?

https://wiki.alliedmods.net/Generic_...s#player_death

micapat 08-31-2017 17:14

Re: [CS:GO] Detecting player death
 
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")));



Starbish 09-02-2017 01:15

Re: [CS:GO] Detecting player death
 
what about get a c4 entity id and treat it on OnTakeDamage

Bacardi 09-02-2017 06:16

Re: [CS:GO] Detecting player death
 
[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

micapat 09-02-2017 07:32

Re: [CS:GO] Detecting player death
 
Indeed, SDKHook_OnTakeDamage is good to detect deaths by players / bomb. Its only issue is to detect a suicide ("kill", "explode", switch_team, ...).

Bacardi 09-02-2017 07:48

Re: [CS:GO] Detecting player death
 
Quote:

Originally Posted by micapat (Post 2545962)
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

micapat 09-02-2017 07:52

Re: [CS:GO] Detecting player death
 
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)...

Bacardi 09-02-2017 07:59

Re: [CS:GO] Detecting player death
 
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

Bacardi 09-02-2017 09:40

Re: [CS:GO] Detecting player death
 
*indeed not recognize suicide command....


Check this
Spoiler


All times are GMT -4. The time now is 18:19.

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