Raised This Month: $32 Target: $400
 8% 

Loading Song Advanced (Updated Thread)


Post New Thread Reply   
 
Thread Tools Display Modes
pUnk
Member
Join Date: Apr 2009
Old 04-10-2015 , 16:08   Re: Loading Song Advanced (Updated Thread)
Reply With Quote #451

Could someone please edit the .sma so that the music will continue playing/looping/restarting untill the player actually starts to play?

Code:
#include <amxmodx>
#include <amxmisc>
#include <engine>

#define MAX_SONGS    50

public plugin_init() { 
    register_plugin("loading with music","2.0","eFrigid") 
    return PLUGIN_CONTINUE 
} 

new configsdir[200]
new configfile[200]
new song[MAX_SONGS][64]
new songdir[MAX_SONGS][64]
new bool:precached[MAX_SONGS]

public plugin_precache()
    {
    get_configsdir(configsdir,199)
    format(configfile,199,"%s/loadingsongs.ini",configsdir)
    new trash
    for(new i=0;i<MAX_SONGS;i++)
        {
        precached[i]=false
        read_file(configfile,i,song[i],63,trash)
        if(!equali(song[i][4],""))
            {
            precached[i]=true
            format(songdir[i],63,"sound/misc/%s",song[i])
            precache_generic(songdir[i])
        }
    }
}

public client_connect(id) { 
    new size = file_size(configfile,1)
    new rsong = random_num(0,size-1)
    new cursong[64], a
    read_file(configfile,rsong,cursong,63,a)
    client_cmd(id,"mp3 play sound/misc/%s",cursong)
    
    return PLUGIN_CONTINUE 
}
This other plugin already does that, but it only loads one mp3 file so I get stuck with that one...
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/loading.mp3")
    return PLUGIN_CONTINUE 
}

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

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

public play_song_task(params[],id) {
    new player = params[0]
    client_cmd(player,"mp3 loop sound/misc/loading.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))
    {
        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
}
So i guess it would be a mix of both to get the job done.

Thx in advance!
pUnk is offline
popilas
Senior Member
Join Date: Apr 2017
Location: lituanica
Old 05-06-2018 , 09:05   Re: Loading Song Advanced (Updated Thread)
Reply With Quote #452

sound dowloand all players but dont sing
popilas 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 10:26.


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