[FilterScript] Random Music OnPlayerConnect
#1

Random Music
PHP Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Random Music By: GreenEye Loaded");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    print(
"\n--------------------------------------");
    print(
" Random Music By: GreenEye UNLoaded ");
    print(
"--------------------------------------\n");
    return 
1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
        new 
rmusic random(25);
        switch (
rmusic)
        {
        case 
0PlayAudioStreamForPlayer(playerid,"https://xsfserver.com/music/Club.mp3");
        case 
1PlayAudioStreamForPlayer(playerid,"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3");
        case 
2PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesLoveMe.mp3");
        case 
3PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BigPoppa.mp3");
        case 
4PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesandBottles.mp3");
        case 
5PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/CountingStars.mp3");
        case 
6PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LoveSosa.mp3");
        case 
7PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Gangnam.mp3");
        case 
8PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Forever.mp3");
        case 
9PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Sexy.mp3");
        case 
10PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SexyChick.mp3");
        case 
11PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SmokeANigga.mp3");
        case 
12PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/RapGod.mp3");
        case 
13PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/animals.mp3");
        case 
14PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/sPartyRocking.mp3");
        case 
15PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WhatIsLove.mp3");
        case 
16PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WildBoy.mp3");
        case 
17PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/MyLife.mp3");
        case 
18PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Lights.mp3");
        case 
19PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LetItRock.mp3");
        case 
20PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/GoodLife.mp3");
        case 
21PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/HotNigga.mp3");
        case 
22PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1");
        case 
23PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1");
        case 
24PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1");
        case 
25PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1");
        }
        return 
1;

Reply
#2

Seems nice, will test it. +REP
EDIT: Works perfectly.
Reply
#3

Good.
Reply
#4

Thank You
Reply
#5

PHP Code:
#include <a_samp>
new MusicRandom[][]={
    { 
"https://xsfserver.com/music/Club.mp3" },
    { 
"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3" },
    { 
"http://xsfserver.com/music/BitchesLoveMe.mp3" },
    { 
"http://xsfserver.com/music/BigPoppa.mp3" },
    { 
"http://xsfserver.com/music/BitchesandBottles.mp3" },
    { 
"http://xsfserver.com/music/CountingStars.mp3" },
    { 
"http://xsfserver.com/music/LoveSosa.mp3" },
    { 
"http://xsfserver.com/music/Gangnam.mp3" },
    { 
"http://xsfserver.com/music/Forever.mp3" },
    { 
"http://xsfserver.com/music/Sexy.mp3" },
    { 
"http://xsfserver.com/music/SexyChick.mp3" },
    { 
"http://xsfserver.com/music/SmokeANigga.mp3" },
    { 
"http://xsfserver.com/music/RapGod.mp3" },
    { 
"http://xsfserver.com/music/animals.mp3" },
    { 
"http://xsfserver.com/music/sPartyRocking.mp3" },
    { 
"http://xsfserver.com/music/WhatIsLove.mp3" },
    { 
"http://xsfserver.com/music/WildBoy.mp3" },
    { 
"http://xsfserver.com/music/MyLife.mp3" },
    { 
"http://xsfserver.com/music/Lights.mp3" },
    { 
"http://xsfserver.com/music/LetItRock.mp3" },
    { 
"http://xsfserver.com/music/GoodLife.mp3" },
    { 
"http://xsfserver.com/music/HotNigga.mp3" },
    { 
"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1" },
    { 
"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1" },
    { 
"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1" },
    { 
"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1" } };
public 
OnPlayerConnect(playeridPlayAudioStreamForPlayer(playerid,  MusicRandom[random(sizeof(MusicRandom))] ); 
Reply
#6

Code:
public OnPlayerConnect(playerid)
{
        new rmusic = random(25);
        switch (rmusic)
        {
        case 0: PlayAudioStreamForPlayer(playerid,"https://xsfserver.com/music/Club.mp3");
        case 1: PlayAudioStreamForPlayer(playerid,"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3");
        case 2: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesLoveMe.mp3");
        case 3: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BigPoppa.mp3");
        case 4: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesandBottles.mp3");
        case 5: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/CountingStars.mp3");
        case 6: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LoveSosa.mp3");
        case 7: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Gangnam.mp3");
        case 8: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Forever.mp3");
        case 9: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Sexy.mp3");
        case 10: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SexyChick.mp3");
        case 11: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SmokeANigga.mp3");
        case 12: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/RapGod.mp3");
        case 13: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/animals.mp3");
        case 14: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/sPartyRocking.mp3");
        case 15: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WhatIsLove.mp3");
        case 16: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WildBoy.mp3");
        case 17: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/MyLife.mp3");
        case 18: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Lights.mp3");
        case 19: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LetItRock.mp3");
        case 20: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/GoodLife.mp3");
        case 21: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/HotNigga.mp3");
        case 22: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1");
        case 23: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1");
        case 24: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1");
        case 25: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1");
        }
        return 1;
}
The last link of song won't work because you stored 25 random songs and they are 26

Code:
public OnPlayerConnect(playerid)
{
        new rmusic = random(26);
        switch (rmusic)
        {
        case 0: PlayAudioStreamForPlayer(playerid,"https://xsfserver.com/music/Club.mp3");
        case 1: PlayAudioStreamForPlayer(playerid,"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3");
        case 2: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesLoveMe.mp3");
        case 3: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BigPoppa.mp3");
        case 4: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesandBottles.mp3");
        case 5: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/CountingStars.mp3");
        case 6: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LoveSosa.mp3");
        case 7: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Gangnam.mp3");
        case 8: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Forever.mp3");
        case 9: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Sexy.mp3");
        case 10: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SexyChick.mp3");
        case 11: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SmokeANigga.mp3");
        case 12: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/RapGod.mp3");
        case 13: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/animals.mp3");
        case 14: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/sPartyRocking.mp3");
        case 15: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WhatIsLove.mp3");
        case 16: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WildBoy.mp3");
        case 17: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/MyLife.mp3");
        case 18: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Lights.mp3");
        case 19: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LetItRock.mp3");
        case 20: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/GoodLife.mp3");
        case 21: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/HotNigga.mp3");
        case 22: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1");
        case 23: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1");
        case 24: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1");
        case 25: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1");
        }
        return 1;
}
This is the right code
Reply
#7

Thanks For Correcting
Reply
#8

Quote:
Originally Posted by GreenEye
View Post
Random Music
PHP Code:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Random Music By: GreenEye Loaded");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    print(
"\n--------------------------------------");
    print(
" Random Music By: GreenEye UNLoaded ");
    print(
"--------------------------------------\n");
    return 
