Radio System Help
#1

hey so I have a car radio system that is working just fine as I wanted when I play the radio the one with my car here same song too so I'm thinking of that if there is someone near the car and I'm playing radio he can hear the song and as log he go far from the far the volume decrease is there any way to do it ?
here is the code
Код:
CMD:radio(playerid, params[])
{
	new option[128], player[128];
	if(sscanf(params, "s", option))
    {
        SendClientMessage(playerid, COLOR_YELLOW, "{FFFFFF} /radio [Option]");
        SendClientMessage(playerid, COLOR_YELLOW, "{FFFFFF} Options:URL, 0,1,2,3,4,5[0=clean bandit, 1=turn down for what, 2=Dont Let me down, 3=Faded, 4=IamTheOne,URL]");
        return 1;
    }
	{

	        if (strcmp(option, "0", true) == 0)
	        {
				new vehicle = GetPlayerVehicleID(playerid);
                for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/cleanbandit.mp3");
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
				return 1;
      		}
	        if (strcmp(option, "1", true) == 0)
	        {
				new vehicle = GetPlayerVehicleID(playerid);
                for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/turndown.mp3");
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
				return 1;
      		}
	        if (strcmp(option, "2", true) == 0)
	        {
				new vehicle = GetPlayerVehicleID(playerid);
                for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/chain2.mp3");
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
				return 1;
      		}
	        if (strcmp(option, "3", true) == 0)
	        {
				new vehicle = GetPlayerVehicleID(playerid);
                for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/faded.mp3");
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
				return 1;
      		}
        	if (strcmp(option, "4", true) == 0)
	        {
				new vehicle = GetPlayerVehicleID(playerid);
                for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, "http://rintixmusic.000webhostapp.com/music/iamtheone.mp3");
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
				return 1;
      		}
			if(isnull(params)) return SendClientMessage(playerid, -1, "USAGE: /radio [url]");
			new vehicle = GetPlayerVehicleID(playerid);
			for(new i; i < MAX_PLAYERS; i++)
                {
					new playercar = GetPlayerVehicleID(i);
					if(playercar == vehicle)
                    {
						carradio[i] = 1;
						PlayAudioStreamForPlayer(i, params);
					}
				}
				new changer[MAX_PLAYER_NAME+1], string[48+MAX_PLAYER_NAME+1];
    			GetPlayerName(playerid, changer, sizeof(string));
         		new Float:x, Float:y, Float:z;
				GetPlayerPos(playerid, x, y, z);
				for(new i2; i2 < MAX_PLAYERS; i2++)
				{
					if(IsPlayerInRangeOfPoint(i2, 10.0, x, y, z))
					{
        				format(string, sizeof(string),  "%s reaches for the car stereo and turns some knobs.", changer);
						SendClientMessage(i2, 0xC2A2DAAA, string);
					}
				}
	}
	return 1;
}
Reply
#2

Yes by placing hidden boomboxes

I think this link will help

https://sampforum.blast.hk/showthread.php?tid=437575
https://sampforum.blast.hk/showthread.php?tid=463447
https://sampforum.blast.hk/showthread.php?tid=456503

I don't own those threads, this are filterscripts for boombox just read the codes and grab some ideas from it.

Just don't add the boombox and textdraws. Hope those filterscripts will help.
Reply
#3

Hidden boomboxes wot?


Just get the pos of the car and play the same audio stream there...
This topic is about this:
https://sampforum.blast.hk/showthread.php?tid=546721
Reply
#4

Quote:
Originally Posted by JesterlJoker
Посмотреть сообщение
Yes by placing hidden boomboxes

I think this link will help

https://sampforum.blast.hk/showthread.php?tid=437575
https://sampforum.blast.hk/showthread.php?tid=463447
https://sampforum.blast.hk/showthread.php?tid=456503

I don't own those threads, this are filterscripts for boombox just read the codes and grab some ideas from it.

Just don't add the boombox and textdraws. Hope those filterscripts will help.
Hidden boomboxes? Seriously?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)