Raised This Month: $ Target: $400
 0% 

register_touch toucher question


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 02-02-2010 , 13:36   register_touch toucher question
Reply With Quote #1

If i have many classes, how can I set a wildcard for register_touch instead of:
PHP Code:
register_touch"sametype_class1",   "player""sametype_touch" );
register_touch"sametype_class2",   "player""sametype_touch" );
register_touch"sametype_class3",   "player""sametype_touch" );
...
register_touch"sametype_classN",   "player""sametype_touch" ); 
I see that "*" or "" is for any class.
__________________
ehha is offline
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 02-02-2010 , 14:35   Re: register_touch toucher question
Reply With Quote #2

Quote:
Originally Posted by ehha View Post
If i have many classes, how can I set a wildcard for register_touch instead of:
PHP Code:
register_touch"sametype_class1",   "player""sametype_touch" );
register_touch"sametype_class2",   "player""sametype_touch" );
register_touch"sametype_class3",   "player""sametype_touch" );
...
register_touch"sametype_classN",   "player""sametype_touch" ); 
I see that "*" or "" is for any class.
Use fakemeta

PHP Code:
register_forward(FM_Touch"sametype_touch"
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
Dr.G
Senior Member
Join Date: Nov 2008
Old 02-02-2010 , 14:41   Re: register_touch toucher question
Reply With Quote #3

I would do like this...

PHP Code:
new const CLASSES[][] = { 
    
    
"CLASS#1"
    
"CLASS#2"
    
"CLASS#3" 


new const 
FORWARD_NAME[] = "fwd_Touch"
new const PLAYER[] = "player"

public plugin_init() 

    
    for (new 
0sizeof CLASSESi++) 
        
register_touch(CLASSES[i], PLAYER FORWARD_NAME
    
}

public 
fwd_TouchiEntid)
{
    
// ....

__________________
Dr.G is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 02-02-2010 , 14:43   Re: register_touch toucher question
Reply With Quote #4

I forgot to say many custom entity classes, I need to hook only the custom classes touch.
Is FM_Touch for any class?

A for looks like a alternative to wildcard, I'll use it if there's no wildcard variant, thanks
__________________

Last edited by ehha; 02-02-2010 at 14:45.
ehha is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-02-2010 , 14:49   Re: register_touch toucher question
Reply With Quote #5

Sumthin' like this ?
Code:
register_touch( "*", "player", "sametype_touch" ); public sametype_touch( ... ) {     static wildcard[ ] = "sometype_class";         new szClassName[ 32 ];     pev( iEntity, pev_classname, szClassName, 31 );         if( equal( szClassName, wildcard, sizeof( wildcard ) ) ) {         // [ .. ]     } }
__________________
xPaw is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 02-02-2010 , 15:26   Re: register_touch toucher question
Reply With Quote #6

Something like that, but now my novice brain's got some questions:

Is there a value for the 1st parameter of register_touch that does the same thing as xPaw's code? (instead of "*" somethign like "*sametype_class")

If not, witch one of this versions has a better performance?
PHP Code:
register_touch"sametype_class1",   "player""sametype_touch" );
register_touch"sametype_class2",   "player""sametype_touch" );
register_touch"sametype_class3",   "player""sametype_touch" );
...
register_touch"sametype_class100",   "player""sametype_touch" ); 
or
PHP Code:
register_touch"*",   "player""sametype_touch" );
{
 
//filter stuff with xPaw's code using sametype_class substring

__________________
ehha is offline
Jack86
Veteran Member
Join Date: Dec 2008
Location: Belgrade, Serbia
Old 02-02-2010 , 15:35   Re: register_touch toucher question
Reply With Quote #7

Will
register_touch( "*", "player", "sametype_touch" )

register every touch player makes with everything around him ?
__________________

Jack86 is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 02-02-2010 , 15:53   Re: register_touch toucher question
Reply With Quote #8

Yup, that's what I understand from here:
http://www.amxmodx.org/funcwiki.php?go=func&id=463
__________________
ehha is offline
Reply


Thread Tools
Display Modes

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 07:26.


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