Raised This Month: $51 Target: $400
 12% 

Get the classname with FM_CreateEntity


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 07-02-2007 , 07:21   Get the classname with FM_CreateEntity
Reply With Quote #1

Code:
#include <amxmodx> #include <fakemeta> #define PLUGIN "ENTTEST" #define VERSION "1.0" #define AUTHOR "NL)Ramon(NL" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_forward(FM_CreateEntity, "CreateEntity",1) } public CreateEntity() {     new ent = get_orig_retval()     server_print("ent = %d",ent)     new classname[32]     pev(ent,pev_classname,classname,31) //<-- Error Line     server_print("Classname = %s",classname) }

For some reason this gives a error that the entity doesnt exists.
ent doesnt contain 0, looks like a normal entity number to me.
Can anyone help me out?

Thanks,
Ramon
__________________
Um, hi.
Ramono is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-02-2007 , 16:33   Re: Get the classname with FM_CreateEntity
Reply With Quote #2

I think you're trying to get the classname too early. The ent exists, but it hasn't been assigned a classname yet.

classname is assigned during one of the FM_KeyValue forwards I think. This happens after FM_CreateEntity.
stupok is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 07-02-2007 , 17:43   Re: Get the classname with FM_CreateEntity
Reply With Quote #3

k, thx

Any other way of hooking an entity and get the classname? (No not FM_CreateNamedEntity, wont work)
__________________
Um, hi.

Last edited by Ramono; 07-02-2007 at 18:49.
Ramono is offline
Ryu2877
Member
Join Date: Sep 2006
Location: China
Old 07-02-2007 , 23:27   Re: Get the classname with FM_CreateEntity
Reply With Quote #4

I thinks stupok69 had gave the method.

I also use "FM_KeyValue" to hook that & it work.

http://forums.alliedmods.net/showthread.php?t=47318
Ryu2877 is offline
Ramono
Veteran Member
Join Date: Nov 2005
Location: Netherlands
Old 07-03-2007 , 06:32   Re: Get the classname with FM_CreateEntity
Reply With Quote #5

This doesnt occur after the map is loaded, and the ent i want to hook is created by a player not while loading.
__________________
Um, hi.
Ramono is offline
stupok
Veteran Member
Join Date: Feb 2006
Old 07-03-2007 , 11:19   Re: Get the classname with FM_CreateEntity
Reply With Quote #6

The plugin he posted may not be what you're looking for, but FM_KeyValue is still what you should use instead of FM_CreateEntity if you want to grab the classname.
stupok 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 17:33.


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