23.10.2010, 13:33
Hey i am having a problem here how can i make the audio play like if someone owns a house and does /house radio 1 and when like some enters the house they could hear the music in the same interior i tryed to do that it works but it plays for all interiors how can i make it if someone does /enter and the house has its radio on it will play only for the same house interior or house that has the radio on? heres my code this one is part of my command for /house.
And this one is part of my /enter this is for houses.
Please help thanks.
Код:
if(strcmp(x_job,"radio",true) == 0) { tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /house radio [1-5]"); return 1; } if (HouseInfo[family][hRadio] != 1) { SendClientMessage(playerid, COLOR_GRAD2, "You don't own a radio at your house."); return 1; } new audioid; audioid = strval(tmp); GetPlayerName(playerid, playername, sizeof(playername)); if(PlayerInfo[playerid][pHousekey] != 255 && strcmp(playername, HouseInfo[PlayerInfo[playerid][pHousekey]][hOwner], true) == 0) { if(audioid < 1 || audioid > 5) { SendClientMessage(playerid,COLOR_GRAD3," Cannot be below 0, and not more then 5!"); return 1; } for(new i = 0; i < GetMaxPlayers(); i++ ) { new interior = GetPlayerInterior(playerid); if(GetPlayerInterior(i) == GetPlayerInterior(playerid)) { 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); //Audio_PlayStreamed(playerid, "http://173.192.58.37:8162", false, false, false); HouseInfo[family][hStation] = 1; //Song[playerid] = 1; } 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); HouseInfo[family][hStation] = 2; } 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); HouseInfo[family][hStation] = 3; } 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); HouseInfo[family][hStation] = 4; } 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); HouseInfo[family][hStation] = 5; } } } } OnPropUpdate(); } else { SendClientMessage(playerid, COLOR_GREEN, " You dont own a house !"); return 1; } } } return 1; }
Код:
new interior = GetPlayerInterior(playerid); for(new i = 0; i < GetMaxPlayers(); i++ ) { for(new h = 0; h < sizeof(HouseInfo); h++) { if(HouseInfo[h][hStation] == 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(HouseInfo[h][hStation] == 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(HouseInfo[h][hStation] == 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(HouseInfo[h][hStation] == 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(HouseInfo[h][hStation] == 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); return 1; } } }