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.0, 15.0 ), "Task_PlaySounds", 0 )
}
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 Task_PlaySounds ( )
{
client_cmd ( 0, "spk ^"%s^"", g_szPrecached [ random ( 32 ) ] )
set_task ( random_float ( 5.0, 15.0 ), "Task_PlaySounds", 0 )
}