Raised This Month: $ Target: $400
 0% 

Call function on players death?!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
V I R U S
Senior Member
Join Date: Jul 2004
Location: Russia / Germany
Old 07-20-2008 , 15:08   Call function on players death?!
Reply With Quote #1

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

Last edited by V I R U S; 07-20-2008 at 15:15.
V I R U S is offline
Send a message via ICQ to V I R U S
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-20-2008 , 15:20   Re: Call function on players death?!
Reply With Quote #2

Here's some functions :
PHP Code:
public client_death(attackervictim
PHP Code:
register_event("DeathMsg""fwd_Client_Killed""a"); 
PHP Code:
RegisterHam(Ham_Killed"player""fwd_Ham_Killed_post"1); 
__________________
atomen is offline
Send a message via MSN to atomen
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-20-2008 , 15:28   Re: Call function on players death?!
Reply With Quote #3

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

Last edited by Arkshine; 07-20-2008 at 15:32.
Arkshine is offline
V I R U S
Senior Member
Join Date: Jul 2004
Location: Russia / Germany
Old 07-20-2008 , 16:55   Re: Call function on players death?!
Reply With Quote #4

In this case : public client_death ( killer, victim, wpnindex, hitplace, TK )
can it be used as layer ID ?!
__________________
V I R U S is offline
Send a message via ICQ to V I R U S
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 07-21-2008 , 04:42   Re: Call function on players death?!
Reply With Quote #5

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);

__________________

anakin_cstrike is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-21-2008 , 11:33   Re: Call function on players death?!
Reply With Quote #6

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

Last edited by Bugsy; 07-21-2008 at 11:39.
Bugsy is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 07-21-2008 , 12:01   Re: Call function on players death?!
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
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.
__________________
atomen is offline
Send a message via MSN to atomen
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-21-2008 , 21:44   Re: Call function on players death?!
Reply With Quote #8

Any benefits for using hamsandwich?
__________________
Bugsy is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 07-21-2008 , 21:57   Re: Call function on players death?!
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
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.
danielkza is offline
V I R U S
Senior Member
Join Date: Jul 2004
Location: Russia / Germany
Old 11-05-2008 , 19:00   Re: Call function on players death?!
Reply With Quote #10

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...
__________________
V I R U S is offline
Send a message via ICQ to V I R U S
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 05:39.


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