Raised This Month: $ Target: $400
 0% 

[FM] touch textures with different sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-01-2011 , 13:24   [FM] touch textures with different sound
Reply With Quote #1

The problem is - I have fm_ touch function
in other function ( radius damage I use different HIT sounds according to damage )


here I want my sound when it hit walls or floor ONLY, if I put the sound here, it works for every texture. and Player. so even if my hit sounds works in other functions. this one makes them silent

PHP Code:
public pfn_touch(ptrptd)
{        
        if(
pev_valid(ptr))
        {    
            new 
classname[32];
            
pev(ptrpev_classnameclassname31);
        
            if(
equal(classnamenail_classname))
            {    
                new 
Float:fOrigin[3];
                new 
iOrigin[3];
                
pev(ptrpev_originfOrigin);
                
FVecIVec(fOrigin,iOrigin);            
                
nail_radius_damage(ptr);
                
                
message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin);
                
write_byte(TE_EXPLOSION);
                
write_coord(iOrigin[0]);
                
write_coord(iOrigin[1]);
                
write_coord(iOrigin[2]);
                
write_short(explode2);
                
write_byte(30);
                
write_byte(15);
                
write_byte(TE_EXPLFLAG_NOSOUND);
                
message_end();                              
            
                
engfunc(EngFunc_RemoveEntityptr);    
                              }
                         

                            [
B] if(equal(classname) || equal(classname"func_wall") || equal(classname"func_breakable"))[/B]   // this not work (
                                
{
                    
emit_sound(0CHAN_WEAPONsnd_hitwall[random_num(0sizeof snd_hitwall 1)], VOL_NORMATTN_NORM0PITCH_NORM
                               }      
 
          }                               

__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2011 , 13:35   Re: [FM] touch textures with different sound
Reply With Quote #2

Quote:
Originally Posted by avril-lavigne View Post
PHP Code:
if(equal(classname
What?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-01-2011 , 15:17   Re: [FM] touch textures with different sound
Reply With Quote #3

new nail_classname[] = "q3_nail";
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc

Last edited by avril-lavigne; 08-01-2011 at 15:22.
avril-lavigne is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2011 , 15:20   Re: [FM] touch textures with different sound
Reply With Quote #4

No, I'm talking about this line:
Code:
public pfn_touch(ptr, ptd) {               if(pev_valid(ptr))         {               new classname[32];             pev(ptr, pev_classname, classname, 31);                     if(equal(classname, nail_classname))             {                   new Float:fOrigin[3];                 new iOrigin[3];                 pev(ptr, pev_origin, fOrigin);                 FVecIVec(fOrigin,iOrigin);                          nail_radius_damage(ptr);                                 message_begin(MSG_BROADCAST,SVC_TEMPENTITY,iOrigin);                 write_byte(TE_EXPLOSION);                 write_coord(iOrigin[0]);                 write_coord(iOrigin[1]);                 write_coord(iOrigin[2]);                 write_short(explode2);                 write_byte(30);                 write_byte(15);                 write_byte(TE_EXPLFLAG_NOSOUND);                 message_end();                                                           engfunc(EngFunc_RemoveEntity, ptr);                               }                                                        if(equal(classname) || equal(classname, "func_wall") || equal(classname, "func_breakable"))   // this not work (                                 {                     emit_sound(0, CHAN_WEAPON, snd_hitwall[random_num(0, sizeof snd_hitwall - 1)], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)                                }                   }                               }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-01-2011 , 17:28   Re: [FM] touch textures with different sound
Reply With Quote #5

Yes Im asking about this line
its not original code. Im trying to catch when entity touches WALL only or FLOOR
to emit_sound

and other sound will be for any other
"touches"
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2011 , 17:38   Re: [FM] touch textures with different sound
Reply With Quote #6

For 1, you never get the classname of the entity it is touching.
2nd, you should also check if the entity it hit is 0, since that is what the floor/walls would be for non-entities.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
avril-lavigne
Banned
Join Date: Apr 2009
Old 08-01-2011 , 19:04   Re: [FM] touch textures with different sound
Reply With Quote #7

and what about this thread
https://www.sourcemod.net/showthread.php?p=1519686

how to play sound on LAnding
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc
avril-lavigne is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 08-01-2011 , 19:24   Re: [FM] touch textures with different sound
Reply With Quote #8

There already is one if you are moving fast enough or falling fast enough.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



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 03:22.


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