Jump to content

Play Sound On Win


Recommended Posts

Posted

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 :D

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 :wink:

Posted

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.

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