Vehicle Radio Listing
#5

Quote:
Originally Posted by AchievementMaster360
Посмотреть сообщение
What is your /setradio? I've compiled it fine.
Код:
CMD:setstation(playerid, params[]) {
    if(!IsPlayerInAnyVehicle(playerid)) {
		return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be in a car to use a car radio.");
	}
    else if(isnull(params)) {
        SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /setstation [station] (0 - 3)");
		SendClientMessageEx(playerid, COLOR_GRAD2, "(0) Stop Radio (1) Hot 108 Jamz - (2) Los Santos Radio - (3) #1 Stop for Hip Hop");
        return 1;
    }
    new string[128], station[256];
	switch(strval(params)) {
			case 0: {
			format(string, sizeof(string), "%s turns off the radio.",GetPlayerNameEx(playerid));
			foreach(Player, i) if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid)){
				StopAudioStreamForPlayer(i);
				//stationidp[i] = 0;
				stationidv[GetPlayerVehicleID(playerid)] = 0;
			}
		}
		case 1: {
			format(string, sizeof(string), "%s changes the station to Hot 108 Jamz.",GetPlayerNameEx(playerid));
			PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
			stationidv[GetPlayerVehicleID(playerid)] = 1;
		}
		case 2: {
			format(string, sizeof(string), "%s changes the station to Los Santos Radio.",GetPlayerNameEx(playerid));
			PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
			stationidv[GetPlayerVehicleID(playerid)] = 2;
		}
		case 3: {
			format(string, sizeof(string), "%s changes the station to #1 stop for Hip Hop",GetPlayerNameEx(playerid));
			PlayAudioStreamForPlayer(playerid, "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1269052");
			stationidv[GetPlayerVehicleID(playerid)] = 3;
		}
		default: return SendClientMessageEx(playerid, COLOR_GRAD2, "Invalid station specified.");
	}

    ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

    foreach(Player, i) if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid) && Audio_IsClientConnected(i)) {
		Audio_Stop(i, stationidp[i]);
		stationidp[i] = Audio_PlayStreamed(i, station, false, true, false);
		Audio_SetVolume(i, stationidp[i], 30);
    }
    return 1;
}

CMD:setradio(playerid, params[]) {
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
        ShowPlayerDialog(playerid, DIALOG_RADIOMENU_START, DIALOG_STYLE_LIST, "Radio station", "Turn off radio\nSearch by name\nFind by genre", "Select", "Cancel");
    else SendClientMessage(playerid, COLOR_GRAD1, "You're not driving any vehicle.");

    return 1;
}
CMD:setvolume(playerid, params[])
{
	new
	iVolume = strval(params);

	if(!IsPlayerInAnyVehicle(playerid)) {
		return SendClientMessageEx(playerid, COLOR_GRAD2, "You must be in a car to use a car radio.");
	}
	else if(isnull(params)) {
		return SendClientMessageEx(playerid, COLOR_GRAD2, "USAGE: /setvolume [volume] (0-100)");
	}
	else if(!(0 <= iVolume <= 100)) {
		return SendClientMessageEx(playerid, COLOR_GRAD2, "Volume must be between 0 and 100.");
	}
	else {

		new
		string[36 + MAX_PLAYER_NAME];

		format(string, sizeof(string), "* %s changes the radio volume to %d.", GetPlayerNameEx(playerid), iVolume);
		ProxDetector(5.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

		volumeidv[GetPlayerVehicleID(playerid)] = iVolume;
		foreach(Player, i) {
			if(GetPlayerVehicleID(i) == GetPlayerVehicleID(playerid)) {
				Audio_SetVolume(i, stationidp[i], iVolume);
			}
		}
	}
	return 1;
}
Reply


Messages In This Thread
Vehicle Radio Listing - by eclipses - 31.10.2015, 16:13
Re: Vehicle Radio Listing - by AbyssMorgan - 31.10.2015, 16:19
Re: Vehicle Radio Listing - by eclipses - 31.10.2015, 16:22
Re: Vehicle Radio Listing - by AchievementMaster360 - 31.10.2015, 16:26
Re: Vehicle Radio Listing - by eclipses - 31.10.2015, 16:31
Re: Vehicle Radio Listing - by AbyssMorgan - 31.10.2015, 16:32
Re: Vehicle Radio Listing - by eclipses - 31.10.2015, 16:36
Re: Vehicle Radio Listing - by eclipses - 31.10.2015, 16:41

Forum Jump:


Users browsing this thread: 1 Guest(s)