Jump to content

Music Streaming


SnoopCat

Recommended Posts

hey hello i have a radio resource but i need it to stop map music... is there any way to do it?

Client:

aChannelList={}; 
  
iCurrentChannel = 0; 
currentSound = nil; 
iCurrentText = nil; 
bRender = true; 
  
local function showText(sText) 
    if not iCurrentText then 
        iCurrentText = oTextList_functions.newText(sText,0.3,0.1,0.3,0.1,200,200,0,0,"default","left","top",true,true); 
    end 
    oTextList_functions.setText(iCurrentText,sText); 
    triggerShowText(sText); 
end 
  
local function playChannel(id) 
    setRadioChannel(0); 
    if currentSound then 
        destroyElement(currentSound); 
    end 
    currentSound = nil; 
    if aChannelList[id] and aChannelList[id].addr ~= "" then 
        currentSound = playSound(aChannelList[id].addr,true); 
        setSoundVolume(currentSound,0.7); 
    end 
    showText(aChannelList[id].name); 
end 
  
local function addNewChannel(sName,sWebAddress,sImageName) 
    local iCount = #aChannelList; 
    iCount = iCount + 1; 
    aChannelList[iCount] = {}; 
    aChannelList[iCount].name = sName; 
    aChannelList[iCount].addr = sWebAddress; 
    aChannelList[iCount].imge = sImageName; 
end 
  
local function getNextChannel() 
    iCurrentChannel = iCurrentChannel + 1; 
    if iCurrentChannel > #aChannelList then 
        iCurrentChannel = 1; 
    end 
    playChannel(iCurrentChannel) 
end 
  
local function getPrevChannel() 
    iCurrentChannel = iCurrentChannel - 1; 
    if iCurrentChannel < 0 then 
        iCurrentChannel = #aChannelList; 
    end 
    playChannel(iCurrentChannel) 
end 
  
  
  
local function INIT_RADIO() 
    bindKey("radio_next","down",getNextChannel); 
    bindKey("radio_previous","down",getPrevChannel); 
    bindKey("pgup","down",getNextChannel); 
    bindKey("pgdn","down",getPrevChannel); 
  
    toggleControl("radio_next",false); 
    toggleControl("radio_previous",false); 
  
    addNewChannel("Iner Radio","http://unlimitedracers.no-ip.org:8070/listen.pls","Iner Radio"); 
    addNewChannel("Radio OFF","","off"); 
end 
  
local function DEINIT_RADIO() 
    toggleControl("radio_next",true); 
    toggleControl("radio_previous",true); 
    unbindKey("radio_next","down",getNextChannel); 
    unbindKey("radio_previous","down",getPrevChannel); 
    unbindKey("pgup","down",getNextChannel); 
    unbindKey("pgdn","down",getPrevChannel); 
end 
  
  
addEventHandler("onClientResourceStart",getResourceRootElement(),INIT_RADIO);  
addEventHandler("onClientResourceStop",getResourceRootElement(),DEINIT_RADIO);  
  
local messageTimer = setTimer(outputChatBox, 120000, 0, "A page_up és a page_down gombokkal tudsz rádiót váltani amikor nem vagy kocsiban!", getRootElement(), 255, 255, 0) 
  
addEventHandler( "onClientResourceStop", getRootElement( ), 
    function () 
    killTimer(messageTimer) 
    end 
); 

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