Jump to content

HELP - MOVE OBJECT ON STREAM MUSIC


Ryosuke

Recommended Posts

Hi, I'm trying to develop a realistic speaker system. but there is a problem, I can not move the component as it plays --  HELP ME PLS 

 

 

local working = true
local stream = playSound("http://91.121.157.114:8421/stream")
local moveOn = true

function toggleRadio()
    working = not working
    if working == false then
        moveOn = false
        setSoundVolume(stream, 0)
    else
        moveOn = true
        setSoundVolume(stream, 1)
    end
end
bindKey("r","down",toggleRadio)

function move()
   local theVeh = getPedOccupiedVehicle(localPlayer)
    local getComponent = getVehicleComponents(theVeh) 
      if (theVeh) then
       for k in pairs (getComponent) do
        if (k == "alto") then
        if (not components["alto"]) then
        local x, y, z = getVehicleComponentPosition(theVeh, k) 
         if (working) then
          local ls = getSoundLevelData(stream);
            if (ls ~= false) then
             if moveOn == true then
                setVehicleComponentPosition(theVeh,"alto", ls/-100, y, z)
            end
        end
    end
    end
    end
    end
    end
    end
addEventHandler("onVehicleEnter",root,move)

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