Raised This Month: $ Target: $400
 0% 

[SC] Detect when monster_* is killed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rirre
Veteran Member
Join Date: Nov 2006
Old 04-21-2012 , 05:36   [SC] Detect when monster_* is killed
Reply With Quote #1

How can I use wildcard (*) in RegisterHam so it detect all killed monster_* entities by itself?
And prevent the message to spam/flood the players chat when a monster is killed and gibs.
This script flooding the chat if you kill a headcrab with the crowbar.

Also, execute server_cmd() when players receive every hundredths frags.
Code:
#include <amxmodx> #include <fakemeta> #include <hamsandwich>     public plugin_init () {     register_plugin( "Monster Frags", "1.0.0", "Rick" );     RegisterHam(Ham_Killed, "monster_zombie", "Monster_Killed", 1); } public Monster_Killed ( const Monster, const Killer ) {     if(is_user_alive( Killer ))     {         client_print( Killer, print_chat, "Monster Killed!");     } }

Last edited by Rirre; 04-21-2012 at 18:31.
Rirre is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 04-21-2012 , 06:37   Re: [SC] Detect when monster_* is killed
Reply With Quote #2

What's the entity name (not classname) ?

If, for example, the name is "info_target", you've to do that :

Code:
RegisterHam( Ham_Killed, "info_target", "Monster_Killed", 1 ); public Monster_Killed( monster, killer ) {      new szClassname[ 32 ];      pev( monster, pev_classname, szClassname, 31 );      if( equal( szClassname, "monster_", 8 ) && is_user_alive( killer ) )      {           client_print( killer, print_chat, "monster killed!" );      } }
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Rirre
Veteran Member
Join Date: Nov 2006
Old 04-21-2012 , 07:04   Re: [SC] Detect when monster_* is killed
Reply With Quote #3

Quote:
Originally Posted by Devil259 View Post
What's the entity name (not classname) ?

If, for example, the name is "info_target", you've to do that :

Code:
RegisterHam( Ham_Killed, "info_target", "Monster_Killed", 1 ); public Monster_Killed( monster, killer ) {      new szClassname[ 32 ];      pev( monster, pev_classname, szClassname, 31 );      if( equal( szClassname, "monster_", 8 ) && is_user_alive( killer ) )      {           client_print( killer, print_chat, "monster killed!" );      } }
monster_* is the entity.
Rirre is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 04-21-2012 , 13:33   Re: [SC] Detect when monster_* is killed
Reply With Quote #4

Ok so I don't know if you can hook Ham_* on non-existing entity.

Better to use RegisterHamFromEntity in your case.
__________________
You can do anything you set your mind to, man.


Last edited by Devil259; 04-21-2012 at 13:33.
Devil259 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 04-21-2012 , 16:54   Re: [SC] Detect when monster_* is killed
Reply With Quote #5

You can use RegisterHam, MonsterMod creates the entities as "func_wall" though. You can use Devil259's code, just replace "info_target" with "func_wall".
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Rirre
Veteran Member
Join Date: Nov 2006
Old 04-21-2012 , 18:27   Re: [SC] Detect when monster_* is killed
Reply With Quote #6

Quote:
Originally Posted by Emp` View Post
You can use RegisterHam, MonsterMod creates the entities as "func_wall" though. You can use Devil259's code, just replace "info_target" with "func_wall".
SC in the thread name means Sven Co-op.
So this is not for botman's MonsterMod.
Rirre is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 04-21-2012 , 18:58   Re: [SC] Detect when monster_* is killed
Reply With Quote #7

Quote:
Originally Posted by Devil259 View Post
Better to use RegisterHamFromEntity in your case.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
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 07:46.


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