Jump to content

كود فريق مع الصوت


Recommended Posts

  
function onImageClick() 
    if source == policeImage then 
        triggerServerEvent("setTeam", localPlayer, "police") 
         playSound("1.mp3") 
    elseif source == groveImage then 
         triggerServerEvent("setTeam", localPlayer, "grove") 
         playSound("2.mp3") 
         elseif source == ballasImage then 
         triggerServerEvent("setTeam", localPlayer, "ballas") 
         playSound("3.mp3")   
    end 

ابغيه لذا ضغط على الفريق يطلع ساوند محدد

واذا راح الفريق الثاني ساوند مجدد

Link to comment
احطه معه الكود يعني 
  
  
function onImageClick() 
    if source == policeImage then 
        triggerServerEvent("setTeam", localPlayer, "police") 
         playSound("1.mp3") 
    elseif source == groveImage then 
         triggerServerEvent("setTeam", localPlayer, "grove") 
                   stopSound( "1.mp3" ) 
                          playSound("2.mp3") 
         elseif source == ballasImage then 
         triggerServerEvent("setTeam", localPlayer, "ballas") 
         playSound("3.mp3")  
    end 

ما صار

Link to comment

جرب ذذ

function stopAllSounds() 
  stopSound(sound1) 
    stopSound(sound2) 
      stopSound(sound3) 
end 
function onImageClick() 
    if source == policeImage then 
       triggerServerEvent("setTeam", localPlayer, "police") 
          stopAllSounds() 
           sound1 = playSound("1.mp3") 
 elseif source == groveImage then 
     triggerServerEvent("setTeam", localPlayer, "grove") 
          stopAllSounds() 
       sound2 =  playSound("2.mp3") 
          elseif source == ballasImage then 
             triggerServerEvent("setTeam", localPlayer, "ballas") 
          stopAllSounds() 
           sound3 =  playSound("3.mp3")  
        end 

Link to comment
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        theData = getElementData ( localPlayer, "theSound" )  
        if source == policeImage then 
            triggerServerEvent ( "setTeam", localPlayer, "police" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "1.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )         
        elseif source == groveImage then 
            triggerServerEvent ( "setTeam", localPlayer, "grove" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "2.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )         
        elseif source == ballasImage then 
            triggerServerEvent ( "setTeam", localPlayer, "ballas" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "3.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )             
        end 
    end 
)  
  

Link to comment
groveImage = guiCreateStaticImage(525, 400, 200, 200, "w.png", false) 
policeImage = guiCreateStaticImage(175, 400, 200, 200, "s.png", false) 
ballasImage = guiCreateStaticImage(875, 400, 260, 200, "d.png", false) 
local x, y, z, lx, ly, lz = getCameraMatrix()  
x, lx = x + 1, lx + 1  
setCameraMatrix(1474.0025634766,-2386.3781738281,44.17036819458,1474.0025634766,-2386.3781738281,44.17036819458) 
  
showCursor(true) 
  
function onImageClick() 
    if source == groveImage then 
        triggerServerEvent("setTeam", localPlayer, "grove") 
    elseif source == policeImage then 
         triggerServerEvent("setTeam", localPlayer, "police") 
    elseif source == policeImage then 
         triggerServerEvent("setTeam", localPlayer, "ballas") 
    end 
    guiSetVisible(groveImage, false) 
    guiSetVisible(ballasImage, false) 
    guiSetVisible(policeImage, false) 
  
    showCursor(false) 
end 
addEventHandler("onClientGUIClick", resourceRoot, onImageClick) 
  
addEventHandler ( 'onClientPlayerWasted', getLocalPlayer ( ), 
    function ( ) 
        guiSetVisible ( ballasImage, true ); 
        guiSetVisible ( groveImage, true ); 
        guiSetVisible ( policeImage, true ); 
        showCursor ( true ) 
    end 
) 
  
bindKey("F4", "down", 
function() 
    if not guiGetVisible(groveImage) then 
        guiSetVisible(groveImage, true) 
        guiSetVisible(ballasImage, true) 
        guiSetVisible(policeImage, true) 
        showCursor(true) 
     else 
    guiSetVisible(groveImage, false) 
    guiSetVisible(ballasImage, false) 
    guiSetVisible(policeImage, false)  
  
        showCursor(false) 
    end 
end) 
  

Link to comment
  
groveImage = guiCreateStaticImage ( 525, 400, 200, 200, "w.png", false ) 
policeImage = guiCreateStaticImage ( 175, 400, 200, 200, "s.png", false ) 
ballasImage = guiCreateStaticImage ( 875, 400, 260, 200, "d.png", false )  
setCameraMatrix ( 1474, -2386, 44, 1474, -2386, 44 ) 
showCursor ( true ) 
  
function VisibleOff ( ) 
    guiSetVisible ( groveImage, false ) 
    guiSetVisible ( ballasImage, false ) 
    guiSetVisible ( policeImage, false ) 
    showCursor ( false ) 
end 
  
function VisibleOn ( ) 
    guiSetVisible ( groveImage, true ) 
    guiSetVisible ( ballasImage, true ) 
    guiSetVisible ( policeImage, true ) 
    showCursor ( true ) 
end 
addEventHandler ( "onClientPlayerWasted", localPlayer, VisibleOn ) 
  
bindKey ( "F4", "down", 
    function ( ) 
        if not guiGetVisible ( groveImage ) then 
            VisibleOn ( ) 
        else 
            VisibleOff ( ) 
        end 
    end 
) 
  
addEventHandler ( "onClientGUIClick", root, 
    function ( ) 
        theData = getElementData ( localPlayer, "theSound" )  
        if source == policeImage then 
            triggerServerEvent ( "setTeam", localPlayer, "police" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "1.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )         
            VisibleOff ( ) 
        elseif source == groveImage then 
            triggerServerEvent ( "setTeam", localPlayer, "grove" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "2.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )     
            VisibleOff ( ) 
        elseif source == ballasImage then 
            triggerServerEvent ( "setTeam", localPlayer, "ballas" ) 
            if theData then 
                destroyElement ( theData ) 
            end 
            theSound = playSound ( "3.mp3" ) 
            setElementData ( localPlayer, "theSound", theSound )     
            VisibleOff ( ) 
        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...