Raised This Month: $ Target: $400
 0% 

Precache sounds from file


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 04-04-2009 , 05:19   Re: Precache sounds from file
Reply With Quote #2

PHP Code:
#include < amxmodx >
#include < amxmisc >

new g_szPrecached 32 ] [ 64 ]

public 
plugin_init ( )
{
    
register_plugin "PrecacheSound""1.0""FiFiX" )
    
set_task random_float 5.015.0 ), "Task_PlaySounds")
}

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

    if ( !
file_exists szPath ) )
        return

    new 
iCount

    
for ( new 0file_size szPath); ++ )
    {
        new 
szText 64 ]
        new 
iLen
        read_file 
szPathaszTextsizeof szText ) - 1iLen )

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

public 
Task_PlaySounds ( )
{
    
client_cmd 0"spk ^"%s^""g_szPrecached random 32 ) ] )
    
set_task random_float 5.015.0 ), "Task_PlaySounds")


Last edited by TheRadiance; 04-04-2009 at 05:44.
TheRadiance is offline
Send a message via ICQ to TheRadiance
 



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