Jump to content

Sounds to server.


benwilkins

Recommended Posts

OK i have set up a client script where a command will play the sound to the local client. Ive never worked with playSound3D.

How can I make it so that if someone types /alarm, then the whole server will hear it not just the local player who typed it?..

Code:

function bankalarm () 
  
   Alarm = playSound3D("alarm.wav", -2649.9130859375, 376.15625, 6.15625, true) 
    setSoundVolume(Alarm, 3) 
    setSoundMaxDistance(Alarm, 100) 
     
      Alarm2 = playSound3D("alarm.wav", 2328.638671875, 2367.5283203125, 2022.92578125, true) 
    setSoundVolume(Alarm2, 3) 
    setSoundMaxDistance(Alarm2, 100) 
    setElementInterior ( Alarm2, 0 ) 
    setElementDimension ( Alarm2, 5 ) 
     
outputChatBox("Playing", getRootElement(), 255, 255, 0) 
     
end 
addCommandHandler("alarm", bankalarm) 
  
function stopAlarm () 
  
    stopSound( Alarm ) 
    stopSound( Alarm2 ) 
    outputChatBox("Stopped", getRootElement(), 255, 255, 0) 
end 
addCommandHandler("stopalarm", stopAlarm) 
  

Link to comment

client

function bankalarm () 
  
   Alarm = playSound3D("alarm.wav", -2649.9130859375, 376.15625, 6.15625, true) 
   setSoundVolume(Alarm, 3) 
   setSoundMaxDistance(Alarm, 100) 
    
   Alarm2 = playSound3D("alarm.wav", 2328.638671875, 2367.5283203125, 2022.92578125, true) 
   setSoundVolume(Alarm2, 3) 
   setSoundMaxDistance(Alarm2, 100) 
   setElementInterior ( Alarm2, 0 ) 
   setElementDimension ( Alarm2, 5 ) 
    
   outputChatBox("Playing", getRootElement(), 255, 255, 0) 
end 
addEvent( "playAlarm", true ) 
addEventHandler( "playAlarm", getRootElement(), bankalarm ) 

server

function playAlarm ( ) 
    triggerClientEvent ( "playAlarm", getRootElement() ) 
end 
addCommandHandler ( "alarm", playAlarm ) 

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