AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Get the classname with FM_CreateEntity (https://forums.alliedmods.net/showthread.php?t=57309)

Ramono 07-02-2007 07:21

Get the classname with FM_CreateEntity
 
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

stupok 07-02-2007 16:33

Re: Get the classname with FM_CreateEntity
 
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.

Ramono 07-02-2007 17:43

Re: Get the classname with FM_CreateEntity
 
k, thx

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

Ryu2877 07-02-2007 23:27

Re: Get the classname with FM_CreateEntity
 
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

Ramono 07-03-2007 06:32

Re: Get the classname with FM_CreateEntity
 
This doesnt occur after the map is loaded, and the ent i want to hook is created by a player not while loading.

stupok 07-03-2007 11:19

Re: Get the classname with FM_CreateEntity
 
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.


All times are GMT -4. The time now is 20:52.

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