Jump to content

Play Sound fail


Wisam

Recommended Posts

Hello..

I have here part of the map for assault gamemode and this script creates explosions when all the map objectives are finished and i added the sound function but.. the explosion works perfect but the sound dont play? please help me! :/

i get this error:

ERROR: radar\radarscript.lua:11: attempt to call global 'playSound' (a nil value)

Script: (Client)

  
  
  
function finished(objective) 
    if (objective.id ~= "radar") then return end 
    explosions() 
    sound() 
end 
  
function sound() 
  
    local sound = playSound("win.wav")  
    setSoundVolume(sound, 1) -- set the sound volume to 50% 
  
end 
  
function explosions() 
  
    createExplosion(-314.86804,1575.07471,76.80782, 7 ,true, 50.0,true ) 
  
end 
  
addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) 
  

Link to comment
  
function finished(objective) 
    if (objective.id ~= "radar") then return end 
    sound() 
end 
  
function sound() 
  
    local sound = playSound("win.wav") --Play wasted.mp3 from the sounds folder 
    setSoundVolume(sound, 1) -- set the sound volume to 50% 
  
end 
addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) 
  

I changed to this and i chnaged the script type to client in meta.xml file and didnt work

Edited by Guest
Link to comment

Server side :

function finished(objective) 
    if (objective.id ~= "radar") then return end 
 triggerClientEvent(root,"onAssaultObjectiveReached",root) 
end 
addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) 
  

Client side:

  
function finished(objective) 
    if (objective.id ~= "radar") then return end 
    sound() 
end 
  
function sound() 
    local sound = playSound("win.wav") --Play wasted.mp3 from the sounds folder 
setRadioChannel(0) 
    setSoundVolume(sound, 1) -- set the sound volume to 50% 
end 
addEvent("onAssaultObjectiveReached",true) 
addEventHandler("onAssaultObjectiveReached",getRootElement(),finished) 
  

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