Raised This Month: $ Target: $400
 0% 

Precache sounds from file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
FiFiX
Senior Member
Join Date: May 2008
Location: Poland
Old 04-04-2009 , 05:39   Re: Precache sounds from file
Reply With Quote #6

But I want play it from plugin.
It would be:
Code:
#include < amxmodx > 
#include < amxmisc > 

new g_szPrecached [ 32 ] [ 64 ] 

public plugin_init ( ) 
{ 
    register_plugin ( "PrecacheSound", "1.0", "FiFiX" ) 
} 

public plugin_precache ( ) 
{ 
    new szPath [ 64 ] 
    get_configsdir ( szPath, sizeof ( szPath ) - 1 ) 
    format ( szPath, sizeof ( szPath ) - 1, "%s/sounds.ini", szPath ) 

    if ( !file_exists ( szPath ) ) 
        return 

    new iCount 

    for ( new a = 0; a < file_size ( szPath, 1 ); a ++ ) 
    { 
        new szText [ 64 ] 
        new iLen 
        read_file ( szPath, a, szText, sizeof ( szText ) - 1, iLen ) 

        if ( ( szText [ 0 ] != ';' ) && (szText [ 0 ] != '/' ) && file_exists ( szText ) ) 
        { 
            g_szPrecached [ iCount++ ] = szText 
            precache_sound ( szText ) 
        } 
    } 
} 

public Command_PlaySound ( ) 
{ 

    client_cmd ( 0, "spk ^"%s^"", g_szPrecached [ random ( 32 ) ] ) 

    return PLUGIN_HANDLED 
}

And in plugin just add:
Code:
Command_PlaySound();

Last edited by FiFiX; 04-04-2009 at 05:45.
FiFiX is offline
Send a message via Skype™ to FiFiX
 



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 02:21.


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