Raised This Month: $ Target: $400
 0% 

register death event for everyone


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ngsucks
Member
Join Date: Jul 2004
Old 07-10-2004 , 19:01   register death event for everyone
Reply With Quote #1

I want to find out when someone dies on both ct and t. so i can make it so whn somoene dies, my hero gets health and money!

[edit] get_user_health and set_user_healtha nd all of that is suppose to have a cs infront, i know im just too lazy to go back and put it...[/edit]
for example


register_plugin() {

register_event( "Death", "wdeath", "b" );

return PLUGIN_CONTINUE;
}

public wdeath( wht do put here? ) {

new temp[6]
// First Argument is an id
read_argv(1,temp,5)
new id=str_to_num(temp)

set_user_health(get_user_health(id) + 25)
set_user_money(get_user_money(id) + 400)

return PLUGIN_CONTINUE;
}
__________________
Superhero's @ -{D.o}-
Custom Heroes
ip link: 209.123.8.21:27010

WWW.Frag-Wire.COM!
$30 dollars for a 16 player server!
ngsucks is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 07-10-2004 , 19:42  
Reply With Quote #2

register_event( "DeathMsg", "wdeath", "a" ); when you put b there this function won't be ever executed .

Code:
* Flags:
* "a" - global event.
* "b" - specified.
* "c" - send only once when repeated to other players.
* "d" - call if is send to dead player.
* "e" - to alive.
Code:
public wdeath(){
  // read killer and victim
  new killer = read_data(1) 
  new victim = read_data(2)

  if ( !killer || killer == victim)  // not valid kill , suicide 
    return PLUGIN_CONTINUE

  if ( get_uset_team(killer) == get_user_team(victim) ) // TK 
    return PLUGIN_CONTINUE

  // awards for killer
  set_user_health(get_user_health(killer) + 25) 
  cs_set_user_money(cs_get_user_money(victim) + 400) 
 
}
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
ngsucks
Member
Join Date: Jul 2004
Old 07-10-2004 , 21:12  
Reply With Quote #3

thanks ur the best!
problem, it says "function wdeath should return a value?

Code:
register_event( "DeathMsg", "wdeath", "a" );



public wdeath()
{ 
// read killer and victim 
new killer = read_data(1) 
new victim = read_data(2) 

if ( !killer || killer == victim) // not valid kill , suicide 
return PLUGIN_CONTINUE 

if ( get_user_team(killer) == get_user_team(victim) ) // TK 
return PLUGIN_CONTINUE 

// awards for killer 
set_user_health(killer, get_user_health(killer) + 25) 
set_user_money(killer, get_user_money(killer) + 400) 
}
but if i do this, it works:
Code:
public wdeath()
{ 
// read killer and victim 
new killer = read_data(1) 
//new victim = read_data(2)

// awards for killer 
set_user_health(killer, get_user_health(killer) + 25) 
set_user_money(killer, get_user_money(killer) + 400) 
}
__________________
Superhero's @ -{D.o}-
Custom Heroes
ip link: 209.123.8.21:27010

WWW.Frag-Wire.COM!
$30 dollars for a 16 player server!
ngsucks is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 07-11-2004 , 07:36  
Reply With Quote #4

Code:
public plugin_init(){
register_event( "DeathMsg", "wdeath", "a" ); 
}

public wdeath() 
{ 
// read killer and victim 
new killer = read_data(1) 
new victim = read_data(2) 

if ( !killer || killer == victim) // not valid kill , suicide 
return PLUGIN_CONTINUE 

if ( get_user_team(killer) == get_user_team(victim) ) // TK 
return PLUGIN_CONTINUE 

// awards for killer 
set_user_health(killer, get_user_health(killer) + 25) 
set_user_money(killer, get_user_money(killer) + 400) 

//more code here if you want

return PLUGIN_CONTINUE  // final return , end function
}
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
ngsucks
Member
Join Date: Jul 2004
Old 07-11-2004 , 16:56  
Reply With Quote #5

I love u, man....thanks

it works perfectly even though im unsure whts diff from whts he wrote before you.. can you tell me wht the difference was..


THANKS!
__________________
Superhero's @ -{D.o}-
Custom Heroes
ip link: 209.123.8.21:27010

WWW.Frag-Wire.COM!
$30 dollars for a 16 player server!
ngsucks is offline
Reply



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 14:46.


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