Ulysses

General => Developers Corner => Topic started by: BlackSanta on August 02, 2013, 08:41:45 PM

Title: ULX playsound wont work in script.
Post by: BlackSanta on August 02, 2013, 08:41:45 PM
Hi,

I have made a script that plays a sound using ULX playsound when 2 players are left alive. However, it does not play the sound. There are no LUA errors, everything is where its supposed to be. I just don't know whats wrong. Anybody out there that can help me?

Here is the script:

function checkAlive(ply)
        if ply:Alive(2) then //Returns Boolean
        duel()
        end   
 
function duel()
  RunConsoleCommand( "ulx", "playsound", "1v1.mp3" )
end
       
end



Thanks guys.
Title: Re: ULX playsound wont work in script.
Post by: Megiddo on August 02, 2013, 08:56:57 PM
Any errors in server or client consoles?
Title: Re: ULX playsound wont work in script.
Post by: BlackSanta on August 02, 2013, 09:46:24 PM
None at all, thats whats confusing me.
Title: Re: ULX playsound wont work in script.
Post by: Megiddo on August 03, 2013, 07:08:19 AM
Do you have anything that actually calls CheckAlive?
Title: Re: ULX playsound wont work in script.
Post by: BlackSanta on August 03, 2013, 08:05:52 AM
Hmmm, I do not believe I do, let me try fixing it and get back to you.
Title: Re: ULX playsound wont work in script.
Post by: BlackSanta on August 03, 2013, 09:57:31 AM
Hmm, not exactly sure if what I did was right or not, but it still is not working.

Here is the current code:

function checkAlive(ply)
        hook.Call( "checkAlive" )
        if ply:Alive(2) then //Returns Boolean
        duel()
        end   
 
function duel()
  BroadcastLua('surface.PlaySound("1v1.mp3")')
end
       
end
Title: Re: ULX playsound wont work in script.
Post by: Megiddo on August 03, 2013, 05:33:11 PM
I suspect you're just attempting to hack something together without really understanding the language. Look at the stickies for help getting started with Lua.