Raised This Month: $ Target: $400
 0% 

Random Music


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
1M1e
Member
Join Date: Mar 2020
Old 09-15-2021 , 08:26   Random Music
Reply With Quote #1

Hello,

I tried to make this code works on every new round but its not working can you tell me what I did wrong?

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

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "1M1e"

new g_iCvars;

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("HLTV""OnNewRound""a""1=0""2=0")
    
    
g_iCvars register_cvar("random_music""1")
    
    
register_clcmd("say /stop""StopMusic")
    
register_clcmd("say_team /stop""StopMusic")
    
register_clcmd("say /play""PlayMusic")
    
register_clcmd("say_team /play""PlayMusic")
    
}

public 
StopMusic(id)
{
        
client_cmd(id"mp3 stop")
    
g_iCvars 0
}

public 
PlayMusic(id)
{
    
g_iCvars 1
}

public 
client_connect()
{
    
g_iCvars 1
}

public 
OnNewRound(id)
{
    
    
client_cmd(0"mp3 stop")
    
    if(
get_pcvar_num(g_iCvars))
    {
        new 
random random_num(1,10);
        
        switch( 
random )
        {
            case 
1:
            {
                
client_cmd(id"mp3 play ^"sound/music/music1^"")
            }
            case 
2:
            {
                
client_cmd(id"mp3 play ^"sound/music/music2^"")
            }
            case 
3:
            {
                
client_cmd(id"mp3 play ^"sound/music/music3^"")
            }
            case 
4:
            {
                
client_cmd(id"mp3 play ^"sound/music/music4^"")
            }
            case 
5:
            {
                
client_cmd(id"mp3 play ^"sound/music/music5^"")
            }
            case 
6:
            {
                
client_cmd(id"mp3 play ^"sound/music/music6^"")
            }
            case 
7:
            {
                
client_cmd(id"mp3 play ^"sound/music/music7^"")
            }
            case 
8:
            {
                
client_cmd(id"mp3 play ^"sound/music/music8^"")
            }
            case 
9:
            {
                
client_cmd(id"mp3 play ^"sound/music/music9^"")
            }
            case 
10:
            {
                
client_cmd(id"mp3 play ^"sound/music/music10^"")
            }
        }
    }
    return 
PLUGIN_HANDLED


Last edited by 1M1e; 09-15-2021 at 08:28.
1M1e is offline
 



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 11:37.


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