Raised This Month: $ Target: $400
 0% 

Check if entity enters world


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-03-2007 , 00:06   Check if entity enters world
Reply With Quote #1

I am trying to find out when a new entity enters the world.

I thought pfn_spawn would work but it turns out that isn't called in mid map

Example:
Code:
public pfn_spawn(entId) {     new className[64];     entity_get_string(entId, EV_SZ_classname, className, 63);         if(equali(className, "someClassName"))     {         // do something with entId entity     } }

I need something like that, but since pfn_spawn doesn't catch entities spawned in the middle of a map it doesn't work.
hlstriker is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 06-03-2007 , 00:16   Re: Check if entity enters world
Reply With Quote #2

You might be able to hook FM_CreateNamedEntity, but it won't work on entities created by Metamod, I believe.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-03-2007 , 00:58   Re: Check if entity enters world
Reply With Quote #3

Thanks for the info, it should work.

How do I find arguments out though to use with it? I've always needed to know that.
hlstriker is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 06-03-2007 , 01:06   Re: Check if entity enters world
Reply With Quote #4

Arguments to use with it?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
hlstriker
Green Gaben
Join Date: Mar 2006
Location: OH-IO!
Old 06-03-2007 , 01:29   Re: Check if entity enters world
Reply With Quote #5

I'm not really familiar with FM, don't I have to register a forward to it then use some arguments?

I really don't even know what I'm talking about lol...

Can you explain how I would use that please?
hlstriker is offline
regalis
Veteran Member
Join Date: Jan 2007
Location: F*cking Germany
Old 06-03-2007 , 07:49   Re: Check if entity enters world
Reply With Quote #6

I'm not sure if this works...
*edit* don't work...*edit*
I wonder if the EntID is passed too and not only the classname..0o

greetz regalis
__________________

Last edited by regalis; 06-04-2007 at 02:08. Reason: removed not working code ;)
regalis is offline
P34nut
AMX Mod X Beta Tester
Join Date: Feb 2006
Location: Netherlands
Old 06-03-2007 , 08:00   Re: Check if entity enters world
Reply With Quote #7

Code:
#include <amxmodx> #include <fakemeta> public plugin_init() {     register_forward(FM_CreateNamedEntity, "fwCreateNamedEntity_post", 1) } public fwCreateNamedEntity_post(iClassname) {     static ent, szClassname[32]     ent = get_orig_retval()         engfunc(EngFunc_SzFromIndex, iClassname, szClassname, 31)         if (equal(szClassname, "MYCLASSNAME"))     {         // Do Something     } }
__________________
All you need to change the world is one good lie and a river of blood
P34nut is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 06-03-2007 , 11:00   Re: Check if entity enters world
Reply With Quote #8

Quote:
Originally Posted by XxAvalanchexX View Post
You might be able to hook FM_CreateNamedEntity, but it won't work on entities created by Metamod, I believe.
Just out of curiosity, how not?
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 06-03-2007 , 11:30   Re: Check if entity enters world
Reply With Quote #9

In my opinion Ham_Spawn hook should work for all entities that is created by the mod. And for ones that is spawned by mm/amxx/plugins. Shouldn't work for custom entities that isn't spawned.
VEN is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 06-03-2007 , 12:48   Re: Check if entity enters world
Reply With Quote #10

Quote:
Originally Posted by Zenith77 View Post
Just out of curiosity, how not?
I'm pretty sure that Metamod (and all of its plugins, so AMXX and AMXX's plugins), can't (or won't) hook functions called by itself.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 10:35.


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