SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts

Reply
 
Thread Tools Display Modes
Old 03/09/2018, 06:32 PM   #1
DavidSF
Little Clucker
 
Join Date: Nov 2015
Posts: 32
Reputation: 1
Default Boombox System

BOOMBOX SYSTEM by David Sfeir


Version 1.1

Hey pals,

Today i'm gonna release my Boombox system, hope you like it.

Introduction


It's a boombox system that players are able to play music even inside an interior or exterior.
Boombox had a specific music distance/range. You can stop/play the music at any time you wish.

Commands


- /boombox - to place/pickup the boombox (One boombox can be placed).
- /stopmusic - to stop the current music
- /playmusic - to play the current music

Download


Code:
/*

	BBBBBBB      OOOOOOOO    OOOOOOOO    MM      MM                BBBBBBB      OOOOOOOO     X       X
	B     B      O      O    O      O    M M    M M                B     B      O      O      X     X
	B      B     O      O    O      O    M  M  M  M                B      B     O      O       X   X
	BBBBBB       O      O    O      O    M   M    M                BBBBBB       O      O        XX
	B     B      O      O    O      O    M        M                B     B      O      O        XX
	B      B     O      O    O      O    M        M                B      B     O      O       X  X
	BBBBBBB      OOOOOOOO    OOOOOOOO    M        M                BBBBBBB      OOOOOOOO      X    X

	BOOMBOX SYSTEM BY DAVID SFEIR
	BOOMBOX V1.1

*/
#include <a_samp>
#include <zcmd>
#include <YSI\y_timers>
#include <sscanf2>
#include <streamer>
#include <foreach>
#include <audio>
#include <a_zones>
#include <zones>

#define FILTERSCRIPT

#define COLOR_PURPLE 0xC2A2DAAA

new BBPlaced[MAX_PLAYERS];
new ABBPlaced[MAX_PLAYERS];
new MusicsOn[MAX_PLAYERS];
new Musics[MAX_PLAYERS];
new test[MAX_PLAYERS];

new Float:Pos[4];

enum pInfo
{
	pMusic,
	pRadioID,
	pRadioURL,
};
new PlayerInfo[MAX_PLAYERS+1][pInfo];


public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" Boombox Filterscript by David Sfeir V1.1");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
	SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
	return 1;
}

public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/mycommand", cmdtext, true, 10) == 0)
	{
		// Do something here
		return 1;
	}
	return 0;
}

