This topic was marked solved by Stormeus, on November 23rd, 2014, 07:14 PM
[BUG] Why is this not working?

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 439
[BUG] Why is this not working?
« on November 22nd, 2014, 08:22 PM »
Code: [Select]
else if ( cmd == "radio" )
{
player.Vehicle = CreateRadioStream( "Sertanejo", "http://64.15.147.221:9026", true );
}

Code: [Select]
if( !sucess ) tryAgain();

Stormeus

  • VC:MP Developer
  • oh god how did i get here im not good w computer
  • Posts: 1,123
[BUG] Re: Why is this not working?
« Reply #1, on November 22nd, 2014, 10:03 PM »
Why are you setting a vehicle to a radio stream?

You're looking for player.Vehicle.Radio = CreateRadioStream...

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 439
Code: [Select]
if( !sucess ) tryAgain();

soulshaker

  • Full Member
  • RIP
  • Posts: 134
[BUG] Re: Why is this not working?
« Reply #3, on November 23rd, 2014, 06:43 AM »
First load the Radio Stream:
Code: [Select]
function onScriptLoad()
{
CreateRadioStream( 11, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
}

Then add the cmd
Code: [Select]
else if ( cmd == "radio" )
 {
  player.Vehicle.Radio = 11; //11 is the id of radio we have created
 }

Honey

  • Full Member
  • Posts: 136
[BUG] Re: Why is this not working?
« Reply #4, on November 23rd, 2014, 08:28 AM »
This may also work :

Code: [Select]
s <- CreateRadioStream( 11, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
player.Vehicle.Radio = s;

Although Untested.

.

  • VC:MP Beta Tester
  • .
  • Posts: 1,805
[BUG] Re: Why is this not working?
« Reply #5, on November 23rd, 2014, 09:51 AM »
Quote from Honey on November 23rd, 2014, 08:28 AM
This may also work :

Code: [Select]
s <- CreateRadioStream( 11, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
player.Vehicle.Radio = s;

Although Untested.
Placing that in the global namespace right after execution will crash the server unless the scripts are loaded and executed by the Init callback. What I mean by that is that the plugin API/Functions aren't valid in the plugin until the first OnInitServer callback is triggered in the plugin. Any attempt to use the server API before that event will result in a server crash. At least that's how it used to be. I'm not sure what changed over the time in the Squirrel plugin.
.

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 439
[BUG] Re: Why is this not working?
« Reply #6, on November 23rd, 2014, 03:01 PM »Last edited on November 23rd, 2014, 03:59 PM by Thijn
Code: [Select]
function OnScriptLoad()
{
CreateRadioStream( 15, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
}

Using:

Code: [Select]
player.Vehicle.Radio = 15;

why 15?

normal number of radios gta vice city is 14, how I want to create a new put the number above the existing radios.

Thank's all. Topic Locked!
Code: [Select]
if( !sucess ) tryAgain();