Jump to content

مشكلة في كود تشغيل صوت


Recommended Posts

انا مسوي لوحة للاعب يشتغل منها الصوت

ومخلي الصوت يشتغل إذا اللاعب في الكول شيب

بس الصوت يشتغل بس للاعب إلي شغل الصوت من اللوحة

ابيه يشتغل لكل اللاعبين إلي في الكول شيب

ذا الكود :

soundplace = createColCuboid(1120.0715, 2724.2297, 8.5, 413.5, 127.75, 30) 
soundplace2 = createColCuboid(1419.2188, 2849.9783, 8.5, 114.5, 32.5, 30) 
  
function sound1() 
if ( source == GUIEditor.button[1] ) then 
local item = guiGridListGetItemText( gridlist5, guiGridListGetSelectedItem ( gridlist5 ), 1 ) 
if item == "Song1" then 
if isElement(sound) then stopSound(sound) end 
sound = playSound ( "sound/sound1.mp3") 
setSoundVolume ( sound, 0 ) 
if isElementWithinColShape ( localPlayer, soundplace ) or isElementWithinColShape ( localPlayer, soundplace2 ) then 
setSoundVolume ( sound, 1.0 ) 
guiSetVisible ( window, false ) 
showCursor ( false ) 
end 
end 
end 
end 
addEventHandler("onClientGUIClick", root, sound1) 

Link to comment
soundplace = createColCuboid(1120.0715, 2724.2297, 8.5, 413.5, 127.75, 30) 
soundplace2 = createColCuboid(1419.2188, 2849.9783, 8.5, 114.5, 32.5, 30) 
  
function sound1() 
if ( source == GUIEditor.button[1] ) then 
local item = guiGridListGetItemText( gridlist5, guiGridListGetSelectedItem ( gridlist5 ), 1 ) 
if item == "Song1" then 
if isElement(sound) then stopSound(sound) end 
sound = playSound ( "sound/sound1.mp3") 
setSoundVolume ( sound, 0 ) 
if isElementWithinColShape ( Player, soundplace ) or isElementWithinColShape ( Player, soundplace2 ) then 
setSoundVolume ( sound, 1.0 ) 
guiSetVisible ( window, false ) 
showCursor ( false ) 
end 
end 
end 
end 
addEventHandler("onClientGUIClick", root, sound1) 

جرب

Link to comment

يمكن كذا يشتغل معك

سيرفر #

  
soundplace = createColCuboid(1120.0715, 2724.2297, 8.5, 413.5, 127.75, 30) 
soundplace2 = createColCuboid(1419.2188, 2849.9783, 8.5, 114.5, 32.5, 30) 
  
addEvent( "dd", true ) 
addEventHandler( "dd", root, 
 function () 
  for i, player in ipairs (getElementsByType("player")) do 
 if isElementWithinColShape ( Player, soundplace ) and  isElementWithinColShape ( Player, soundplace2 ) then 
   triggerClientEvent (player, "PlaySound") 
   end 
   end 
   end) 
  

كلنت

function sound1() 
if ( source == GUIEditor.button[1] ) then 
local item = guiGridListGetItemText( gridlist5, guiGridListGetSelectedItem ( gridlist5 ), 1 ) 
if item == "Song1" then 
triggerServerEvent ( "dd", localPlayer ) 
guiSetVisible ( window, false ) 
showCursor ( false ) 
end 
end 
end 
addEventHandler("onClientGUIClick", root, sound1) 
  
  
addEvent ("PlaySound", true) 
addEventHandler ("PlaySound", root, 
    function () 
    if isElement(sound) then stopSound(sound) end 
        local sound = playSound("chat.mp3", false) 
        end 
    end) 

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