Jump to content

Streaming Radio in Cars ?


msprod

Recommended Posts

Posted

hello, i'm french,

i want to play streaming in a cars (radio channel) but there is no source and topic found.

I can crerate any shoutcast radio for this but i haven't script.

i have MTASA 1.1 server on linux.

someone would exemple?

very thanks :wink:

Posted

streaming in a cars (radio channel) ? if you mean live radio stream form internet its not possible

if you mean to play .mp3 filse use :

playSound("filename.mp3") whit addEventHandler("onPlayerVehicleEnter",......)

Posted

playSound("http://myradio.com/listen.pls") it work in main game.

I'm a newbie in MTA Script.

have you a complete script for this:

addEventHandler("onPlayerVehicleEnter", ?? ) ?? id=vehicle ?

playSound("http://myradio.com/listen.pls")

very thanks for you reply.

Posted
  
function radio 
  playSound("http://myradio.com/listen.pls") 
 end 
addEventHandler("onClientVehicleEnter",root,radio) 
  

client side

the playSound("http://myradio.com/listen.pls") its only a beta/test for new version of mta may not work ... i don't try if work or not (or bug's...)

Posted

can i play this with specific vehicle ?

exemple: play radio police with police car

function radio

playSound("http://policer_radio.com/listen.pls")

end

addEventHandler("onClientVehicleEnter",root,radio) (car id ?)

very thanks... i test this.... thanks thanks thanks ;)

Posted (edited)
function radio 
 local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) 
 local id = getVehicleID(vehicle) 
 if (id== write the car id ) then 
  playSound("http://myradio.com/listen.pls") 
 end 
end 
addEventHandler("onClientVehicleEnter",root,radio) 

if whit getVehicleID not work use getElementModel

Edited by Guest
Posted

this is the version 1.1 whit live stearm i think ist or wrong the playSound("http://myradio.com/listen.pls") or is buged i don't tryed to use the new beta/test scripts of the new version

Posted

same probleme... same error...

this my script:

function radio 
local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) 
local id = getVehicleID(vehicle) 
if (id== 411 ) then 
playSound("http://myradio.com/listen.pls") 
end 
end 
addEventHandler("onClientVehicleEnter",root,radio) 

Posted

Bandi, get out if you can't even put brackets behind your functions.

function radio () 
  local id = getElementModel(source) 
  if (id== 411 ) then 
    playSound("http://myradio.com/listen.pls") 
  end 
end 
addEventHandler("onClientVehicleEnter", getLocalPlayer(), radio) 

And crc mismatch means something went wrong when downloading the file. Restart, check meta, remove strange characters from resource/script names.

Posted (edited)

very thanks for all !!!

thi my scipt work :

  
function startMySound() 
 local vehicle = getPedOccupiedVehicle( getLocalPlayer() ) 
 local id = getVehicleID(vehicle) 
 if (id== 411 ) then 
 setRadioChannel(0) 
 sound = playSound( "http://88.190.24.47/listen.pls", true ) 
end 
  
if (id== 429 ) then 
 setRadioChannel(0) 
 sound = playSound( "http://212.45.104.34:8042/listen.pls", true ) 
end 
end 
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),startMySound) 
  
function stopMySound() 
    stopSound( sound ) 
end 
addCommandHandler ( "stopsound", stopMySound ) 
addEventHandler("onClientPlayerVehicleExit",getRootElement(),stopMySound) 
  

I have a litle probleme,

When the car is totally destroy and explose, this radio is active.

addEventHandler("onClientPlayerVehicle[b]Destroy[/b]",getRootElement(),startMySound) 

how can stop radio when car is destroyed ?

you can test this in my server:

mtasa://89.3.230.154:22003

happy game !

Edited by Guest
Posted

SDK ..... if you think i have time to check 3 times a script the ..... i am not obsessed to stay in fornt of comp all day long(like you) i made that script in les that 30 sec i forget to put and say to your ... what to do ok .....

and addEventHandler("onClientVehicleEnter", getLocalPlayer(), radio) its work 100% whit root and its clients side not server so ...

Posted

i say that for SDK he think he is the "BOSS" and he say to me what to do ....... (SDK run and say to solidsnake what you say to me he write "functon") go fast if you think you are the BOss...

Posted
i say that for SDK he think he is the "BOSS" and he say to me what to do ....... (SDK run and say to solidsnake what you say to me he write "functon") go fast if you think you are the BOss...

Solid snake isn't the boss btw, as you were inferring...

Posted

I do not understand anything!!

I just ask for help,

I do not see what you mean ...

my problem:

when the car explodes the radio is active.

how can I stop the car radio is quad exploded

Thanks.

  • MTA Team
Posted

onClientElementDestroy

[lua]

if getPedOccupiedVehicle(me) == source then

stopSound(sound)

end [/lua

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...