Raised This Month: $12 Target: $400
 3% 

random sound


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Intouchable
Senior Member
Join Date: Mar 2012
Old 04-01-2012 , 14:53   random sound
Reply With Quote #1

I have this code
PHP Code:

new zm_miss_sounds[][] = {     -1,    { "umbrella_swarm/armored/miss/claw_miss_1.wav""umbrella_swarm/armored/miss/claw_miss_2.wav", },    { "umbrella_swarm/fake/miss/claw_miss_1.wav""umbrella_swarm/fake/miss/claw_miss_2.wav", },    { "umbrella_swarm/dasd/miss/claw_miss_1.wav""umbrella_swarm/dasd/miss/claw_miss_2.wav", }} 
and this

PHP Code:
emit_sound(idCHAN_WEAPONzm_miss_sounds[cInfo[id][Class]][0], volumeattnflagpitch
How to do with array to select random sounds? If my class is 1, then he select umbrella_swarm/armored/miss/claw_miss_1.wav", "umbrella_swarm/armored/miss/claw_miss_2.wav" one sound random. How to do?

Last edited by Intouchable; 04-01-2012 at 14:56.
Intouchable is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-01-2012 , 15:41   Re: random sound
Reply With Quote #2

PHP Code:
new const g_cSounds[ ][ ] = { "ffrmc/dinwad.wav""etc/exxxfrsca.wav" };

// g_cSounds[ 0 ] will be equal with "ffrmc/dinwad.wav"
// g_cSounds[ 1 ] will be equal with "etc/exxxfrsca.wav"
// g_cSounds[ 0 ][ 0 ] will be equal with 'f'
// g_cSounds[ 0 ][ 1 ] will be equal with 'f'
// g_cSounds[ 0 ][ 2 ] will be equal with 'r'

client_cmdiClient"spk %s"g_cSoundsrandom_num0sizeof g_cSounds ) ] );

// sizeof g_cSounds will be equal with 2 --- ... -1 ... will be equal with 1 ... so we'll have random between 0 and 1 
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Intouchable
Senior Member
Join Date: Mar 2012
Old 04-02-2012 , 01:52   Re: random sound
Reply With Quote #3

What you wrote i don't need this, because my code not like yours. I wrote
PHP Code:

