Raised This Month: $ Target: $400
 0% 

emmiting complex sounds( spk or emit_sound? )


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-19-2010 , 23:22   Re: emmiting complex sounds( spk or emit_sound? )
Reply With Quote #9

Ok, I figured out the problem. You can't reuse the variable "sentence" because you are trying to make it longer but is only as long as the original string that was submitted to it.

Try this:

PHP Code:
spk(sentence[],pitch,volume)
{
    new 
szSoundSettings[32];
    new 
szCmd[64];
    new 
iPos;
    if(
pitch != 100)
    {
        
iPos formatex(szSoundSettingscharsmax(szSoundSettings), "p%i"pitch)
    }
    
    if(
volume != 100)
    {
        
formatex(szSoundSettings[iPos], charsmax(szSoundSettings) - iPos"%sv%i"szSoundSettings[0] ? " " ""volume)
    }
    
    if(
szSoundSettings[0])
    {
        new 
iSlashPos
        
if( (iSlashPos contain(sentence"/")) != -)
        {
            
iPos add(szCmdcharsmax(szCmd), sentenceiSlashPos+1)
            
formatex(szCmd[iPos], charsmax(szCmd) - iPos"(%s) %s"szSoundSettingssentence[iSlashPos+1])
        }
    }
    else
    {
        
copy(szCmdcharsmax(szCmd), sentence)
    }
    
    new 
iPlayers[32], iNumPlayers;
    
get_players(iPlayersiNumPlayers);
    for(new 
i=0iNumPlayersi++)
    {
        
client_cmd(iPlayers[i],"spk ^"%s^"",szCmd);
    }

__________________

Last edited by fysiks; 07-19-2010 at 23:35.
fysiks is offline
 



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:11.


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