AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Ham_Killed or client_death better? (https://forums.alliedmods.net/showthread.php?t=292318)

JoKeR LauGh 01-03-2017 12:39

Ham_Killed or client_death better?
 
Hello, as the title stated. I just wondering why most of the coders use Ham_Killed rather than csx's client_death forward? I am about to use client_death forward but I am afraid it may not be the best choice to detect a client has been killed and as I said just now, most coders use Ham_Killed which makes me think. Am I going to choose a bad decision if I pick client_death rather than the Ham_Killed forward now?

wickedd 01-03-2017 12:56

Re: Ham_Killed or client_death better?
 
Quote:

Originally Posted by JoKeR LauGh (Post 2483068)
Am I going to choose a bad decision if I pick client_death rather than the Ham_Killed forward now?

No

HamletEagle 01-03-2017 12:56

Re: Ham_Killed or client_death better?
 
You can use DeathMsg, Ham_Killed, client_death, all of them are fine. However, you have to know that client_death is called AFTER a player died, you can't block the event or change params.
Anyway, csx functions are not widely used, it's not a very popular module, I don't know why. On the other side, a lot of people know about hamsandwich, so I think this is why you see that one is more used than the other. Well, this, and the fact that ham hooks can be registered as pre/post and one can actually alter the forward.
Moreover, csx is only for cstrike, ham is working in other mods too.

Extra: ham is a module that hook functions from game. Ham_Killed is the function that is directly responsible for a player kill(CBasePlayer::Killed). From this function(well, not directly, but let's keep it simple) the DeathMsg message is send.
I'm telling this so you can see that all of them are reliable for detecting a kill, the only difference is the moment at which they are called.

JoKeR LauGh 01-03-2017 13:09

Re: Ham_Killed or client_death better?
 
Ah, I see. Seems Ham do cover even wider function. Thanks for the information, very useful for beginners to understand. Thank you, sir.

PRoSToTeM@ 01-03-2017 14:55

Re: Ham_Killed or client_death better?
 
DeathMsg isn't sent when player is killed by bomb.


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

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