Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MatheuS on Nov 22, 2014, 08:22 PM

Title: [BUG] Why is this not working?
Post by: MatheuS on Nov 22, 2014, 08:22 PM
else if ( cmd == "radio" )
{
player.Vehicle = CreateRadioStream( "Sertanejo", "http://64.15.147.221:9026", true );
}

Title: Re: [BUG] Why is this not working?
Post by: Stormeus on Nov 22, 2014, 10:03 PM
Why are you setting a vehicle to a radio stream?

You're looking for player.Vehicle.Radio = CreateRadioStream...
Title: Re: [BUG] Why is this not working?
Post by: MatheuS on Nov 22, 2014, 11:22 PM
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...
Title: Re: [BUG] Why is this not working?
Post by: soulshaker on Nov 23, 2014, 06:43 AM
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
 }
Title: Re: [BUG] Why is this not working?
Post by: Honey on Nov 23, 2014, 08:28 AM
This may also work :

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

Although Untested.
Title: Re: [BUG] Why is this not working?
Post by: . on Nov 23, 2014, 09:51 AM
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.
Title: Re: [BUG] Why is this not working?
Post by: MatheuS on Nov 23, 2014, 03:01 PM
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!