Jump to content

Join Music


mint3d

Recommended Posts

-- Client Side -- 
  
JoinMusic = playSound(...) 
  
addEvent("onLogin", true) 
addEventHandler("onLogin", root, 
function() 
    if isElement(JoinMusic) then 
        destroyElement(JoinMusic) 
    end 
end) 

-- Server Side -- 
  
addEventHandler("onPlayerLogin", root, 
function() 
    triggerClientEvent(source, "onLogin", source) 
end) 

Link to comment

But i mean i have the file in with the script how to make it play from there? just that one song its called earthquake

I tried this but it plays when they join but not when they login

  
-- Your Sounds 
local sounds = { 
    "sounds/joinsound.ogg", -- Files .ogg 
    "sounds/joinsound.mp3", -- Files .mp3 
    "sounds/symp1.ogg", 
} 
  
-- Event Player Connect 
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function() 
    setTimer(function() 
        playSound(sounds[math.random(1, #sounds)]) 
    end, 1000, 1) 
end 
) 
  

Link to comment

The wiki example have it like this:

local sound = playSound("sounds/wasted.mp3") 

You can see there is " before and after the name of the song (string) also there is mp3 at the end of the song name.

Some info about string: https://wiki.multitheftauto.com/wiki/String

I don't know what is your song format, it could be MP3, WAV, OGG, RIFF, MOD, XM, IT, S3M and PLS.

If it was mp3 it will be like this:

JoinMusic = playSound("earthquake.mp3") 

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