Jump to content

Music


Recommended Posts

Posted

Hello, i made this music system, but when i have one problem, when a random player run the music, and i run another one in the same time, the music that he runned must stop automatically, can somebody find a solution for this please? thanks

Client:

  
function proxy() 
    local sound = playSound("music/proxy.mp3") 
    setSoundVolume(sound, 50) 
     
end 
addEvent( "proxy", true ) 
addEventHandler( "proxy", getRootElement(), proxy ) 
  
function crackin( name ) 
    local sound = playSound("music/crackin.mp3") 
    setSoundVolume(sound, 50) 
    setSoundMaxDistance( sound, 5000 ) 
end 
addEvent( "crackin", true ) 
addEventHandler( "crackin", getRootElement(), crackin ) 

Server:

  
function proxy(player, cmd) 
    local name1 = getPlayerName(player) 
    local r,g,b = getPlayerNametagColor (player) 
    local accountname = getAccountName (getPlayerAccount(player)) 
        if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) )  then 
        outputChatBox ( "" .. name1 .. "#2600FF Playing Proxy", getRootElement(), r, g, b, true ) 
        triggerClientEvent ("proxy", getRootElement()) 
    else outputChatBox ( "This command for Admins group", player, 255, 0, 0, true ) return end 
end 
addCommandHandler("proxy", proxy ) 
  
function crackin(player, cmd) 
    local name = getPlayerName(player) 
    local r,g,b = getPlayerNametagColor (player) 
    local accountname = getAccountName (getPlayerAccount(player)) 
        if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) ) then 
        outputChatBox ( "" .. name .. "#2600FF Playing Crackin", getRootElement(), r, g, b, true ) 
        triggerClientEvent ("crackin", getRootElement()) 
    else outputChatBox ( "This command is for Admin group", player, 255, 0, 0, true ) return end 
end 
addCommandHandler("crackin", crackin) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

I think same, but how?

I know the stopSound function but idk about check music streaming

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

In client or server?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
  
function proxy() 
if isElement(sound) then 
    destroyElement(sound) 
    local sound = playSound("music/proxy.mp3") 
    setSoundVolume(sound, 50) 
end 
end 
addEvent( "proxy", true ) 
addEventHandler( "proxy", getRootElement(), proxy ) 
  
function crackin( name ) 
    local sound = playSound("music/crackin.mp3") 
    setSoundVolume(sound, 50) 
    setSoundMaxDistance( sound, 5000 ) 
end 
addEvent( "crackin", true ) 
addEventHandler( "crackin", getRootElement(), crackin ) 

?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted

Can't understand, can you fix it?

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
local currentPlaying 
  
function proxy() 
if isElement(currentPlaying) then 
    destroyElement(currentPlaying) 
    local currentPlaying = playSound("music/proxy.mp3") 
    setSoundVolume(currentPlaying, 50) 
end 
end 
addEvent( "proxy", true ) 
addEventHandler( "proxy", getRootElement(), proxy ) 
  
function crackin( name ) 
    currentPlaying = playSound("music/crackin.mp3") 
    setSoundVolume(currentPlaying, 50) 
    setSoundMaxDistance( currentPlaying, 5000 ) 
end 
addEvent( "crackin", true ) 

Posted

Thanks, but when i play proxy first and then crackin, i can hear both of them, so i tried to fix it but didnt work, now both of them cannot be played

local currentPlaying 
  
function proxy() 
if isElement(currentPlaying) then 
    destroyElement(currentPlaying) 
    local currentPlaying = playSound("music/proxy.mp3") 
    setSoundVolume(currentPlaying, 50) 
    --setSoundMaxDistance( currentPlaying, 5000 ) 
end 
end 
addEvent( "proxy", true ) 
addEventHandler( "proxy", getRootElement(), proxy ) 
  
function crackin( name ) 
if isElement(currentPlaying) then 
    destroyElement(currentPlaying) 
    local currentPlaying = playSound("music/crackin.mp3") 
    setSoundVolume(currentPlaying, 50) 
    setSoundMaxDistance( currentPlaying, 5000 ) 
end 
end 
addEvent( "crackin", true ) 
addEventHandler( "crackin", getRootElement(), crackin ) 

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

Posted
    local currentPlaying 
      
    function proxy() 
    if isElement(currentPlaying) then 
        destroyElement(currentPlaying) 
        currentPlaying = playSound("music/proxy.mp3") 
        setSoundVolume(currentPlaying, 50) 
        --setSoundMaxDistance( currentPlaying, 5000 ) 
    end 
    end 
    addEvent( "proxy", true ) 
    addEventHandler( "proxy", getRootElement(), proxy ) 
      
    function crackin( name ) 
    if isElement(currentPlaying) then 
        destroyElement(currentPlaying) 
        currentPlaying = playSound("music/crackin.mp3") 
        setSoundVolume(currentPlaying, 50) 
        setSoundMaxDistance( currentPlaying, 5000 ) 
    end 
    end 
    addEvent( "crackin", true ) 
    addEventHandler( "crackin", getRootElement(), crackin ) 

Posted

Still can't hear both of them

If you're looking for a cheap paid scripter, don't hesitate to contact me.

Great minds discuss ideas, Average minds discuss events and small minds discuss people.

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