Radio help
#1

i am trying to make a radio for my business system but won't play up anything


PHP код:
CMD:bizradiostream(playeridparams[])
{
    if (
PlayerInfo[playerid][pBusiness] == INVALID_BUSINESS_ID || PlayerInfo[playerid][pBusinessRank] < 5)
    {
        return 
SendErrorMessage(playerid"Only business owners can use this command.");
    }
    if(
GetPVarInt(playerid"InBusiness") == 1)
    {
        
//ShowPlayerDialog(playerid, DIALOG_BUSINESS, DIALOG_STYLE_LIST, "{FF9900}Business", "Radio", "Select", "Cancel");
        
ShowPlayerDialog(playerid,DIALOG_TESTRADIO,DIALOG_STYLE_LIST,"Bizz Radio","Play Radio Stations\nPlay Direct Link\nTurn Off","Select""Exit");
    }
    else return 
SendErrorMessage(playerid"You're not in your business");
    return 
1;

PHP код:
stock LoadBizzRadio(playerid)
{
    for(new 
0sizeof(Businesses); h++)
    {
        if(
Businesses[h][bOwned] == 1)
        {
            if(
IsPlayerInRangeOfPoint(playerid,50.0,Businesses[h][bExtPos][0], Businesses[h][bExtPos][1], Businesses[h][bExtPos][2]))
            {
                if(
GetPlayerVirtualWorld(playerid) == h+BUSINESS_BASE_VW)
                {
                    if(
GetPVarInt(playerid"BizzEnter") == h)
                    {
                        if(
Businesses[h][bRadio] == 0)
                        {
                            
StopAudioStreamForPlayerEx(playerid);
                            
DeletePVar(playerid,"Radio");
                            return 
1;
                        }
                        else
                        {
                            if(
GetPVarInt(playerid"Radio") != Businesses[h][bRadio])
                            {
                                
SetPVarInt(playerid"Radio"Businesses[h][bRadio]);
                                
format(PlayerInfo[playerid][pRUrl], 128"%s"Businesses[h][bURL]);
                                
LoadRadio(playerid,Businesses[h][bRadio]);
                                return 
1;
                            }
                        }
                    }
                }
            }
        }
    }
    return 
true;
}
stock LoadRadio(playerid,songid)
{
    switch(
songid)
    {
        case 
1PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
        
case 2PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=88086"); //Old school rap
        
case 3PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=396275"); //Katy Perry loop
        
case 4PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
        
case 5PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
        
case 6PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
        
case 7PlayAudioStreamForPlayerEx(playerid"http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio
        
case 9PlayAudioStreamForPlayerEx(playeridPlayerInfo[playerid][pRUrl]);
    }
    return 
true;

PHP код:
    if(dialogid == DIALOG_TESTRADIO)
      {
           if(
response)
         {
             
GameTextForPlayer(playerid"~w~Radio ~g~On"50006);
               foreach (
Player,i)
            {
                  
LoadBizzRadio(i);
            }
        }
    } 
Reply
#2

Use this to load radio:

new song_id = randomEx(1, 9);
LoadRadio(playerid, song_id);
Reply
#3

When you new variable Businesses[h][bRadio] try set it all as -1 because
as I see
PHP код:
if(GetPVarInt(playerid"Radio") != Businesses[h][bRadio]) 
maybe
pawn Код:
PVarInt playerid radio something != null value maybe its pass
make it simply try define variable bRadio = -1 at first
and maybe try setPVarInt when player connect as something like 100 or -1
Reply
#4

you can do it easier. add a new field to your businesses like bRadio[64].

After this, make a command /radio to insert/select an url. Then, you will save it on your field like:
Код HTML:
format(businessVariables[PlayerInfo[playerid][pBusinessID]][bRadio], 200, "http://url:port/");
This will save the url on your business. After, you will put it
Код HTML:
for(new x = 0; x < MAX_BUSINESSES; x++)
		{
PlayAudioStreamForPlayer(playerid, businessVariables[x][bRadio]);
}
when a player enter in a business.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)