Raised This Month: $ Target: $400
 0% 

random


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-11-2011 , 16:37   random
Reply With Quote #1

Hi.

roundstart_1.wav
roundstart_2.wav
roundstart_3.wav

To play in every time round so random, I should do?

Code:
#include <amxmodx>

public plugin_init()
{
	register_plugin("PLUGIN", "VERSION", "AUTHOR")

	register_logevent("EventRoundStart", 2, "1=Round_Start") 
}

public EventRoundStart()
{
	 client_cmd(0, "speak sound/roundstart_1.wav"
	 client_cmd(0, "speak sound/roundstart_2.wav"
	 client_cmd(0, "speak sound/roundstart_3.wav"
}
RuRuRu612754 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-11-2011 , 16:44   Re: random
Reply With Quote #2

No, put all three sounds into a string array then randomly select a sound with sounds[ random( sizeof( sounds ) ) ]
__________________
Bugsy is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-11-2011 , 17:00   Re: random
Reply With Quote #3

Code:
#include <amxmodx>

new RandomSound
{
	sound/roundstart_1.wav,
	sound/roundstart_2.wav,
	sound/roundstart_3.wav
}

public plugin_init()
{
	register_plugin("PLUGIN", "VERSION", "AUTHOR")

	register_logevent("EventRoundStart", 2, "1=Round_Start") 
}

public EventRoundStart()
{
	 client_cmd(0, "speak RandomSound"
}
??
RuRuRu612754 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-11-2011 , 18:23   Re: random
Reply With Quote #4

PHP Code:

#include <amxmodx>

new const Sounds[][] = 
{
    
"roundstart_1.wav",
    
"roundstart_2.wav",
    
"roundstart_3.wav"
};

public 
plugin_precache()
{
    for ( new 
sizeofSounds ) ; i++ )
        
precache_soundSounds] );
}

public 
plugin_init()
{
    
register_logevent"EventRoundStart" "1=Round_Start" );
}

public 
EventRoundStart()
{
     
client_cmd"speak sound/%s" SoundsrandomsizeofSounds ) ) ] );

__________________

Last edited by Bugsy; 11-11-2011 at 18:24.
Bugsy is offline
RuRuRu612754
Senior Member
Join Date: Sep 2011
Old 11-11-2011 , 18:28   Re: random
Reply With Quote #5

Bugsy

thanks
RuRuRu612754 is offline
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 14:16.


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