Jump to content

Car music


Recommended Posts

hello,

Does anyone have a script so that music comes from my car?

If you come near the car that you heard music.

It should. Pls files to play.

It's for my server.

I have a bus but i want when players come in it the can hear music.

I have some screenshots of my bus on my server:

busdriverr.jpg

businside.jpg

Can somebody script it or gif me a URl where i can download something like that.

Greetings,

Wesley

Link to comment

#Not tested

-- Server 
local gBus =  
{ 
    [ 1 ] = { ID, x, y, z }, 
    [ 2 ] = { ID, x, y, z } 
}; 
local gVeh = { }; 
  
addEventHandler ( 'onResourceStart', resourceRoot, 
    function( ) 
        for key, value in ipairs ( gBus ) do 
            gVeh[ key ] = createVehicle( value[ 1 ], value[ 2 ], value[ 3 ], value[ 4 ] ); 
        end 
        triggerClientEvent( root, 'handleSong', root, gVeh[ key ] ); 
    end 
); 
  
  
-- Client 
  
local soundPath = 'Path goes here'; 
  
addEvent ( 'handleSong', true ); 
addEventHandler ( 'handleSong', root, 
    function( buss ) 
        local x, y, z = getElementPosition ( buss ); 
        local sound = playSound3D ( soundPath, x, y, z, true ); 
        setSoundMaxDistance ( sound, 20 ); 
        attachElements ( sound, buss ); 
    end 
); 

Don't forget to change the id and position.

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