Jump to content

PlaySound3D


Rotti

Recommended Posts

Hello,

I want to stream a song from my server with PlaySound3D. But if i start it it doesn't works. But if i use a radiostream it works! I just want to stream this one song.

script (clientside)

  
function disko() 
    song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
end 
addCommandHandler("diskoparty", disko) 
  
  

Meta:

  

    "[GRS]Nitro" version="1.0" type="script" name="speed booster" description="Macht dich schnell" /> 
    client="1.3.0-9.04555" /> 
    

Yes, there is a bit more code in the folder. The script is in cars_c.lua and the song is Diskoparty.mp3.

Link to comment
Hello,

I want to stream a song from my server with PlaySound3D. But if i start it it doesn't works. But if i use a radiostream it works! I just want to stream this one song.

script (clientside)

  
function disko() 
    song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
end 
addCommandHandler("diskoparty", disko) 
  
  

Meta:

  

    "[GRS]Nitro" version="1.0" type="script" name="speed booster" description="Macht dich schnell" /> 
    client="1.3.0-9.04555" /> 
    

Yes, there is a bit more code in the folder. The script is in cars_c.lua and the song is Diskoparty.mp3.

function disko() 
    local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
end 
addCommandHandler("diskoparty", disko) 

Link to comment

So you mean something like this:

  
--Clientside-- 
function disko() 
    local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
        triggerServerEvent("looper", getRootElement()) 
end 
addEventHandler("diskoparty", root, disko) 
addEvent("diskoparty", true) 
  

  
--Serverside-- 
function loop() 
    triggerClientEvent("diskoparty", root) 
end 
addEvent("looper", true) 
addEventHandler("looper", getRootElement(), loop) 
  

Link to comment
So you mean something like this:

  
--Clientside-- 
function disko() 
    local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
        triggerServerEvent("looper", getRootElement()) 
end 
addEventHandler("diskoparty", root, disko) 
addEvent("diskoparty", true) 
  

  
--Serverside-- 
function loop() 
    triggerClientEvent("diskoparty", root) 
end 
addEvent("looper", true) 
addEventHandler("looper", getRootElement(), loop) 
  

triggerServerEvent("looper", getRootElement()) 

>

triggerServerEvent("looper",localPlayer) 

Link to comment

try this:

--Clientside-- 
function disko(play) 
    if not play or play==false then 
        triggerServerEvent("looper", getRootElement()) 
        return 
    end 
    local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
end 
addEventHandler("diskoparty", root, disko) 
addEvent("diskoparty", true) 
  
--Serverside-- 
function loop() 
    triggerClientEvent("diskoparty", root,true) 
end 
addEvent("looper", true) 
addEventHandler("looper", getRootElement(), loop) 
  

Link to comment
no... But in the serverside script i have to trigger the client event first, then the loop will start. maybe the mistake is there.

Here is the command:

----------

triggerClientEvent(root, "diskoparty", root)

---------

the code is working

addEventHandler( 'onClientResourceStart', resourceRoot, 
function() 
    local x, y, z = getElementPosition (localPlayer) 
    local song = playSound3D("0.mp3", x, y, z, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
end 
) 

addEventHandler( 'onClientResourceStart', resourceRoot, 
    local song = playSound3D("Diskoparty.mp3", -2758, 968, 54, true) 
    setSoundVolume ( song, 100 ) 
    setSoundMinDistance ( song, 100 ) 
    outputChatBox(":D") 
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...