AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random (https://forums.alliedmods.net/showthread.php?t=171853)

RuRuRu612754 11-11-2011 16:37

random
 
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"
}


Bugsy 11-11-2011 16:44

Re: random
 
No, put all three sounds into a string array then randomly select a sound with sounds[ random( sizeof( sounds ) ) ]

RuRuRu612754 11-11-2011 17:00

Re: random
 
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"
}

??

Bugsy 11-11-2011 18:23

Re: random
 
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 ) ) ] );



RuRuRu612754 11-11-2011 18:28

Re: random
 
Bugsy

thanks


All times are GMT -4. The time now is 14:16.

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