View Single Post
redboyke
Member
Join Date: May 2008
Old 08-17-2008 , 07:53   Re: Loading Song Advanced (Updated Thread)
Reply With Quote #413

Quote:
Originally Posted by Emor View Post
loadingsongadvanced_3.ammx dont work?
i use: i changed it a bit so the sound still plays when they choose a team and play. reason why i named the mp3 redboyke is to make sure it wouldnt use a loading song from a difrend server with crappy music.
but this is only for 1 song i think.
PHP Code:
//Loading Music Also In Spectator Mode
//by Torch
//MP3 ONLY
//Copy MP3 file to sound/misc/loading.mp3
//Music will still play after the player has joined server until he chooses a team.
//Music will start playing again if the person goes back to spectator mode
//(not DEAD spectator, only Team Select>Spectator)

#include <amxmodx>
#include <amxmisc>
#include <cstrike>

new bool:playing[32]

public 
plugin_init() { 
    
register_plugin("Loading Song","1.0","Torch")
    
register_event"ResetHUD""song","b" )
    
register_event("TextMsg","song","b","2&#Spec_Mode")
    for (new 
i=0;i<32;i++)
    {
        
playing[i]=false
    
}
    return 
PLUGIN_CONTINUE 


public 
plugin_precache() {
    
precache_sound("misc/redboyke.mp3")
    return 
PLUGIN_CONTINUE 
}

public 
client_connect(id) {
    
play_song(id)
    return 
PLUGIN_CONTINUE


public 
play_song(id) {
    
client_cmd(id,"mp3 play sound/misc/redboyke.mp3")
    return 
PLUGIN_HANDLED
}

public 
play_song_task(params[],id) {
    new 
player params[0]
    
client_cmd(player,"mp3 play sound/misc/redboyke.mp3")
    return 
PLUGIN_HANDLED
}

public 
song(id) {
    new 
CsTeams:team
    team 
cs_get_user_team(id)

    if ((
team==CS_TEAM_SPECTATOR)||(team==CS_TEAM_UNASSIGNED)||(team==CS_TEAM_T)||(team==CS_TEAM_CT))
    {
        if (
playing[id]==false)
        {
            new 
params[1]
            
params[0]=id
            set_task
(0.5,"play_song_task",0,params,1,"a",1)
            
playing[id]=true
        
}
    }
    else
    {
            
client_cmd(id,"mp3 stop")
            
playing[id]=false
    
}
    return 
PLUGIN_CONTINUE

redboyke is offline