Captien Posted December 1, 2017 Posted December 1, 2017 (edited) Hello Guys, Welcome again to another tutorial. Today i'm going to introduce to you guys the Sirens Silencer. If you want to be stealth and raid the criminals without they notice you, this will be your solution. The script is very simple. When player enters a Emergency Vehicle, the script will work by pressing B. The silencer is also saved for future uses if you park yours car and took another one and then came back. The silencer will be waiting you. Server-side: Spoiler mp.events.add('syncSirens', (player, vehicle) => { if (vehicle && mp.vehicles.exists(vehicle.id)) vehicle.setVariable('silentMode', !vehicle.getVariable('silentMode')) }); Client-side: Spoiler let localPlayer = mp.players.local; mp.keys.bind(0x42, true, _ => { if (localPlayer.vehicle && localPlayer.vehicle.getPedInSeat(-1) === localPlayer.handle && localPlayer.vehicle.getClass() === 18) { localPlayer.vehicle.getVariable('silentMode') ? mp.game.graphics.notify(`Silent mode is deactivated.`) : mp.game.graphics.notify(`Silent mode is activated.`); mp.events.callRemote('syncSirens', localPlayer.vehicle) } }); mp.events.add('entityStreamIn', (entity) => { if (entity.type === 'vehicle' && entity.getClass() === 18 && entity.hasVariable('silentMode')) entity.getVariable('silentMode') ? entity.setSirenSound(true) : entity.setSirenSound(false); }); mp.events.addDataHandler("silentMode", (entity, value) => { if (entity.type === "vehicle") entity.setSirenSound(value); }); If you need any help, don't hesitate to post your problem in this topic. You're free to use, change, copy this script. (Don't Forget some credits) Hope you enjoyed the Tutorial. Have a nice day! Regards, Captien. Edited October 13, 2019 by Captien Added improved version 6
Captien Posted February 19, 2019 Author Posted February 19, 2019 This example was created ages ago since 2017 where setSirenSound was named another function. Anyways thanks to notifying me, updated the script for current version compatibility.
DatMayo Posted March 29, 2019 Posted March 29, 2019 Is there a way to get this sync? Setting the value of another emergency car will not effect other players
robearded Posted March 29, 2019 Posted March 29, 2019 21 minutes ago, DatMayo said: Is there a way to get this sync? Setting the value of another emergency car will not effect other players ofcourse, trigger a server event whenever you changing the siren sound property, catch the event on your server then send an event to all players.
Flow Posted April 9, 2019 Posted April 9, 2019 (edited) @Captien this is an error: mp.events.add('entityStreamIn', (entity) => { if (entity.type === 'vehicle' && entity.getClass() === 18 && entity.hasVariable('silentMode')) localPlayer.vehicle.getVariable('silentMode') ? entity.setSirenSound(true) : entity.setSirenSound(false); }); should be mp.events.add('entityStreamIn', (entity) => { if (entity.type === 'vehicle' && entity.getClass() === 18 && entity.hasVariable('silentMode')) entity.getVariable('silentMode') ? entity.setSirenSound(true) : entity.setSirenSound(false); }); Edited April 9, 2019 by Flow 1 1
Xabi Posted November 25, 2019 Posted November 25, 2019 1 hour ago, Xenox said: how to c# ? Almost the same, just search the functions on rage-sharp.dll, they're called almost the same way.
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