Raised This Month: $ Target: $400
 0% 

[REQ] Edit Loading Song Advanced


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pUnk
Member
Join Date: Apr 2009
Old 04-10-2015 , 16:29   [REQ] Edit Loading Song Advanced
Reply With Quote #1

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

Loading Song Advanced:
https://forums.alliedmods.net/showthread.php?t=21345
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...

Loading Music + also in spectator:
https://forums.alliedmods.net/showth...=loading+music
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.
But i would like the plugin to repeat itself only once when the player sees the team selecting menu 1st time when connecting not every time he goes into spec like the latter plugin!

so basically..
connecting to server..Music!
choosing teams..Same Music! (either by having to repeat/loop that song, unless the player has chosen a team, repeat it endlessly)
team+model chosen..NO MUSIC!
dead..NO MUSIC!
back to spec..NO MUSIC!

Thx in advance!!!!
To all you Top Coders out there...
pUnk is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-10-2015 , 19:36   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #2

So... you want this:
Player connects *STARTS MUSIC*, player is inside server *MUSIC KEEPS PLAYING*(not restarting/looping), as soon as player enters team *MUSIC STOPS*
??

Last edited by Syturi0; 04-10-2015 at 19:36.
Syturi0 is offline
pUnk
Member
Join Date: Apr 2009
Old 04-10-2015 , 21:56   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #3

Quote:
Originally Posted by Syturi0 View Post
So... you want this:
Player connects *STARTS MUSIC*, player is inside server *MUSIC KEEPS PLAYING*(not restarting/looping), as soon as player enters team *MUSIC STOPS*
??
Exactly!

Though i dont know if it is possible to keep playing after a successful connection, i dont mind if the song has to restart after successfully connecting to the server (meaning player already inside the server right after connection) . But i do need it to repeat endlessly just for the first time the player is choosing teams/models. As soon as the player enters a team the music stops.

And you my friend will see tears rolling down my face.
pUnk is offline
Syturi0
Veteran Member
Join Date: Aug 2014
Location: Your mom house -Portugal
Old 04-10-2015 , 21:59   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #4

Quote:
i dont know if it is possible to keep playing after a successful connection
Thats not possible.

Quote:
i dont mind if the song has to restart after successfully connecting to the server (meaning player already inside the server right after connection) . But i do need it to repeat endlessly just for the first time the player is choosing teams/models. As soon as the player enters a team the music stops
There is already a plugin that does that, i just dont remenber the name (because there are way to many loading song plugins already), just scearch you will find it 4 sure.

Last edited by Syturi0; 04-10-2015 at 21:59.
Syturi0 is offline
pUnk
Member
Join Date: Apr 2009
Old 04-10-2015 , 22:31   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #5

Quote:
There is already a plugin that does that, i just dont remenber the name (because there are way to many loading song plugins already), just scearch you will find it 4 sure.
Well that's the thing i tried all of them but only these two work without errors, i would just like it for the first plugin i mentioned to repeat the song it randomly chose to keep looping when a player successfully enters the server and is still choosing a team. As soon as he/she chooses the team/model the song stops.
pUnk is offline
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 04-11-2015 , 10:00   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #6

Search keyword Loading+sound
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
pUnk
Member
Join Date: Apr 2009
Old 04-11-2015 , 16:05   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #7

Quote:
Search keyword Loading+sound
Quote:
Well that's the thing i tried all of them but only these two work without errors, i would just like it for the first plugin i mentioned to repeat the song it randomly chose to keep looping when a player successfully enters the server and is still choosing a team. As soon as he/she chooses the team/model the song stops.
pUnk is offline
pUnk
Member
Join Date: Apr 2009
Old 04-13-2015 , 13:31   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #8

Plz can any1 help me providing the code?
pUnk is offline
pUnk
Member
Join Date: Apr 2009
Old 04-27-2015 , 09:41   Re: [REQ] Edit Loading Song Advanced
Reply With Quote #9

So i got to work!

I merged Loading Song Advanced into Loading music and this is the result:

Spoiler


But i have a problem now.. I use bots on the server, and whenever i start the server or do a map change bots are added regardless of human players but are kicked when humans enter the server.
The plugin is acting as it should:

Connecting.......MUSIC!! (random)
Connected........MUSIC!! (random) (music played may differ from previous action: "connecting")
TeamChoosing...MUSIC!! (same music when successfully connected)
ModelChoosing...MUSIC!! (same as teamchoosing)
Playing.............MUSIC STOPS!!

All well and swell id say, But heres the thing when someone or a bot successfully connects to the server whereas already "in" the server the music plays for ALL the players already playing in the server. And when someone goes to spec it also plays a music for ALL the players.

Plz someone fix it so that only the player connected or spectating listens to the music and not everyone already inside the server.
Thx in advance for your effort!
pUnk 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 14:30.


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