SA-MP Forums Archive
Radio Simple Question! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Radio Simple Question! (/showthread.php?tid=366485)



Radio Simple Question! - Akcent_Voltaj - 06.08.2012

how can i make it like i want to hear diffrent music in difrent location how can i do it??



PHP код:
public OnPlayerUpdate(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    if(
IsPlayerNPC(playerid)) return 1;
    
// Handle playing SomaFM at the alhambra
    
if(GetPlayerInterior(playerid) == 0) {
        if(
IsPlayerInRangeOfPoint(playerid,70.0,251.5308,-1807.7228,7.8359)) { // Discoteca
            
if(!GetPVarInt(playerid,"alhambra")) {
                
SetPVarInt(playerid,"alhambra",1);
                
PlayAudioStreamForPlayer(playerid"http://srv2.radioboss.ro:8888",251.5308,-1807.7228,7.8359,70.0,true);
            }
        }
    }
    else {
        if(
GetPVarInt(playerid,"alhambra")) {
              
DeletePVar(playerid,"alhambra");
               
StopAudioStreamForPlayer(playerid);
        }
    }
    return 
1;




Re: Radio Simple Question! - DeathOnaStick - 06.08.2012

I think there is a callback that is called when you enter an interior, I would use this one. Would be much better than using OnPlayerUpdate. I'd check the interiorID, if it's the alhambra, play the stream, if it's not, stop the stream.

Kinda easy, huh?


Re: Radio Simple Question! - Akcent_Voltaj - 06.08.2012

i want so i do else you know andi want diffrent radio at a diffrent location you know..


Re: Radio Simple Question! - Ranama - 06.08.2012

you just list all the different interior, use it like this,
pawn Код:
if(interiorid == alhambra)//change this to the real thing
{
StopAudioStreamForPlayer(playerid);
PlayAudioStreamForPlayer(playerid, "http://srv2.radioboss.ro:8888");
}
else if(interiorid == gunshop){
StopAudioStreamForPlayer(playerid);
PlayAudioStreamForPlayer(playerid, "http://www.yourcoolradiostation.com");
}
//here you list more interiors and radio stations you want
else StopAudioStreamForPlayer(playerid);//this means that you haven't listed a music station for that interior and it will stop
Hope it helped