Jump to content

Radio Player


Atton

Recommended Posts

I tried to use a bit of code that I found to try to make a link based audio player , It seems not to work that well.

  
addEventHandler("onClientResourceStart", getRootElement(getThisResource()),  
    function () 
        local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 552, 476 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    Agui = guiCreateWindow(left, top, windowWidth, windowHeight, "Fuck Around Panel v1.0", false) 
    guiWindowSetSizable(Agui, false) 
    guiSetVisible(Agui, false) 
  
        playb = guiCreateButton(420, 315, 101, 51, "Play/Stop", false, Agui) 
    stopb = guiCreateButton(420, 375, 101, 51, "Stop", false, Agui) 
    TBDEV = guiCreateEdit(10, 335, 113, 21, "URL", false, Agui) 
    guiEditSetMaxLength(TBDEV, 32767) 
  
--The Code of the player. 
if guiGetText(TBDEV) then 
            addEventHandler("onClientGUIClick", playb, 
                function() 
                    if sound ~= nil then stopSound(sound) end  
                    sound = playSound(""..guiGetText(TBDEV).."") 
                end) 
            addEventHandler("onClientGUIClick", stopb, 
                function() 
                    if sound ~= nil then stopSound(sound) end 
                end) 
  
            end 
    end 
     
) 
  
  

Link to comment

You could try this:

  
addEventHandler("onClientResourceStart", getRootElement(getThisResource()),  
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 552, 476 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.0", false) 
    guiWindowSetSizable(Agui, false) 
    guiSetVisible(Agui, false) 
  
    playb = guiCreateButton(420, 315, 101, 51, "Play/Stop", false, Agui) 
    stopb = guiCreateButton(420, 375, 101, 51, "Stop", false, Agui) 
    TBDEV = guiCreateEdit(10, 335, 113, 21, "URL", false, Agui) 
    guiEditSetMaxLength(TBDEV, 32767) 
) 
  
addEventHandler("onClientGUIClick", getRootElement(), 
    function() 
        if guiGetText(TBDEV) then 
            if source == playb then 
                if sound ~= nil then stopSound(sound) end 
                sound = playSound(guiGetText(TBDEV)) 
            elseif source == stopb then 
                if sound ~= nil then stopSound(sound) end 
            end 
        else 
            outputChatBox("You must fill in a URL first!", 255, 0, 0) 
        end 
    end 
) 
  

Link to comment
You could try this:
  
addEventHandler("onClientResourceStart", getRootElement(getThisResource()),  
    local screenWidth, screenHeight = guiGetScreenSize() 
    local windowWidth, windowHeight = 552, 476 
    local left = screenWidth/2 - windowWidth/2 
    local top = screenHeight/2 - windowHeight/2 
    Agui = guiCreateWindow(left, top, windowWidth, windowHeight, ":O Around Panel v1.0", false) 
    guiWindowSetSizable(Agui, false) 
    guiSetVisible(Agui, false) 
  
    playb = guiCreateButton(420, 315, 101, 51, "Play/Stop", false, Agui) 
    stopb = guiCreateButton(420, 375, 101, 51, "Stop", false, Agui) 
    TBDEV = guiCreateEdit(10, 335, 113, 21, "URL", false, Agui) 
    guiEditSetMaxLength(TBDEV, 32767) 
) 
  
addEventHandler("onClientGUIClick", getRootElement(), 
    function() 
        if guiGetText(TBDEV) then 
            if source == playb then 
                if sound ~= nil then stopSound(sound) end 
                sound = playSound(guiGetText(TBDEV)) 
            elseif source == stopb then 
                if sound ~= nil then stopSound(sound) end 
            end 
        else 
            outputChatBox("You must fill in a URL first!", 255, 0, 0) 
        end 
    end 
) 
  

Tried it but it causes tons of errors and the script wont even load I am pretty sure the code above is missing ends and stuff

Made some edits seems to work but got to fix some stuff.

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