AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   register_think in fakemeta (https://forums.alliedmods.net/showthread.php?t=46233)

commonbullet 10-21-2006 23:37

register_think in fakemeta
 
I suppose that hooking prethink forward and checking classname is not a good way to make it.. If engine’s register_think is better designed (I don’t know), is there a way to hook an entity think by classname that same way in fakemeta?

teame06 10-21-2006 23:55

Re: register_think in fakemeta
 
Code:
register_forward(FM_Think, "_FM_Think"); public _FM_Think(ent) {     static class[32];     pev(ent, pev_classname, class, 31);     if(equal("One Your checking", class))     {         // Do stuff     } }

Or if you know the ent index and the ent going to be there for awhile. Then I would just store the ent index and compare it.

commonbullet 10-22-2006 00:13

Re: register_think in fakemeta
 
Yep, I was trying to avoid checking classname because it envolves some extra processing; copying pev->classname into a string, and comparing... But since I need to do that with few entities, I'm may check the indexes instead.

Thank you.

XxAvalanchexX 10-22-2006 00:26

Re: register_think in fakemeta
 
Engine does it the same way: on entity think, look through list of classnames registered for think, and if this entity's classname matches, call that forward.


All times are GMT -4. The time now is 04:56.

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