[BUG] Why is this not working?

Started by MatheuS, Nov 22, 2014, 08:22 PM

Previous topic - Next topic

MatheuS

else if ( cmd == "radio" )
{
player.Vehicle = CreateRadioStream( "Sertanejo", "http://64.15.147.221:9026", true );
}

if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

Stormeus

Why are you setting a vehicle to a radio stream?

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

MatheuS

Quote from: stormeus on Nov 22, 2014, 10:03 PMWhy are you setting a vehicle to a radio stream?

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

Not Working...
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

soulshaker

First load the Radio Stream:
function onScriptLoad()
{
CreateRadioStream( 11, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
}

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

Honey

This may also work :

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

Although Untested.

.

Quote from: Honey on Nov 23, 2014, 08:28 AMThis may also work :

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

#6
function OnScriptLoad()
{
CreateRadioStream( 15, "Sertanejo", "http://64.15.147.221:9026/listen.pls", 1 );
}

Using:

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!
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.