AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Call function on players death?! (https://forums.alliedmods.net/showthread.php?t=74533)

V I R U S 07-20-2008 15:08

Call function on players death?!
 
Hi all!

I need some help in code for:

Call a function for player who was dead. So if player "MegaKiller" was dead, call a function to update some data for him f.e his deaths.

I found that: http://www.amxmodx.org/funcwiki.php?go=func&id=898

but don't get how to bring it to work for me... How to read only the Victim name??? If i set it like public client_death(id) it reads only Killername..


Thanx for any help!

atomen 07-20-2008 15:20

Re: Call function on players death?!
 
Here's some functions :
PHP Code:

public client_death(attackervictim

:arrow:
PHP Code:

register_event("DeathMsg""fwd_Client_Killed""a"); 

:arrow:
PHP Code:

RegisterHam(Ham_Killed"player""fwd_Ham_Killed_post"1); 


Arkshine 07-20-2008 15:28

Re: Call function on players death?!
 
Small error, atomen :

Code:
public client_death ( killer, victim, wpnindex, hitplace, TK )

Also, CSX or DoDX or TFCX module is required with this forward.


About 'DeathMsg', see more informations here :http://wiki.amxmodx.org/Half-Life_1_...vents#DeathMsg

About 'Ham_Killed', it requires Hamsandwich. Params for this forward : ( id_victim, id_attacker, shouldgib)

V I R U S 07-20-2008 16:55

Re: Call function on players death?!
 
In this case : public client_death ( killer, victim, wpnindex, hitplace, TK )
can it be used as layer ID ?!

anakin_cstrike 07-21-2008 04:42

Re: Call function on players death?!
 
Is called when a player kills another player (not suicide)
Example:
PHP Code:

public client_death(killer,victim,wpnindex,hitplace,TK)
{
static 
kname[32],vname[32];
get_user_name(killer,kname,31);
get_user_name(victim,vname,31);

if(
wpnindex == CSW_DEAGLE// is weapon deagle ?
{
if(
hitplace == HIT_HEAD// is headshot ?
client_print(0,print_chat,"%s headshot %s with deagle !",kname,vname);
}
if(
killer == victim// suicide ?
client_print(0,print_chat,"%s suicide !",vname);



Bugsy 07-21-2008 11:33

Re: Call function on players death?!
 
Does using DeathMsg have any advantage\difference over client_death? (besides calling on worldspawn\suicide)

I currently have a plugin that count's each players kills\deaths and I am using DeathMsg and am now wondering if I should just use client_death.

atomen 07-21-2008 12:01

Re: Call function on players death?!
 
Quote:

Originally Posted by Bugsy (Post 656088)
Does using DeathMsg have any advantage\difference over client_death? (besides calling on worldspawn\suicide)

I currently have a plugin that count's each players kills\deaths and I am using DeathMsg and am now wondering if I should just use client_death.

I would use Hamsandwich way, but if you want to stick to something, I would use DeathMsg.

Bugsy 07-21-2008 21:44

Re: Call function on players death?!
 
Any benefits for using hamsandwich?

danielkza 07-21-2008 21:57

Re: Call function on players death?!
 
Quote:

Originally Posted by Bugsy (Post 656388)
Any benefits for using hamsandwich?

You can supercede the paramaters of the death event, cancel it, or anything you want. You can also register it for individual entities. Other than that, there are other interesting functions that can be hooked by ham-sandwich. If you can,try to use ham+fakemeta.

V I R U S 11-05-2008 19:00

Re: Call function on players death?!
 
Where can i read a bit more about Ham coding and it's events?!
Is it ok if i will use it like this:

PHP Code:

plugin_init..
... 
RegisterHam(Ham_Killed"player""fwd_Ham_Killed_post"1); 
  ...

public 
fwd_Ham_Killed_post(id)
{
... 
something with global id...


Will it work this way?! Cause i need this global ID...


All times are GMT -4. The time now is 05:39.

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