Radio doesn't work
#1

Код:
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 - no station)");
        SendClientMessageEx(playerid, COLOR_GRAD2, "(1) NGG K-LSR - (2) 181.FM: The Buzz - (3) 181.FM: Blues - (4) 181.FM: Classic Hits - (5) 181.FM: Kickin' Country");
        SendClientMessageEx(playerid, COLOR_GRAD2, "(6) 181.FM: Highway 181 - (7) COOL93 - (8) TechnoBase.FM - (9) Dubplate.FM - (10) Word of Truth Radio");
        SendClientMessageEx(playerid, COLOR_GRAD2, "(11) SKY.FM: Jazz - (12) MovidaMix - (13) #MUSIK.EXTREME - (14) SKY.FM: New Age - (15) .977 The Hitz Channel");
        SendClientMessageEx(playerid, COLOR_GRAD2, "(16) KCRW ALL NEWS - (17) HOT 108 JAMZ - (18) Reggae141 - (19) RMF FM - (20) French Kiss FM");
		SendClientMessageEx(playerid, COLOR_GRAD2, "(21) DEFJAY - (22) 181.FM Hairband - (23) Idobi Radio");
        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) && Audio_IsClientConnected(i)){
				Audio_Stop(i, stationidp[i]);
				stationidp[i] = 0;
				stationidv[GetPlayerVehicleID(playerid)] = 0;
			}
		}
		case 1: {
			format(string, sizeof(string), "* %s changes the station to K-LSR.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://216.246.109.162:8000");
			stationidv[GetPlayerVehicleID(playerid)] = 1;
		}
		case 2: {
			format(string, sizeof(string), "* %s changes the station to 181.FM - The Buzz.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1415249");
			stationidv[GetPlayerVehicleID(playerid)] = 2;
		}
		case 3: {
			format(string, sizeof(string), "* %s changes the station to 1.FM - Blues.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1270282");
			stationidv[GetPlayerVehicleID(playerid)] = 3;
		}
		case 4: {
			format(string, sizeof(string), "* %s changes the station to 181.FM - Classic Hitss.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628721");
			stationidv[GetPlayerVehicleID(playerid)] = 4;
		}
		case 5: {
			format(string, sizeof(string), "* %s changes the station to 181.FM - Kickin' Country.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1283687");
			stationidv[GetPlayerVehicleID(playerid)] = 5;
		}
		case 6: {
			format(string, sizeof(string), "* %s changes the station to .181.FM - Highway 181.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1628932");
			stationidv[GetPlayerVehicleID(playerid)] = 6;
		}
		case 7: {
			format(string, sizeof(string), "* %s changes the station to COOL93.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1756658");
			stationidv[GetPlayerVehicleID(playerid)] = 7;
		}
		case 8: {
			format(string, sizeof(string), "* %s changes the station to TechnoBase.FM.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1377200");
			stationidv[GetPlayerVehicleID(playerid)] = 8;
		}
		case 9: {
			format(string, sizeof(string), "* %s changes the station to Dubplate.FM.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057197");
			stationidv[GetPlayerVehicleID(playerid)] = 9;
		}
		case 10: {
			format(string, sizeof(string), "* %s changes the station to Word of Truth Radio.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=18695");
			stationidv[GetPlayerVehicleID(playerid)] = 10;
		}
		case 11: {
			format(string, sizeof(string), "* %s changes the station to Absolutley Smooth Jazz - SKY.FM.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
			stationidv[GetPlayerVehicleID(playerid)] = 11;
		}
		case 12: {
			format(string, sizeof(string), "* %s changes the station to MovidaMix.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=181367");
			stationidv[GetPlayerVehicleID(playerid)] = 12;
		}
		case 13: {
			format(string, sizeof(string), "* %s changes the station to #MUSIK.EXTREME.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1275071");
			stationidv[GetPlayerVehicleID(playerid)] = 13;
		}
		case 14: {
			format(string, sizeof(string), "* %s changes the station to New Age - SKY.FM",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=412093");
			stationidv[GetPlayerVehicleID(playerid)] = 14;
		}
		case 15: {
			format(string, sizeof(string), "* %s changes the station to .977 The Hitz Channel.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280356");
			stationidv[GetPlayerVehicleID(playerid)] = 15;
		}
		case 16: {
			format(string, sizeof(string), "* %s changes the station to KCRW ALL NEWS.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1279013");
			stationidv[GetPlayerVehicleID(playerid)] = 16;
		}
		case 17: {
			format(string, sizeof(string), "* %s changes the station to HOT 108 JAMZ.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1281016");
			stationidv[GetPlayerVehicleID(playerid)] = 17;
		}
		case 18: {
			format(string, sizeof(string), "* %s changes the station to Raggae141.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1280855");
			stationidv[GetPlayerVehicleID(playerid)] = 18;
		}
		case 19: {
			format(string, sizeof(string), "* %s changes the station to RMF FM.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=1116397");
			stationidv[GetPlayerVehicleID(playerid)] = 19;
		}
		case 20: {
			format(string, sizeof(string), "* %s changes the station to French Kiss FM.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=2057543");
			stationidv[GetPlayerVehicleID(playerid)] = 20;
		}
		case 21: {
			format(string, sizeof(string), "* %s changes the station to DEFJAY.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=616366");
			stationidv[GetPlayerVehicleID(playerid)] = 21;
		}
		case 22: {
			format(string, sizeof(string), "* %s changes the station to 181.FM Hairband Radio.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://38.107.220.164:8014");
			stationidv[GetPlayerVehicleID(playerid)] = 22;
		}
		case 23: {
			format(string, sizeof(string), "* %s changes the station to Idobi Radio.",GetPlayerNameEx(playerid));
			format(station, sizeof(station), "http://yp.shoutcast.com/sbin/tunein-station.pls?id=847066");
			stationidv[GetPlayerVehicleID(playerid)] = 23;
		}
		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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)