Jump to content

[HELP] Play music just after midnight at stake.


off

Recommended Posts

Here's an example for real time

addEventHandler( 'onClientRender', root, 
    function ( ) 
        local realtime = getRealTime(); 
        local Hour = realtime.hour; 
        local Minutes = realtime.minute; 
        if Hour == 20 and Minutes = 0 then 
            -- Do something, like you want to play sound : 
            playSound( ... ); 
        end 
    end 
); 

and example for game time

addEventHandler( 'onClientRender', root, 
    function ( ) 
        local Hour, Minutes = getTime(); 
        if Hour == 20 and Minutes = 0 then 
            -- Do something, like you want to play sound : 
            playSound( ... ); 
        end 
    end 
); 

Edited by Guest
Link to comment

Hold on, did not work!

See how it is:

addEventHandler( 'onClienRender', root, 
    function ( ) 
        local Hour, Minutes = getTime(); 
        if Hour == 6 and Minutes = 0 then 
            playSound("sounds/Morning.mp3"); 
            setSoundVolume(sound, 50.0) 
        end 
    end 
        function ( ) 
        local Hour, Minutes = getTime(); 
        if Hour == 12 and Minutes = 0 then 
            playSound("sounds/Day.mp3"); 
            setSoundVolume(sound, 50.0) 
        end 
    end 
        function ( ) 
        local Hour, Minutes = getTime(); 
        if Hour == 15 and Minutes = 0 then 
            playSound("sounds/Dusk.mp3"); 
            setSoundVolume(sound, 50.0) 
        end 
    end 
        function ( ) 
        local Hour, Minutes = getTime(); 
        if Hour == 20 and Minutes = 0 then 
            playSound("sounds/Night.mp3"); 
            setSoundVolume(sound, 50.0) 
        end 
    end 
); 

Link to comment
addEventHandler( 'onClienRender', root, 
    function ( ) 
        local Hour, Minutes = getTime() 
        if Hour == 6 and Minutes == 0 then 
            local sound = playSound("sounds/Morning.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 12 and Minutes == 0 then 
            local sound = playSound("sounds/Day.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 15 and Minutes == 0 then 
            local sound = playSound("sounds/Dusk.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 20 and Minutes == 0 then 
            local sound = playSound("sounds/Night.mp3") 
            setSoundVolume(sound, 50.0) 
        end 
    end 
) 

Link to comment
addEventHandler( 'onClientRender', root, 
    function ( ) 
        local Hour, Minutes = getTime() 
        if Hour == 6 and Minutes == 0 then 
            local sound = playSound("sounds/Morning.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 12 and Minutes == 0 then 
            local sound = playSound("sounds/Day.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 15 and Minutes == 0 then 
            local sound = playSound("sounds/Dusk.mp3") 
            setSoundVolume(sound, 50.0) 
        elseif Hour == 20 and Minutes == 0 then 
            local sound = playSound("sounds/Night.mp3") 
            setSoundVolume(sound, 50.0) 
        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...