stock RadioMusicID(playerid)
{
	if(PlayerInfo[playerid][pRadioID] == 1)
	{
		PlayAudioStreamForPlayer(playerid, "http://listen.livestreamingservice.com/181-power_128k.mp3",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 2)
	{
		PlayAudioStreamForPlayer(playerid, "http://listen.livestreamingservice.com/181-uktop40_128k.mp3",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 3)
	{
		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1563092",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 4)
	{
		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=630803",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 5)
	{
		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=99217527",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 6)
	{
		PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1349680",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 7)
	{
		PlayAudioStreamForPlayer(playerid, "URL",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
	if(PlayerInfo[playerid][pRadioID] == 8)
	{
        PlayAudioStreamForPlayer(playerid, "URL",Pos[0], Pos[1], Pos[2], PlayerInfo[playerid][pMusic], 1);
	}
}

stock StopAudioEx(playerid)
{
    StopAudioStreamForPlayer(playerid);
}

CMD:stopmusic(playerid)
{
	if(Musics[playerid] == 0)
	{
	    SendClientMessage(playerid, -1, "Your music is already off!");
	    return 1;
	}
	StopAudioEx(playerid);
	Musics[playerid] = 0;
	return 1;
}

CMD:playmusic(playerid)
{
	if(BBPlaced[playerid] == 1)
	{
		if(Musics[playerid] == 1)
		{
		    SendClientMessage(playerid, -1, "Your music is already on!");
		    return 1;
		}
		if(IsPlayerInRangeOfPoint(playerid, PlayerInfo[playerid][pMusic], Pos[0], Pos[1], Pos[2]))
		{
			StopAudioStreamForPlayer(playerid);

			RadioMusicID(playerid);
			
			Musics[playerid] = 1;
		}
		else
		{
			SendClientMessage(playerid, -1,"You're not near the boombox!");
		}
	}
	else
	{
		SendClientMessage(playerid, -1,"No Boombox placed here!");
	}
	return 1;
}

CMD:boombox(playerid, params[])
{
	new Distances = strval(params);
	new RadioID[100];
	if(sscanf(params, "dd", Distances, RadioID))
	{
		SendClientMessage(playerid, -1, "USAGE: /boombox [distance] [RadioID] (Type it again to remove music)");
		SendClientMessage(playerid, -1, "{FFFFFF}[1] FM Power 181 (Top 40) {0000FF} - {FFFFAA} [2] U.K (Top 40) {0000FF} - {FFFFFF} [3] Power Hitz {0000FF} - {FFFFAA} [4] 100 Top Hits");
        SendClientMessage(playerid, -1, "{FFFFAA}[5] 113-FM Power {0000FF} - {FFFFFF} [6] Nashville FM (Country) {0000FF} - {FFFFAA} [7] Name {0000FF} - {FFFFFF} [8] Name");
		return 1;
	}
	if(Distances < 5 || Distances > 200)
	{
	    SendClientMessage(playerid, -1,"Can't go below 5 and above 200!");
	    return 1;
	}
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
 		if(MusicsOn[i] == 0)
   		{
			new string[256];
			new zone[MAX_ZONE_NAME];
			GetPlayer3DZone(playerid, zone, sizeof(zone));
			format(string, sizeof(string), "ANNOUNCEMENT: Party has just started at %s!",zone);
			SendClientMessage(i,-1,string);
		}
		if(IsPlayerConnected(i))
		{
		    if(ABBPlaced[i] == 1)
		    {
		    
                ABBPlaced[i] = 0;
                
		        DestroyDynamicObject(test[i]);
		        
		        DestroyDynamic3DTextLabel(Text3D:GetPVarInt(i, "pDynamicBBLabel"));
		        
		        DeletePVar(i, "pDynamicBBLabel");

		        DeletePVar(i, "pDynamicBB");
		        
		        DestroyDynamicObject(GetPVarInt(i, "pDynamicBB"));
		        
		        DeletePVar(playerid, "pDynamicBBArea");

		        MusicsOn[i] = 1;
		        
                Musics[i] = 0;
                
				BBPlaced[i] = 0;
				
				StopAudioEx(i);
				
				Streamer_Update(i);
		    }
		    else
		    {
		        
				GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
				GetPlayerFacingAngle(playerid, Pos[3]);

				if(IsPlayerInRangeOfPoint(playerid, strval(params), Pos[0], Pos[1], Pos[2]))
	 			{
					switch(RadioID[0])
					{
						case 1:
						{
							PlayerInfo[i][pRadioID] = 1;
						}
						case 2:
						{
                            PlayerInfo[i][pRadioID] = 2;
						}
						case 3:
						{
                            PlayerInfo[i][pRadioID] = 3;
						}
						case 4:
						{
                            PlayerInfo[i][pRadioID] = 4;
						}
						case 5:
						{
                            PlayerInfo[i][pRadioID] = 5;
						}
						case 6:
						{
                            PlayerInfo[i][pRadioID] = 6;
						}
						case 7:
						{
                            PlayerInfo[i][pRadioID] = 7;
						}
						case 8:
						{
                            PlayerInfo[i][pRadioID] = 8;
						}
						default: return SendClientMessage(playerid, -1, "Invalid station specified.");
					}
		
	    			MusicsOn[i] = 0;
	    			
	    			Musics[i] = 1;
	    			
	    			BBPlaced[i] = 1;
	    			
	    			ABBPlaced[i] = 1;
	    			
	    			PlayerInfo[i][pMusic] = strval(params);
	    			
	       			StopAudioStreamForPlayer(i);
	          		
	          		ApplyAnimation(playerid,"BOMBER","BOM_Plant_Crouch_In", 4.0, 0, 0, 0, 0, 0, 1);

	   			    Pos[0] += (2 * floatsin(-Pos[3], degrees));
			    	Pos[1] += (2 * floatcos(-Pos[3], degrees));
			    	Pos[2] -= 1.0;

					SetTimerEx("Music", 2000, 1, "i", i);
					
			        DestroyDynamicObject(GetPVarInt(i, "pDynamicBB"));

			        DeletePVar(i, "pDynamicBB");
			        
			        SetPVarInt(playerid, "pDynamicBB", 1);
			        
			        Streamer_Update(i);
					
					test[i] = CreateDynamicObject(2226, Pos[0], Pos[1], Pos[2], 0.0, 0.0, 0.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid));
				}
			}
		}
	}
	return 1;
}

forward Music(playerid);
public Music(playerid)
{
	new string[256];
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(MusicsOn[i] == 0 && IsPlayerInRangeOfPoint(i, PlayerInfo[playerid][pMusic], Pos[0], Pos[1], Pos[2]))
		{
		    MusicsOn[i] = 1;
			StopAudioStreamForPlayer(i);
			RadioMusicID(i);
			if(PlayerInfo[playerid][pRadioID] == 1)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} FM Power 181 (Top 40)\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
   				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 2)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} U.K (Top 40)\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
  				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 3)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} Power Hitz\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
  				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 4)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} 100 Top Hits\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
  				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 5)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} 113-FM Power\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
  				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 6)
			{
				format(string, sizeof(string), "{00FF00}Music:{FFFFFF} Nashville FM (Country)\n{FF0000}/stopmusic {FFFFFF},{FF0000} /playmusic{FFFFFF}");
  				SetPVarInt(i, "pDynamicBBLabel", _:CreateDynamic3DTextLabel(string, -1, Pos[0], Pos[1], Pos[2], 5.0, .worldid = GetPlayerVirtualWorld(playerid), .interiorid = GetPlayerInterior(playerid)));
			}
			if(PlayerInfo[playerid][pRadioID] == 7)
			{
			 //PUT URS
			}
			if(PlayerInfo[playerid][pRadioID] == 8)
			{
			 //PUT URS
			}
		 }
 	}
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}
~ Thank you!
DavidSF is offline   Reply With Quote
Old 03/09/2018, 07:06 PM   #2
Florin48
Huge Clucker
 
