AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Find out when an entity is created. (https://forums.alliedmods.net/showthread.php?t=49429)

Ramono 01-03-2007 20:06

Find out when an entity is created.
 
My first tought was:
Code:
register_forward(FM_CreateNamedEntity,"createent")
But this doesnt seem to return the id of the entity that is being created.

Does anyone knows a way to do this?



Thanks,

Ramono

Orangutanz 01-03-2007 23:18

Re: Find out when an entity is created.
 
What about FM_CreateEntity?

sawce 01-03-2007 23:23

Re: Find out when an entity is created.
 
Code:

/* Returns the original return value of an engine function.
 * This is only valid in forwards that were registered as post.
 *
 * get_orig_retval() - no params, retrieves integer return value
 * get_orig_retval(&Float:value) - retrieves float return value by reference
 * get_orig_retval(value[], len) - retrives string return value
 */
native get_orig_retval({Float,_}:...)

Could either do that (inside of createnamedentity/createentity post calls), or hook createnamedentity/createentity, supercede it, create your own entity, and force that return value, but thats kinda bad to do incase other plugins are looking for those forwards to get return values too.

Ramono 01-04-2007 09:47

Re: Find out when an entity is created.
 
Quote:

Originally Posted by Orangutanz (Post 423407)
What about FM_CreateEntity?

Doesnt return the value either :(

Quote:

Originally Posted by sawce (Post 423410)
Code:

/* Returns the original return value of an engine function.
 * This is only valid in forwards that were registered as post.
 *
 * get_orig_retval() - no params, retrieves integer return value
 * get_orig_retval(&Float:value) - retrieves float return value by reference
 * get_orig_retval(value[], len) - retrives string return value
 */
native get_orig_retval({Float,_}:...)

Could either do that (inside of createnamedentity/createentity post calls), or hook createnamedentity/createentity, supercede it, create your own entity, and force that return value, but thats kinda bad to do incase other plugins are looking for those forwards to get return values too.

It returns "0"

Edit: it does work, forgot to set post to 1 :)

++k to both


All times are GMT -4. The time now is 22:29.

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