Raised This Month: $ Target: $400
 0% 

Small problem with loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mati009988
Member
Join Date: Jul 2009
Old 08-10-2010 , 04:45   Small problem with loop
Reply With Quote #1

Hi!
I`ve got a small problem with loop in roundsound.
When someone say rs no one hear music.
What is wrong?

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

#include <amxmodx>
#include <ColorChat>

new bool:wylacz[33]

new const 
tytul1[]="author/title"
new const piosenka1[]="misc/sound.mp3"

new const tytul2[]="author/title"
new const piosenka2[]="misc/sound.mp3"

new const tytul3[]="author/title"
new const piosenka3[]="misc/sound.mp3"

new const tytul4[]="author/title"
new const piosenka4[]="misc/sound.mp3"

new const tytul5[]="author/title"
new const piosenka5[]="misc/sound.mp3"

new const tytul6[]="author/title"
new const piosenka6[]="misc/sound.mp3"

new const tytul7[]="author/title"
new const piosenka7[]="misc/sound.mp3"

new const tytul8[]="author/title"
new const piosenka8[]="misc/sound.mp3"

new const tytul9[]="author/title"
new const piosenka9[]="misc/sound.mp3"

new const tytul10[]="author/title"
new const piosenka10[]="misc/sound.mp3"

new const tytul11[]="author/title"
new const piosenka11[]="misc/sound.mp3"

public plugin_init() {
    
register_plugin("RoundSound""1.0""S!p")
    
register_logevent("KoniecRundy",2,"1=Round_End")
    
register_clcmd("say roundsound""roundsound")
    
register_clcmd("say /roundsound""roundsound")
    
register_clcmd("say_team roundsound""roundsound")
    
register_clcmd("say_team /roundsound""roundsound")
    
register_clcmd("say roundsound""roundsound")
    
register_clcmd("say rs""roundsound")
    
register_clcmd("say_team rs""roundsound")
}

public 
client_connect(iwylacz[i] = false

public KoniecRundy(i){
    for(new 
i=i<=32 i++){
        if(!
is_user_connected(i)) return PLUGIN_HANDLED_MAIN
        
switch (random_num(1,11)){
            case 
1: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka1)
                
ColorChat(0RED"[RS] %s",tytul1)
            }
            case 
2: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka2)
                
ColorChat(0RED"[RS] %s",tytul2)
            }
            case 
3: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka3)
                
ColorChat(0RED"[RS] %s",tytul3)
            }
            case 
4: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka4)
                
ColorChat(0RED"[RS] %s",tytul4)
            }
            case 
5: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka5)
                
ColorChat(0RED"[RS] %s",tytul5)
            }
            case 
6: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka6)
                
ColorChat(0RED"[RS] %s",tytul6)
            }
            case 
7: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka7)
                
ColorChat(0RED"[RS] %s",tytul7)
            }
            case 
8: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka8)
                
ColorChat(0RED"[RS] %s",tytul8)
            }
            case 
9: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka9)
                
ColorChat(0RED"[RS] %s",tytul9)
            }
            case 
10: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka10)
                
ColorChat(0RED"[RS] %s",tytul10)
            }
            case 
11: { 
                if(
wylacz[i]) return PLUGIN_HANDLED
                client_cmd
(0"mp3 stop")
                
client_cmd(0"stopsound")
                
client_cmd(0"mp3 play sound/%s"piosenka11)
                
ColorChat(0RED"[RS] %s",tytul11)
            }
        }
        return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_HANDLED
}

public 
roundsound(i){
    if(
wylacz[i]){
        
wylacz[i] = false
        ColorChat
(iRED"[RS]^x01 RoundSound ^x04on")
    }
    else {
        
wylacz[i] = true
        ColorChat
(iRED"[RS]^x01 RoundSound ^x04off")
    }
}

public 
plugin_precache(){
    
precache_sound(piosenka1)
    
precache_sound(piosenka2)
    
precache_sound(piosenka3)
    
precache_sound(piosenka4)
    
precache_sound(piosenka5)
    
precache_sound(piosenka6)
    
precache_sound(piosenka7)
    
precache_sound(piosenka8)
    
precache_sound(piosenka9)
    
precache_sound(piosenka10)
    
precache_sound(piosenka11)

mati009988 is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-10-2010 , 06:16   Re: Small problem with loop
Reply With Quote #2

Have a try.
PHP Code:
#include <amxmodx> 
//#include <ColorChat>  //Uncomment

#define AMOUNT 11   // Total amount of songs/artists

new bool:DontPlay[33] = false

new const TITLE[AMOUNT][] =
{
    
"author/title",  // 1st song's title and author
    
"author/title",  // 2nd song's title and author
    
"author/title",  // ..
    
"author/title",
    
"author/title",
    
"author/title",
    
"author/title",
    
"author/title",
    
"author/title",
    
"author/title",
    
"author/title"   // no comma
}
    
new const 
MUSIC[AMOUNT][] =
{
    
"misc/sound.mp3"// 1st song
    
"misc/sound.mp3"// 2nd song
    
"misc/sound.mp3"// ...
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3",
    
"misc/sound.mp3"  // no comma
}

public 
plugin_init() { 
    
register_plugin("RoundSound""1.0""S!p"
    
register_logevent("KoniecRundy",1,"1=Round_End"
    
register_clcmd("say roundsound""roundsound"
    
register_clcmd("say /roundsound""roundsound"
    
register_clcmd("say_team roundsound""roundsound"
    
register_clcmd("say_team /roundsound""roundsound"
    
register_clcmd("say roundsound""roundsound"
    
register_clcmd("say rs""roundsound"
    
register_clcmd("say_team rs""roundsound"


public 
client_connect(iDontPlay[i] = false 

public KoniecRundy(i)
{
    new 
RandSong random_num(1AMOUNT)
    for(new 
i=i<=32 i++) 
    {
        if(!
DontPlay[i])
        {
            
client_cmd(i"mp3 stop"
            
client_cmd(i"stopsound"
            
client_cmd(i"mp3 play %s"MUSIC[RandSong]) 
            
client_print(iprint_chat"Now playing %s"TITLE[RandSong])
        }
    }



public 
roundsound(id)

    if(
DontPlay[id]) 
        
DontPlay[id] = false
    
else 
        
DontPlay[id] = true
    client_print
(idprint_chat"Round sound is %s."DontPlay[id] ? "ON" "OFF")    


public 
plugin_precache()

    for(new 
1<= AMOUNTi++)
    {
        
precache_sound(MUSIC[i]) 
    }  

t3hNox is offline
mati009988
Member
Join Date: Jul 2009
Old 08-10-2010 , 07:03   Re: Small problem with loop
Reply With Quote #3

Not work.
Music not play, don`t show author/title and one error in plugin_precache:
Code:
L 08/10/2010 - 12:27:23: [AMXX] Displaying debug trace (plugin "RoundSound.amxx")
L 08/10/2010 - 12:27:23: [AMXX] Run time error 4: index out of bounds 
L 08/10/2010 - 12:27:23: [AMXX]    [0] rs.sma::plugin_precache (line 81)
mati009988 is offline
Leon M.
Senior Member
Join Date: Apr 2009
Location: Germany
Old 08-10-2010 , 08:55   Re: Small problem with loop
Reply With Quote #4

PHP Code:
public plugin_precache()

    for(new 
1<= AMOUNTi++)
    {
        
precache_sound(MUSIC[i]) 
    }  


PHP Code:
public plugin_precache()

    for(new 
0AMOUNTi++)
    {
        
precache_sound(MUSIC[i]) 
    }  

__________________
  • ZapTic - Paintball (Version 7.1.3 b1303)
  • Your #1 CS Paintball Server since 2008
  • 85.131.163.101:27015
Leon M. is offline
t3hNox
Senior Member
Join Date: Oct 2009
Old 08-10-2010 , 10:23   Re: Small problem with loop
Reply With Quote #5

About music.
Change:
Code:
client_cmd(i, "mp3 play %s", MUSIC[RandSong])
To:
Code:
client_cmd(i, "mp3 play sound/%s", MUSIC[RandSong])
I don't see why author/title wouldn't be printed :/
t3hNox 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 21:55.


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