drk Posted February 3, 2012 Share Posted February 3, 2012 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 ? Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 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) Link to comment
drk Posted February 3, 2012 Author Share Posted February 3, 2012 I've tried this and don't work too. Plays all the sounds Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 Do you mean it's playing all grid list sounds at the same time? Link to comment
Castillo Posted February 3, 2012 Share Posted February 3, 2012 That's not possible, must be something else in your script. Post your entire script. Link to comment
drk Posted February 3, 2012 Author Share Posted February 3, 2012 I will send you the complete code via PM. Link to comment
drk Posted February 3, 2012 Author Share Posted February 3, 2012 Problem solved. Lock this post please. Link to comment
Recommended Posts