Jump to content

playSound doesn't work


papam77

Recommended Posts

Hello, why it doesn't work?

    function lobby(player) 
    -- Effects 
    local bg = playSound("sounds/sea.mp3") 
    setSoundVolume(bg, 1.0) 
     
     
     
     
    -- Design 
    lobby = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true)     
    end 
    addCommandHandler ("system", lobby) 

Link to comment
  • Moderators

well as far I can see it have to work. You sure the sound is there?(and in the sound/ folder)

I only see one other mistake(it is client not serverside):

function lobby(player) 

Must be:

function lobby(command) -- string commandName, [string arg1, string arg2, ...] 

Link to comment

Error:

WARNING: eag/lobby_c.lua:4: Bad 'sound/player' pointer @ 'setSoundVolume'(1)

lobby_c.lua

    function lobby(system) 
    -- Effects 
    local bg = playSound("sound/sea.mp3") 
    setSoundVolume(bg, 1.0) 
     
     
     
     
    -- Design 
    lobby = guiCreateStaticImage(0.00, 0.00, 1.00, 1.00, "images/lobbyBG.png", true)     
    end 
    addCommandHandler ("system", lobby) 

meta.xml

"DeeJay" type="gamemode" /> 
  

Link to comment

Make sure that the path to the file is correct and you didn't make a typo. Also, check to make sure that the mp3 file is not corrupted - and at last, remember to restart the resource after every change you make.

So long as the file exists in ResourceName/sound/ it should be working. Also, there's no need to set the volume to 1 since that is the default value anyway. :)

Link to comment

Version 1:

 caa = guiCreateLabel(0.00, 0.00, 1.00, 0.14, "Choose an Arena", true) 
    guiCreateFont(caa, "fonts/font.ttf", 20 ) 
    guiLabelSetHorizontalAlign(caa, "center", false) 
    guiLabelSetVerticalAlign(caa, "center")  

Version 2:

 caa = guiCreateLabel(0.00, 0.00, 1.00, 0.14, "Choose an Arena", true) 
    caa= guiCreateFont("fonts/font.ttf", 20 ) 
    guiLabelSetHorizontalAlign(caa, "center", false) 
    guiLabelSetVerticalAlign(caa, "center")  

And doesn't work...

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