AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [FM] touch textures with different sound (https://forums.alliedmods.net/showthread.php?t=163626)

avril-lavigne 08-01-2011 13:24

[FM] touch textures with different sound
 
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
                               }      
 
          }                               



Exolent[jNr] 08-01-2011 13:35

Re: [FM] touch textures with different sound
 
Quote:

Originally Posted by avril-lavigne (Post 1523516)
PHP Code:

if(equal(classname


What?

avril-lavigne 08-01-2011 15:17

Re: [FM] touch textures with different sound
 
new nail_classname[] = "q3_nail";

Exolent[jNr] 08-01-2011 15:20

Re: [FM] touch textures with different sound
 
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)                                }                   }                               }

avril-lavigne 08-01-2011 17:28

Re: [FM] touch textures with different sound
 
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"

Exolent[jNr] 08-01-2011 17:38

Re: [FM] touch textures with different sound
 
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.

avril-lavigne 08-01-2011 19:04

Re: [FM] touch textures with different sound
 
and what about this thread
https://www.sourcemod.net/showthread.php?p=1519686

how to play sound on LAnding

Exolent[jNr] 08-01-2011 19:24

Re: [FM] touch textures with different sound
 
There already is one if you are moving fast enough or falling fast enough.


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

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