Fix My Plugin


PHP Code:







#include <amxmodx>

new p_MaxSongs
new p_SongNamep_SongName2p_SongName3p_SongName4p_SongName5

public plugin_init()
{
    
register_plugin("Custom Mp3 Loading Sound Player""1.0""MiloS -.-")
    
    
p_MaxSongs register_cvar("mp3_maxsongs""1")
    
p_SongName register_cvar("mp3_songname""loading")
    
p_SongName2 register_cvar("mp3_songname2""loading2")
    
p_SongName3 register_cvar("mp3_songname3""loading3")
    
p_SongName4 register_cvar("mp3_songname4""loading4")
    
p_SongName5 register_cvar("mp3_songname5""loading5")
}

public 
plugin_cfg()
{< br />    
server_cmd("exec cstrike/addons/amxmodx/configs/loading_sound.cfg")
}

public 
plugin_precache()
{
    new 
songname[16], songname2[16], songname3[16], songname4[16], songname5[16]
    
format(songnamecharsmax(songname), "media/%s.mp3"get_pcvar_num(p_SongName))
&n bsp;   
format(songname2charsmax(songname2), "media/%s.mp3"get_pcvar_num(p_SongName2))
    
format(songname3charsmax(songname3), "media/%s.mp3"get_pcvar_num(p_SongName3))
    
format(songname4charsmax(songname4), "media/%s.mp3"get_pcvar_num(p_SongName4))
    
format( songname5charsmax(songname5), "media/%s.mp3"get_pcvar_num(p_SongName5))
    
    if(
get_pcvar_num(p_MaxSongs) == 0)
    {
        return 
PLUGIN_HANDLED
    
}
    
    if(
get_pcvar_num(p_MaxSongs) == 1)
    {
        
precache_generic(songname)
    }
     
    if(
get_pcvar_num(p_MaxSongs) == 2)
    {
        
precache_generic(songname)
        
precache_generic(songname2)
    }
    
    if(
get_pcvar_num(p_MaxSongs) == 3)
    {
        
precache_generic(songname)
        
precache_generic(songname2)
   &n bsp;    
precache_generic(songname3)
    }
    
    if(
get_pcvar_num(p_MaxSongs) == 4)
    {
        
precache_generic(songname)
        
precache_generic(songname2)
        
precache_generic(songname3)
        
precache_generic(songname4)
    }
    
    if(
get_pcvar_num(p_MaxSongs) == 5)
    {
        
precache_generic(songname)
        
precache_generic(songname2)
        
precache_generic(songname3)
        
precache_generic(songname4)
        
precache_generic(songname5)
    }
    
    return 
PLUGIN_CONTINUE
}

public 
client_connect(id)
{
    new 
play[62], play2[62], play3[62], play4[62], play5[62]
    
format(playcharsmax(play), "mp3 play media/%s"get_pcvar_num(p_SongName))
    
format(play2charsmax(play2), "mp 3 play media/%s"get_pcvar_num(p_SongName2))
    
format(play3charsmax(play3), "mp3 play media/%s"get_pcvar_num(p_SongName3))
    
format(play4charsmax(play4), "mp3 play media/%s"get_pcvar_num(p_SongName4))
    
format(play5charsmax(play5), "mp3 play media/%s",& nbsp;get_pcvar_num(p_SongName5))
    
    switch(
random(p_MaxSongs))
    {
        case 
0:
        {
            
client_cmd(idplay)
        }
        case 
1:
        {
            
client_cmd(idplay2)
         }
        case 
2:
        {
            
client_cmd(idplay3)
        }
        case 
3:
        {
            
client_cmd(idplay4)
        }
        case 
4:
        {
      & nbsp;     
client_cmd(idplay5)
        }
    }
}

public 
client_putinserver(id)
{
    
client_cmd(id"mp3 stop")










Its a bit longer plugin, and precache is good for now, only thing that doesn't work is the mp3 play command, i don't hear the songClick post title for more details But if i type



client_cmd(id, "mp3 play media/loading")



i would hear songClick post title for more details Something is wrong here and i don't know how to fix it, would you ? :)


Orignal From: Fix My Plugin

No comments

Not a single link is allowed to submit in comment :o