drk Posted February 3, 2012 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 ?
Castillo Posted February 3, 2012 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)
drk Posted February 3, 2012 Author Posted February 3, 2012 I've tried this and don't work too. Plays all the sounds
Castillo Posted February 3, 2012 Posted February 3, 2012 Do you mean it's playing all grid list sounds at the same time?
Castillo Posted February 3, 2012 Posted February 3, 2012 That's not possible, must be something else in your script. Post your entire script.
Recommended Posts