AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   RegisterHam for ALL Entities? [Solved] (https://forums.alliedmods.net/showthread.php?t=63493)

Wilson [29th ID] 11-22-2007 17:47

RegisterHam for ALL Entities? [Solved]
 
I am trying to log a hamsandwich function, but not just for one specific entity...for ALL entities. Just like I would do for a fakemeta forward, FM_ForwardName.

I have tried using "*" for the entity parameter, but it doesn't seem to work

Code:
// This works fine RegisterHam( Ham_TakeDamage, "player", "hook_TakeDamage" ); // This doesn't RegisterHam( Ham_TakeDamage, "*", "hook_TakeDamage" );

The first of the two will carry on to my function and echo the TakeDamage event. The second of the two does not. I only used TakeDamage as an example because I knew it would work normally.

Is there a way to bypass the entity parameter and do it for all entities?

Wilson [29th ID] 11-25-2007 10:12

Re: RegisterHam for ALL Entities?
 
According to the author of the hamsandwich bible via IRC,

Quote:

<sawce> you can't use * for an entity name
<sawce> you have to use a valid entity
<Zenith77`> Wilson29thID, you could just loop through every entity in game and register each one for the hook in a for loop.
<Zenith77`> This is a horrid method though.
<sawce> there's no other way to do it, i didn't add that because then there'd be requests to do it for every mod. it's best left for the plugin developers to have to slave over
<sawce> well
<sawce> not every entity in game
<sawce> but create a list of the entity names
<sawce> and loop through that
(Posted for anyone else who will want to know)

purple_pixie 11-26-2007 04:13

Re: RegisterHam for ALL Entities? [Solved]
 
I figured it might be that.

Thanks for putting it up, btw.

VEN 11-27-2007 11:29

Re: RegisterHam for ALL Entities? [Solved]
 
FYI: you could just read HS module thread for such info. Page 3[±1].


All times are GMT -4. The time now is 01:19.

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