WhoAmI Posted February 24, 2014 Share Posted February 24, 2014 Hi guys! I have one question. Is it possible to do new sound of cop's car and ambulance's sirens? I was looking for event, which start when someone turns on sirens, but there is no event like that, so... Is there antoher way? Someone has an idea? Link to comment
Dealman Posted February 24, 2014 Share Posted February 24, 2014 You could do it in quite a few ways, however this is the kind of direction I'd go with; Use the event onClientKey to detect when the horn key is pressed. (You can also use getBoundKeys to retrieve all the keys bound to horn and store them in a table for better compatibility) Then check if the player is in a vehicle, and if in a defined vehicle. You can define the IDs in whatever way you want - but I would recommend using a table. Run a basic for check to see if the current vehicle model exists in the table - if it does, disable the horn using toggleControl. If it doesn't exist in the table - do nothing(Unless you want a different default horn). Then you can use these to play the sound and attach it to the vehicle; getElementPosition -- The vehicle's position, send this data to the server using triggerServerEvent. triggerServerEvent -- Trigger a server event which in return triggers an event for all clients, which triggerClientEvent -- Trigger a client-side event for all clients playSound3D -- Play the sound at the vehicle's position attachElements -- Attach the sound to the vehicle. Link to comment
WhoAmI Posted February 24, 2014 Author Share Posted February 24, 2014 Can you show me an example? I just want code when the sirens would be on and off, rest i'd do. Link to comment
Dealman Posted February 24, 2014 Share Posted February 24, 2014 Unless someone does it before me, I'll try to provide you with an example sometime after work tomorrow(Tuesday). Link to comment
Bonsai Posted February 25, 2014 Share Posted February 25, 2014 You could use getVehicleSirensOn whenever the player presses the key bound to "horn" control. That way you could create your own events that trigger when sirens are turned on/off. Link to comment
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