1;
}
#else
#endif
public OnPlayerConnect(playerid)
{
        new 
rmusic random(25);
        switch (
rmusic)
        {
        case 
0PlayAudioStreamForPlayer(playerid,"https://xsfserver.com/music/Club.mp3");
        case 
1PlayAudioStreamForPlayer(playerid,"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3");
        case 
2PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesLoveMe.mp3");
        case 
3PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BigPoppa.mp3");
        case 
4PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesandBottles.mp3");
        case 
5PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/CountingStars.mp3");
        case 
6PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LoveSosa.mp3");
        case 
7PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Gangnam.mp3");
        case 
8PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Forever.mp3");
        case 
9PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Sexy.mp3");
        case 
10PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SexyChick.mp3");
        case 
11PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SmokeANigga.mp3");
        case 
12PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/RapGod.mp3");
        case 
13PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/animals.mp3");
        case 
14PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/sPartyRocking.mp3");
        case 
15PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WhatIsLove.mp3");
        case 
16PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WildBoy.mp3");
        case 
17PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/MyLife.mp3");
        case 
18PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Lights.mp3");
        case 
19PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LetItRock.mp3");
        case 
20PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/GoodLife.mp3");
        case 
21PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/HotNigga.mp3");
        case 
22PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1");
        case 
23PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1");
        case 
24PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1");
        case 
25PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1");
        }
        return 
1;

Awesome! REPD!

(rep me back please)
Reply
#9

First,nice..and remove // before #define FILTERSCRIPT lol
And i think you must stop playing OnPlayerSpawn
Reply
#10

Hello guys I just made some corrections on this script check my update

SecretBoss's Update

• Fixed a problem that 26th song didn't load
• Chat now clears and then playing the song
• Song now stops after player spawning


Code:

Code:
//=================================================[Includes]
#include <a_samp>

//=================================================[Callbacks]
public OnFilterScriptInit()
{
    print("\n-------------------------------------------");
    print(" Random Music by GreenEye (SecretBoss Update)");
    print(" 		Loaded...                           ");
    print("-------------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    print("\n-------------------------------------------");
    print(" Random Music by GreenEye (SecretBoss Update)");
    print(" 		Unloaded...                         ");
    print("-------------------------------------------\n");
    return 1;
}

public OnPlayerConnect(playerid)
{
	// Plays random music
	new rmusic = random(26);
 	switch (rmusic)
  	{
		case 0: PlayAudioStreamForPlayer(playerid,"https://xsfserver.com/music/Club.mp3");
   		case 1: PlayAudioStreamForPlayer(playerid,"https://a.tumblr.com/tumblr_mmx0g4qjil8omo1.mp3");
   		case 2: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesLoveMe.mp3");
   		case 3: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BigPoppa.mp3");
   		case 4: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/BitchesandBottles.mp3");
   		case 5: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/CountingStars.mp3");
        case 6: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LoveSosa.mp3");
        case 7: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Gangnam.mp3");
        case 8: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Forever.mp3");
        case 9: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Sexy.mp3");
        case 10: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SexyChick.mp3");
        case 11: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/SmokeANigga.mp3");
        case 12: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/RapGod.mp3");
        case 13: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/animals.mp3");
        case 14: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/sPartyRocking.mp3");
        case 15: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WhatIsLove.mp3");
        case 16: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/WildBoy.mp3");
        case 17: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/MyLife.mp3");
        case 18: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/Lights.mp3");
        case 19: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/LetItRock.mp3");
        case 20: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/GoodLife.mp3");
        case 21: PlayAudioStreamForPlayer(playerid,"http://xsfserver.com/music/HotNigga.mp3");
        case 22: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/i4t87fvile4omxj/AlorsStremae.mp3?dl=1");
        case 23: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/vaidubo8ftyv1ce/La%20Policia.mp3?dl=1");
        case 24: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/54h4ijc7ffxftdx/Black%20Widow.mp3?dl=1");
        case 25: PlayAudioStreamForPlayer(playerid,"https://dl.dropbox.com/s/hhn2bf160tgzn0g/MemoriesDG.mp3?dl=1");
	}
	
	// Clear the chat
 	for(new i = 0; i <= 100; i ++)
	{
		SendClientMessage(playerid, -1, " ");
	}
 	return 1;
}

public OnPlayerSpawn(playerid)
{
	// Stops all the sounds
    StopAudioStreamForPlayer(playerid);
	return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)