Raised This Month: $ Target: $400
 0% 

End Round Sounds


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-24-2010 , 11:50   End Round Sounds
Reply With Quote #1

Well I'm trying to make a plugin like End Round Sounds by PaintLancer, which plays random sounds at the end of the round depending on whether ct's win or t's win. I'm trying the same thing, but instead of just putting the file naems and stuff in the plugin, make them read from a file. This is what I have so far, but I have no idea what to do now . My code is not optomized or anything, but take a look:

Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Nikhil"

new configsdir[32]
new soundfile[32]

public plugin_init() {
    
    register_plugin( PLUGIN, VERSION, AUTHOR )
    
    register_event( "SendAudio", "t_win", "a", "2&%!MRAD_terwin" )
    register_event( "SendAudio", "ct_win", "a", "2&%!MRAD_ctwin" )  
    
    get_configsdir( configsdir, charsmax( configsdir ) )
    format( soundfile, 31, "%s/sounds.ini", configsdir )
    
    if( !file_exists( soundfile )) {
    server_print( "Sounds.ini not found, please check configs directory." )
    
    return PLUGIN_HANDLED
    
    }
}

public plugin_precache() {
    
    new file = fopen( soundfile, "r" )
    new ctfile[32], ct[20], t[10], tfile[32], line[56]
    while( !feof( file ) ) {
    
    fgets( file, line, charsmax(line) )
    
    if( containi( line, "Counter-Terrorist" ) ) {
    parse( line, ct, 19, ctfile, 31 )
    precache_sound( ctfile )
    
    }
    
    else if( contain( line, "TERRORIST" ) ) {
    parse( line, t, 9, tfile, 31 )
    precache_sound( tfile )
    
    }
    
    else return PLUGIN_HANDLED
    
    }
    fclose(file)

}

public ct_win() {
    
    new file = fopen( soundfile, "r" )
    new ctfile[32], ct[20], t[10], tfile[32], line[56];
    ctfilenum=0, tfilenum=0;
    while( !feof( file ) ) {
    
    fgets( file, line, charsmax(line) )
    
    if( containi( line, "Counter-Terrorist" ) ) {
    file_type[number] = 1
    parse( line, ct, 19, ctfile, 31 )
    ctfilenum++
    
    
    
    
    else if( contain( line, "TERRORIST" ) ) {
    parse( line, t, 9, tfile, 31 )
    tfilenum++
    
    }
    number++
    
    }

}
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-24-2010 , 11:53   Re: End Round Sounds
Reply With Quote #2

You can use this old plugin, which still works fine and use a file : http://forums.alliedmods.net/showthread.php?p=499872
Get the beta version.
__________________
Arkshine is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 08-24-2010 , 12:07   Re: End Round Sounds
Reply With Quote #3

Wow, that's great. Thanks.
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
Reply



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 15:05.


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