Radio help -
N0FeaR - 03.05.2016
i am trying to make a radio for my business system but won't play up anything
PHP код:
CMD:bizradiostream(playerid, params[])
{
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 h = 0; h < sizeof(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 1: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=556684"); //Non stop
case 2: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=88086"); //Old school rap
case 3: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=396275"); //Katy Perry loop
case 4: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=772151"); //Radio Nemo
case 5: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=121874"); //Caminoweb Radio
case 6: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=203721"); //PlayHab.de
case 7: PlayAudioStreamForPlayerEx(playerid, "http://yp.shoutcast.com/sbin/tunein-station.m3u?id=457678"); //2Pac FanLoop Radio
case 9: PlayAudioStreamForPlayerEx(playerid, PlayerInfo[playerid][pRUrl]);
}
return true;
}
PHP код:
if(dialogid == DIALOG_TESTRADIO)
{
if(response)
{
GameTextForPlayer(playerid, "~w~Radio ~g~On", 5000, 6);
foreach (Player,i)
{
LoadBizzRadio(i);
}
}
}
Re: Radio help -
V1T0 - 03.05.2016
Use this to load radio:
new song_id = randomEx(1, 9);
LoadRadio(playerid, song_id);
Re: Radio help -
colonel-top - 04.05.2016
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
Re: Radio help -
Nin9r - 04.05.2016
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.