02.10.2010, 12:45
I was wondering how can i make the song play in the same car again when he exits the car and enter the car because i made it work but when he enters any car the song plays the same one but i want to know how can i make it play in the same car but not other cars, as he did /setstation.Heres my codes.
Please help thanks
.
Код:
new VehID = GetPlayerVehicleID(playerid);
new text[256];
/*if(audioid == 1) { text = "Dallas Blocker - Rock Ya Body"; }
else if(audioid == 2) { text = "Soulja Boy - Pretty Boy Swag"; }
else if(audioid == 3) { text = "******* - Rakim Y Ken Y Ft. Pitbull - Dime (Remix)"; }
else if(audioid == 4) { text = "Slim Thug Gangsta"; }
else if(audioid == 5) { text = "Birdman - Loyalty ft. Lil Wayne, Tyga"; }
else if(audioid == 6) { text = "Wisin y Yandel-Tu cuerpo a mi me provoca"; }
else if(audioid == 7) { text = "Wisin y Yandel-Tu cuerpo a mi me provoca"; }*/
for(new i = 0; i < GetMaxPlayers(); i++ )
{
if(GetPlayerVehicleID(i) == VehID)
{
if(Song[playerid] == 1) {
Audio_Stop(i,2);
Audio_Stop(i,3);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://173.192.58.37:8162", false, false, false);
return 1;
}
if(Song[playerid] == 2) {
Audio_Stop(i,1);
Audio_Stop(i,3);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://205.188.215.229:8040", false, false, false);
return 1;
}
if(Song[playerid] == 3) {
Audio_Stop(i,2);
Audio_Stop(i,1);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://216.155.137.149:8054", false, false, false);
return 1;
}
if(Song[playerid] == 4) {
Audio_Stop(i,2);
Audio_Stop(i,1);
Audio_Stop(i,3);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://205.188.215.230:8002", false, false, false);
return 1;
}
if(Song[playerid] == 5) {
Audio_Stop(i,2);
Audio_Stop(i,1);
Audio_Stop(i,4);
Audio_Stop(i,3);
Audio_PlayStreamed(i, "http://216.59.35.34:8030", false, false, false);
}
}
} }
Код:
if(strcmp(cmd, "/setstation", true) == 0)
{
if(IsPlayerConnected(playerid)) {
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /setstation [track]");
return 1;
}
new audioid;
audioid = strval(tmp);
new VehID = GetPlayerVehicleID(playerid);
new text[256];
/*if(audioid == 1) { text = "Dallas Blocker - Rock Ya Body"; }
else if(audioid == 2) { text = "Soulja Boy - Pretty Boy Swag"; }
else if(audioid == 3) { text = "******* - Rakim Y Ken Y Ft. Pitbull - Dime (Remix)"; }
else if(audioid == 4) { text = "Slim Thug Gangsta"; }
else if(audioid == 5) { text = "Birdman - Loyalty ft. Lil Wayne, Tyga"; }
else if(audioid == 6) { text = "Wisin y Yandel-Tu cuerpo a mi me provoca"; }
else if(audioid == 7) { text = "Wisin y Yandel-Tu cuerpo a mi me provoca"; }*/
for(new i = 0; i < GetMaxPlayers(); i++ )
{
if(IsPlayerInAnyVehicle(playerid))
{
if(GetPlayerVehicleID(i) == VehID)
{
//new string[256];
//new strings[256];
//new plname[MAX_PLAYER_NAME];
//GetPlayerName(playerid, plname, sizeof(plname));
//format(string, sizeof(string), "Now playing: %s", text);
//SendClientMessage(playerid, COLOR_LIGHTGREEN, string);
switch(audioid) {
case 1:
{
Audio_Stop(i,2);
Audio_Stop(i,3);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://173.192.58.37:8162", false, false, false);
Song[i] = 1;
OldCar[i] = VehID;
}
case 2:
{
Audio_Stop(i,1);
Audio_Stop(i,3);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://205.188.215.229:8040", false, false, false);
//Audio_Play(i,audioid, false,false, true);
Song[i] = 2;
OldCar[i] = VehID;
}
case 3:
{
Audio_Stop(i,2);
Audio_Stop(i,1);
Audio_Stop(i,4);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://216.155.137.149:8054", false, false, false);
//Audio_Play(i,audioid, false,false, true);
Song[i] = 3;
OldCar[i] = VehID;
}
case 4:
{
Audio_Stop(i,2);
Audio_Stop(i,3);
Audio_Stop(i,1);
Audio_Stop(i,5);
Audio_PlayStreamed(i, "http://205.188.215.230:8002", false, false, false);
//Audio_Play(i,audioid, false,false, true);
Song[i] = 4;
OldCar[i] = VehID;
}
case 5:
{
Audio_Stop(i,2);
Audio_Stop(i,3);
Audio_Stop(i,4);
Audio_Stop(i,1);
Audio_PlayStreamed(i, "http://216.59.35.34:8030", false, false, false);
//Audio_Play(i,audioid, false,false, true);
Song[i] = 5;
OldCar[i] = VehID;
}
}
}
}
}
}
return 1;
}
.

