Diddly_Squat Posted August 14, 2010 Share Posted August 14, 2010 I'm wondering if it would be possible to make a script where when you join a Server it plays a song, It would be great fun to see if it works, I'm just not sure if its Possible. The Track i would use is only 1.04mins so it wouldn't be too hefty a DL Here's what I have so far, It wont play when I connect though so I'm not sure what to do function onPlayerSpawn ( theSpawnpoint, theTeam ) local sound = playSound("sound/intro.mp3",[ bool looped = false ] ) setSoundVolume(sound, 0.5) end addEventHandler ( "onPlayerSpawn", getRootElement(), onPlayerSpawn ) <meta> <info author="Spike" version="1.0.0" type="script" description="" /> <script src="spwnsound.lua" type="client"/> <file src="sound/intro.mp3" /> </meta> Can anyone Help please? Link to comment
Castillo Posted August 14, 2010 Share Posted August 14, 2010 ok, first error i see is that you using as event "onPlayerSpawn" and that even is only server side and your code its client so i suggets you to use triggerClientEvent to play the song. also [ bool looped = false? wth is this? there u just put "false" or "true" Link to comment
Diddly_Squat Posted August 14, 2010 Author Share Posted August 14, 2010 ok, first error i see is that you using as event "onPlayerSpawn" and that even is only server side and your code its client so i suggets you to use triggerClientEvent to play the song.also [ bool looped = false? wth is this? there u just put "false" or "true" Thanks for a quit response, I have tried what you suggested and it hasn't seemed to work the script currently looks like: function onPlayerSpawn ( theSpawnpoint, theTeam ) local sound = playSound("sound/intro.mp3",false) setSoundVolume(sound, 0.5) end addEventHandler ( "triggerClientEvent", getRootElement(), onPlayerSpawn ) Link to comment
dzek (varez) Posted August 14, 2010 Share Posted August 14, 2010 omg.. get back to basics.. btw: onPlayerSpawn will be fired EVERY RESPAWN, not on join. and you added handler for triggerClientEvent ? total mess!! re-read about scripting again. scripting is not using random words. computer wouldnt understand that edit: you can use this resource if you want to play sound for one local player on join (not on spawn!) 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