Author Topic: ULX playsound wont work in script.  (Read 2625 times)

0 Members and 2 Guests are viewing this topic.

Offline BlackSanta

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
ULX playsound wont work in script.
« 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.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX playsound wont work in script.
« Reply #1 on: August 02, 2013, 08:56:57 PM »
Any errors in server or client consoles?
Experiencing God's grace one day at a time.

Offline BlackSanta

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
Re: ULX playsound wont work in script.
« Reply #2 on: August 02, 2013, 09:46:24 PM »
None at all, thats whats confusing me.

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX playsound wont work in script.
« Reply #3 on: August 03, 2013, 07:08:19 AM »
Do you have anything that actually calls CheckAlive?
Experiencing God's grace one day at a time.

Offline BlackSanta

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
Re: ULX playsound wont work in script.
« Reply #4 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.

Offline BlackSanta

  • Newbie
  • *
  • Posts: 15
  • Karma: -1
Re: ULX playsound wont work in script.
« Reply #5 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

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: ULX playsound wont work in script.
« Reply #6 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.
Experiencing God's grace one day at a time.