mint3d Posted October 13, 2013 Share Posted October 13, 2013 I need help i want to make a script where when you join it plays music and when you login it stops anyideas thanks Link to comment
TAPL Posted October 13, 2013 Share Posted October 13, 2013 -- 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
mint3d Posted October 13, 2013 Author Share Posted October 13, 2013 JoinMusic = playSound(earthquake) addEvent("onLogin", true) addEventHandler("onLogin", root, function() if isElement(JoinMusic) then destroyElement(JoinMusic) end end) so like that ? Link to comment
TAPL Posted October 13, 2013 Share Posted October 13, 2013 earthquake? Please visit the wiki to know how to use this function. https://wiki.multitheftauto.com/wiki/PlaySound Link to comment
mint3d Posted October 13, 2013 Author Share Posted October 13, 2013 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
TAPL Posted October 13, 2013 Share Posted October 13, 2013 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
mint3d Posted October 13, 2013 Author Share Posted October 13, 2013 It's ok i fixed it to work with my RP scripts just changed onlogin to onClientPlayerSpawn Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now