X-SHADOW Posted March 30, 2012 Posted March 30, 2012 ok Sorry Man i wont post any thing befoure i know it Sorry
sckatchof Posted March 30, 2012 Author Posted March 30, 2012 How could it ever work if you forgot to add this: addEvent ( "stopCarRadio", true ) addEventHandler ( "stopCarRadio", root, function ( car ) if ( isElement ( carSounds[ car ] ) ) then destroyElement ( carSounds[ car ] ) end end ) and i add this i still work the music
sckatchof Posted March 30, 2012 Author Posted March 30, 2012 Have you triggered "stopCarRadio" event? sure.
sckatchof Posted March 30, 2012 Author Posted March 30, 2012 http://www.mediafire.com/?s7ysplbztr02pjp still don't work delete my resource and i add your resource and still work the sound . just when i reconnect or quit it stop
Castillo Posted March 30, 2012 Posted March 30, 2012 Seriously, you must have something wrong in your server, it works perfectly fine.
X-SHADOW Posted March 30, 2012 Posted March 30, 2012 local carRadios = { } -- Create a table. function attachradio ( thePlayer ) local car = getPedOccupiedVehicle ( thePlayer ) if ( car ) then if ( isElement ( carRadios[ car ] ) ) then -- If the vehicle already has a radio... outputChatBox ( "This vehicle already has a radio.", thePlayer, 255, 0, 0 ) else local x, y, z = getElementRotation ( car ) carRadios[ car ] = createObject ( 2232, 1016.2437133789, -2473.1711425781, 7.6930656433105, x, y, z ) -- Create radio object for the vehicle. attachElements ( carRadios[ car ], car, 0, -4, 0.45 ) -- Attach the radio to the vehicle. triggerClientEvent ( "playRadioCar", root, car ) outputChatBox ( "Here is the radio!", thePlayer ) end end end addCommandHandler ( "radio", attachradio ) addCommandHandler ( "stopradio", function ( thePlayer ) local car = getPedOccupiedVehicle ( thePlayer ) if ( car ) then if ( not isElement ( carRadios[ car ] ) ) then -- If the vehicle has no radio... outputChatBox ( "This vehicle has no radio.", thePlayer, 255, 0, 0 ) triggerClientEvent ( "stopCarRadio", root, car ) end end end ) sounds = "http://www.181.fm/winamp.pls?station=181-power&style=mp3" carSounds = { } function playRadioCar ( car ) local x,y,z = getElementPosition ( car ) if ( isElement ( carSounds[ car ] ) ) then destroyElement ( carSounds[ car ] ) end carSounds[ car ] = playSound3D ( sounds, x, y, z, true ) attachElements ( carSounds[ car ], car ) end addEvent ( "playRadioCar", true ) addEventHandler( "playRadioCar", getRootElement(), playRadioCar ) addEvent ( "stopCarRadio", true ) addEventHandler ( "stopCarRadio", root, function ( car ) if ( isElement ( carSounds[ car ] ) ) then stopSound ( carSounds[ car ] ) end end )
Castillo Posted March 30, 2012 Posted March 30, 2012 @X-SHADOW: Could you please stop posting bull****? my script works perfect.
sckatchof Posted March 30, 2012 Author Posted March 30, 2012 Seriously, you must have something wrong in your server, it works perfectly fine. Maybe i have problem but thaaank you for help i will try to fix it or change it
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now