MasterSneeze Posted April 8, 2010 Posted April 8, 2010 I'm new to lua, and i'm creating a small script with banners and stuff... In one part of my script i want it to play a sound on win... The gamemode is race function progresskills() progresskills = guiCreateProgressBar (20,574,252,22,false) end addEventHandler ("onClientResourceStart",getRootElement(), progresskills) addEventHandler ("onClientPlayerWasted",getRootElement(), function() guiProgressBarSetProgress(progresskills, 10) end) function soundwin() local sound = playSound("sounds/winner.wav") setSoundVolume(sound, 1.0) -- set the sound volume to 100% end addEventHandler("?????",getLocalPlayer (), soundfull) Where the "????" is by the bottom, i want to know the code i have to type there, for when a player wins. Thanks for your help
Gamesnert Posted April 8, 2010 Posted April 8, 2010 https://wiki.multitheftauto.com/wiki/Resource:Rac ... sion_0.8.3 Use onPlayerFinish server-side and trigger a client-side event if the player who finished actually won.
MasterSneeze Posted April 8, 2010 Author Posted April 8, 2010 https://wiki.multitheftauto.com/wiki/Resource:Race#Events_for_version_0.8.3Use onPlayerFinish server-side and trigger a client-side event if the player who finished actually won. Im playing DM and DD maps, its not working.. Sound would only work on race maps
Dark Dragon Posted April 8, 2010 Posted April 8, 2010 whenever someone dies (onPlayerWasted) count all players which have their "state" element data set to "alive" if its only 1 player, trigger a client event which plays the sound. you might even try to use onClientPlayerWasted so you could keep it all client side.
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