Jump to content

Question


Arsilex

Recommended Posts

function startMusic() 
    setRadioChannel(0) 
    song = playSound("files/song.ogg",true) 
    outputChatBox("Press M to break the ambiance") 
    setSoundVolume(song, 0) 
    end 
     
    function musicvol() 
        setSoundVolume(song, 1) 
end 
  
function makeRadioStayOff() 
    setRadioChannel(0) 
    cancelEvent() 
end 
  
function toggleSong() 
    if not songOff then 
        setSoundVolume(song,0) 
        songOff = true 
        removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) 
    else 
        setSoundVolume(song,1) 
        songOff = false 
        setRadioChannel(0) 
        addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) 
    end 
end 
  
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic) 
addEventHandler("onClientMarkerHit", markermusic, musicvol) 
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) 
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) 
addCommandHandler("musicmusic",toggleSong) 
bindKey("m","down","musicmusic") 
  
function CreateMarker ( playerSource ) 
    if ( playerSource ) then 
        local x, y, z = getElementPosition ( playerSource ) 
        music marker = createMarker ( -1645, -188, 14.14396572113, "checkpoint", 2, 255, 0, 0, 255 ) 
        addEventHandler("onMarkerHit", marker, MarkerHit) 
         
        function music marker() 
    sound = playSound( "music.mp3", true ) 
end 
addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), startMySound ) 
  
function stopMySound() 
    stopSound( sound ) 
end 
  
addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic) 
addEventHandler("onClientMarkerHit", markermusic, musica) 
addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff) 
addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff) 

ASi???????????

Link to comment
function startingPlayingSound() 
   channel1 = playSound ( "channel1.mp3" ) 
   setTimer ( changeChannel, 10000, 1 ) --después de 10 segundos ir a la función changeChannel. 
end 
addEventHandler ( "onClientMapStarting", root, startPlayingSound ) 
  
function changeChannel() 
    destroyElement ( channel1 ) 
    playSound ( "channel2.mp3" ) 
end 

Lo que hace es hacer sonar el archivo "channel.mp3" primero, y después de 10 segundos poner el otro y destruir el 1.

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...