new zm_miss_sounds[][] = {     
-
1,    
{  
"umbrella_swarm/armored/miss/claw_miss_1.wav",  "umbrella_swarm/armored/miss/claw_miss_2.wav", }, // 1lvl
{  "umbrella_swarm/fake/miss/claw_miss_1.wav",  "umbrella_swarm/fake/miss/claw_miss_2.wav", }, // 2lvl
{  "umbrella_swarm/dasd/miss/claw_miss_1.wav",  "umbrella_swarm/dasd/miss/claw_miss_2.wav", } // 3lvl!

I was mean if zombie is 1lvl he get random these sounds
PHP Code:
{  "umbrella_swarm/armored/miss/claw_miss_1.wav",  "umbrella_swarm/armored/miss/claw_miss_2.wav", } // 1lvl 
If zombie is 2lvl then he get random these sounds
PHP Code:
{  "umbrella_swarm/fake/miss/claw_miss_1.wav",  "umbrella_swarm/fake/miss/claw_miss_2.wav", }, // 2lvl 
and etc...

P.S. I don't know how to get random sound from zombies lvl...

Last edited by Intouchable; 04-02-2012 at 01:55.
Intouchable is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 04-02-2012 , 03:06   Re: random sound
Reply With Quote #4

http://forums.alliedmods.net/showpos...67&postcount=4
EpicMonkey is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 04-02-2012 , 03:11   Re: random sound
Reply With Quote #5

Untested

PHP Code:
#include <amxmodx>

const MAX_PLAYERS 32;

enum _:ZOMBIE_LEVELS
{
    
ZOMBIE_LEVEL_NONE,
    
ZOMBIE_LEVEL_ONE,
    
ZOMBIE_LEVEL_TWO,
    
ZOMBIE_LEVEL_THREE
}

new const 
zmMissSounds[][] = 
{     
    
"claw_miss_1.wav",
    
"claw_miss_2.wav"
};

new const 
zmZombieLevels[ZOMBIE_LEVELS][] =
{
    
"NONE",
    
"umbrella_swarm/armored/miss/"//Level 1
    
"umbrella_swarm/fake/miss/"//Level 2
    
"umbrella_swarm/dasd/miss/"  //Level 3
};

new 
g_iZombieLevel[MAX_PLAYERS 1];

public 
plugin_init()
{
    
register_clcmd("say /test""cmdTest");
    
register_clcmd("say /level""cmdLevel");
}

public 
cmdLevel(id)
{
    switch(
g_iZombieLevel[id])
    {
        case 
ZOMBIE_LEVEL_NONE:
        {
            
g_iZombieLevel[id] = ZOMBIE_LEVEL_ONE;
        }
        case 
ZOMBIE_LEVEL_ONE:
        {
            
g_iZombieLevel[id] = ZOMBIE_LEVEL_TWO;
        }
        case 
ZOMBIE_LEVEL_TWO:
        {
            
g_iZombieLevel[id] = ZOMBIE_LEVEL_THREE;
        }
        case 
ZOMBIE_LEVEL_THREE:
        {
            
g_iZombieLevel[id] = ZOMBIE_LEVEL_ONE;
        }
    }
    
client_print(idprint_chat"Your level is now %d"g_iZombieLevel[id]);
}

public 
cmdTest(id)
{
    
client_cmd(id"spk %s/%s"zmZombieLevels[g_iZombieLevel[id]], zmMissSounds[random_num(0sizeof(zmMissSounds))]);

type /level to increase your level 1,2,3

type /test to hear random sound between the two.

Last edited by Doc-Holiday; 04-02-2012 at 03:11. Reason: ADDED EXPLANATION
Doc-Holiday is offline
Intouchable
Senior Member
Join Date: Mar 2012
Old 04-02-2012 , 04:12   Re: random sound
Reply With Quote #6

Sry, but don't like this i just need sounds only.. Now look.
PHP Code:
new const ZMClasses[][] = {
      
"noob zombie",
      
"bla zombie",
      
"ouch zombie"
}

new 
zm_miss_sounds[][] = {        
{  
"umbrella_swarm/armored/miss/claw_miss_1.wav",  "umbrella_swarm/armored/miss/claw_miss_2.wav", }, // noob zombie random sounds when he miss! first sounds
{  "umbrella_swarm/fake/miss/claw_miss_1.wav",  "umbrella_swarm/fake/miss/claw_miss_2.wav", }, // bla zombie random sounds when he miss! second sounds 
{  "umbrella_swarm/dasd/miss/claw_miss_1.wav",  "umbrella_swarm/dasd/miss/claw_miss_2.wav", } // ouch zombie random SOUNDS! third sounds

If i'am the noob zombie i would have these 2 sounds random when i miss with knife, where I wrote first sound array, if i'am bla zombie i woud have second 3 sounds random when i miss... Can write example how to select noob, bla and ouch zombies sound random?

Last edited by Intouchable; 04-02-2012 at 04:23.
Intouchable is offline
claudiuhks
Yam Inside®™℠
Join Date: Jan 2010
Location: Living Randomly
Old 04-02-2012 , 05:33   Re: random sound
Reply With Quote #7

For first zombie, zm_miss_sounds[ 0 ] and zm_miss_sounds[ 1 ] -> zm_miss_sounds[ random_num( 0, 1 ) ]
For second zombie, zm_miss_sounds[ 2 ] and zm_miss_sounds[ 3 ] -> zm_miss_sounds[ random_num( 2, 3 ) ]

->

PHP Code:
new zm_miss_sounds[][] = {        
"umbrella_swarm/armored/miss/claw_miss_1.wav",  "umbrella_swarm/armored/miss/claw_miss_2.wav"// noob zombie random sounds when he miss! first sounds
"umbrella_swarm/fake/miss/claw_miss_1.wav",  "umbrella_swarm/fake/miss/claw_miss_2.wav",  // bla zombie random sounds when he miss! second sounds 
"umbrella_swarm/dasd/miss/claw_miss_1.wav",  "umbrella_swarm/dasd/miss/claw_miss_2.wav" // ouch zombie random SOUNDS! third sounds


Last edited by claudiuhks; 04-02-2012 at 05:34.
claudiuhks is offline
Send a message via MSN to claudiuhks Send a message via Yahoo to claudiuhks Send a message via Skype™ to claudiuhks
Intouchable
Senior Member
Join Date: Mar 2012
Old 04-02-2012 , 06:40   Re: random sound
Reply With Quote #8

Quote:
Originally Posted by claudiuhks View Post
For first zombie, zm_miss_sounds[ 0 ] and zm_miss_sounds[ 1 ] -> zm_miss_sounds[ random_num( 0, 1 ) ]
For second zombie, zm_miss_sounds[ 2 ] and zm_miss_sounds[ 3 ] -> zm_miss_sounds[ random_num( 2, 3 ) ]

->

PHP Code:
new zm_miss_sounds[][] = {        
"umbrella_swarm/armored/miss/claw_miss_1.wav",  "umbrella_swarm/armored/miss/claw_miss_2.wav"// noob zombie random sounds when he miss! first sounds
"umbrella_swarm/fake/miss/claw_miss_1.wav",  "umbrella_swarm/fake/miss/claw_miss_2.wav",  // bla zombie random sounds when he miss! second sounds 
"umbrella_swarm/dasd/miss/claw_miss_1.wav",  "umbrella_swarm/dasd/miss/claw_miss_2.wav" // ouch zombie random SOUNDS! third sounds

thanks that i need it!
Intouchable is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 04-02-2012 , 07:08   Re: random sound
Reply With Quote #9

if you want to use emit_sound with random sounds

Code:
emit_sound( id, CHAN_VOICE, zm_miss_sounds[ random_num( 0, charsmax( zm_miss_sounds ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
__________________

Last edited by tuty; 04-02-2012 at 07:09.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Old 04-02-2012, 08:11
claudiuhks_PizdaX
This message has been deleted by Exolent[jNr]. Reason: English only.
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 04-02-2012 , 09:49   Re: random sound
Reply With Quote #10

Quote:
Originally Posted by tuty View Post
if you want to use emit_sound with random sounds

Code:
emit_sound( id, CHAN_VOICE, zm_miss_sounds[ random_num( 0, charsmax( zm_miss_sounds ) ) ], VOL_NORM, ATTN_NORM, 0, PITCH_NORM )
He wants each level to have its own sound which is exactly what i posted.... so he has no idea what he is doing.

You originally said levels not names of zombies... change the level enum to a class name enum and use it that way... other wise good luck what i posted works. and its easier then hard coding 1-2 this zombie 3-4 this one ect.

Last edited by Doc-Holiday; 04-02-2012 at 09:51.
Doc-Holiday is offline
Reply


Thread Tools
Display Modes

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 07:10.


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