Sign in to follow this  
Captien

Sirens Silencer

Recommended Posts

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('playerEnteredVehicle', (player) => {
    player.call('VehicleEntered', [player.seat]);
});

 

Client-side:

Spoiler
let localPlayer = mp.players.local, vehicle = localPlayer.vehicle, state, vehSeat, data = new Map();

mp.events.add('VehicleEntered', (seat) => {
    if (classchecker()) {
        if (seat === -1) {
            vehSeat = -1;
            if (data.get(vehicle) === undefined) {
                data.set(vehicle, false);
            }
        }
    }
});


mp.keys.bind(0x42, true, _ => {
    if (vehicle && vehSeat === -1) {
        if (data.get(vehicle) == false) {
            data.set(vehicle, true);
            mp.game.graphics.notify(`Silent mode activated.`);
            vehicle.setSirenSound(true);
        } else if (data.get(vehicle) == true) {
            data.set(vehicle, false);
            mp.game.graphics.notify(`Silent mode deactivated.`);
            vehicle.setSirenSound(false);
        }
    }
});

function classchecker() {
    let vehClass = vehicle.getClass();
    if (vehClass !== 18) return false;
    return true;
};

 

If you need anything 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 by Captien
Updated to current rage version support
  • Like 2

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.