Jump to content

Another small noob problem D:


drk

Recommended Posts

Posted

hi all.

im making a script when you double click in a gridlist element it plays the sound.

It is playing the song but it starts all the songs. Why?

the code is

function clickPlaySound() 
    local selectedRow, selectedCol = guiGridListGetSelectedItem(gui['list']); 
    local song = guiGridListGetItemData(gui['list'],selectedRow, selectedCol) 
     if isElement(currentSound) then destroyElement(currentSound) end; 
    currentSound = playSound(song,false); 
end; 
addEventHandler('onClientGUIDoubleClick',gui['list'],clickPlaySound,false); 

I've tried with:

addEventHandler('onClientGUIDoubleClick',root, 
 function() 
  if source == gui['list'] then 
   local theRow, theCol = guiGridListGetSelectedItem(gui['list']); 
   if row and col and row ~= -1 and col ~= -1 then 
    local song = guiGridListGetItemData(source, theRow, theCol); --i've changed source to gui['list'] and dont work too. 
    if isElement(currentSound) then destroyElement(currentSound) end; 
    currentSound = playSound(song,false); 
  end; 
end); 

but don't work too. can any one help me ?

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted
addEventHandler('onClientGUIDoubleClick',root, 
    function() 
    if (source == gui['list']) then 
        local row, col = guiGridListGetSelectedItem(source) 
        if (row and col and row ~= -1 and col ~= -1) then 
            local song = guiGridListGetItemData(source, row, col) 
            if isElement(currentSound) then destroyElement(currentSound) end 
            currentSound = playSound(song,false) 
        end 
    end 
end) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I've tried this and don't work too. Plays all the sounds :S

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

Do you mean it's playing all grid list sounds at the same time?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

That's not possible, must be something else in your script. Post your entire script.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

You're welcome.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...