Jump to content

radio contact stream in vliegtuigen


Recommended Posts

ik wil graag dit streamen "http://d.liveatc.net/kjfk_gnd" als ik in een vliegtuig de radio afzet ik heb een script van een andere topic gevonden maar die werkt bij mij niet, moet ik nog iets veranderen aan de meta.xml ?

local soundLocation = 'http://d.liveatc.net/kjfk_twr' 
local soundMessage = 'Connecting to air traffic control (jka), please stand by.' 
  
addEventHandler('onClientResourceStart', getRootElement(), 
function(startedRes) 
    if startedRes == getThisResource() then 
        if isPedInVehicle(localPlayer) and getVehicleType(getPedOccupiedVehicle(localPlayer)) == 'Plane' then 
            if getRadioChannel() ~= 0 then 
                soundElement = playSound(soundLocation) 
                outputChatBox(soundMessage) 
            end 
        end 
    end 
end ) 
  
addEventHandler('onClientPlayerRadioSwitch', getRootElement(), 
function(radioID) 
    if isPedInVehicle(localPlayer) and getVehicleType(getPedOccupiedVehicle(localPlayer)) == 'Plane' then 
        if radioID ~= 0 then 
            cancelEvent() 
            soundElement = playSound(soundLocation) 
            outputChatBox(soundMessage) 
        elseif soundElement then 
            setRadioChannel(0) 
            stopSound(soundElement) 
            soundElement = nil 
        end 
    end 
end ) 
  
addEventHandler('onClientPlayerVehicleEnter', getRootElement(), 
function(theVehicle, theSeat) 
    if getVehicleType(theVehicle) == 'Plane' then 
        if getRadioChannel() ~= 0 then 
            soundElement = playSound(soundLocation) 
            outputChatBox(soundMessage) 
        end 
    end 
end ) 
  
addEventHandler('onClientPlayerVehicleExit', getRootElement(), 
function(theVehicle, theSeat) 
    if getVehicleType(theVehicle) == 'Plane' then 
        if soundElement then 
            setRadioChannel(0) 
            stopSound(soundElement) 
            soundElement = nil 
        end 
    end 
end ) 

Link to comment
  • 3 months later...

Hoe je het heel makkelijk kan doen is zo;

addEventHandler ( "onClientPlayerRadioSwitch", getLocalPlayer(), 
    function ( radio ) 
        if not ( radio == 0 ) then 
            if ( getVehicleType ( getPedOccupiedVehicle ( source ) ) == "plane" ) then 
                playSound ( "http://d.liveatc.net/kjfk_twr" ); 
            end 
        end 
    end 
); 

Het veranderen van de radiozender kan effect hebben hierop, je kan daar wel een beveiliging op zetten.

Link to comment

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...