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 ? EPT Team Server Development: 0% Learning C++ | C++ is amazing
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) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted February 3, 2012 Author Posted February 3, 2012 I've tried this and don't work too. Plays all the sounds EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted February 3, 2012 Posted February 3, 2012 Do you mean it's playing all grid list sounds at the same time? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted February 3, 2012 Author Posted February 3, 2012 Yes EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted February 3, 2012 Posted February 3, 2012 That's not possible, must be something else in your script. Post your entire script. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
drk Posted February 3, 2012 Author Posted February 3, 2012 I will send you the complete code via PM. EPT Team Server Development: 0% Learning C++ | C++ is amazing
drk Posted February 3, 2012 Author Posted February 3, 2012 Problem solved. Lock this post please. EPT Team Server Development: 0% Learning C++ | C++ is amazing
Castillo Posted February 3, 2012 Posted February 3, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Recommended Posts