Join Date: Nov 2015
Location: Romania
Posts: 266
Reputation: 5
Default Re: Boombox System

work yt link?
Florin48 is offline   Reply With Quote
Old 03/09/2018, 07:09 PM   #3
CodeStyle175
Banned
 
Join Date: Apr 2014
Posts: 459
Reputation: 35
Default Re: Boombox System

again delete this shit and start again
CodeStyle175 is offline   Reply With Quote
Old 03/09/2018, 09:04 PM   #4
KinderClans
Banned
 
Join Date: May 2018
Location: Italy
Posts: 720
Reputation: 43
Default Re: Boombox System

Quote:
Originally Posted by CodeStyle175 View Post
again delete this shit and start again
You're so human
KinderClans is offline   Reply With Quote
Old 04/09/2018, 07:40 AM   #5
EzeGODezE
Banned
 
Join Date: Mar 2018
Posts: 80
Reputation: 15
Default Re: Boombox System

+raped
EzeGODezE is offline   Reply With Quote
Old 04/09/2018, 05:30 PM   #6
SonnyGamer
Huge Clucker
 
SonnyGamer's Avatar
 
Join Date: Jun 2017
Posts: 322
Reputation: 85
Default Re: Boombox System

Good Job
SonnyGamer is offline   Reply With Quote
Old 05/09/2018, 02:11 AM   #7
Pottus
High-roller
 
Pottus's Avatar
 
Join Date: Jun 2012
Posts: 4,851
Reputation: 1292
Default Re: Boombox System

It's 2/5 at least there is somewhat of a good effort for someone who doesn't know much yet. But overall this shouldn't really qualify as a release.
Pottus is offline   Reply With Quote
Old 05/09/2018, 03:42 AM   #8
Variable™
Gangsta
 
Join Date: Jul 2015
Posts: 802
Reputation: 175
Default Re: Boombox System

Quote:
Originally Posted by EzeGODezE View Post
+raped
rape me i rape you back?



https://prnt.sc/kqpvxc



OT: Not really bad nor good. Keep going anyway.
__________________
Discord | Website
Variable™ is offline   Reply With Quote
Old 05/09/2018, 09:26 AM   #9
OTACON
Banned
 
Join Date: Dec 2010
Location: mongolia
Posts: 4,930
Reputation: 569
Default Re: Boombox System

really ... frightening.

-200000 rep.
OTACON is offline   Reply With Quote
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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Ajuda] Boombox System MineiriinHo Português/Portuguese 0 22/04/2016 11:49 PM
[FilterScript] Boombox System Alex Valdez Filterscripts 9 16/10/2014 08:38 AM
[FilterScript] Stalker's Boombox system. GreenSt4lker Filterscripts 0 05/09/2014 12:46 PM
How to make BoomBox system ! ngumcutoi1999 Scripting Help 14 17/07/2013 01:58 AM
[Help] Please help on my boombox system! popystone Scripting Help 28 21/08/2012 07:26 AM


All times are GMT. The time now is 11:45 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.