DiscordVehicleRestrictions [A Discord based vehicle restriction script] (INCLUDES INHERITANCE)

DiscordVehicleRestrictions

Documentation:

What is it?

DiscordVehiclesRestrictions is a Discord based vehicle restriction script. I have previously made a script like this in the past, but it was made when I was barely considered a FiveM script developer. Due to the sloppy code practices within that script, I decided to rewrite the script and include something at most people had inquired about within the old one: Inheritance.

Old Script:

Images

Configuration

  • It should be noted that for Config.Inheritances, the roleNames and roleIDs should match up with the ones specified in Config.VehicleRestrictions.

  • Also, inheritance only inherits the role groups listed. Inheriting RoleName2 which inherits RoleName1 would not be inherited for RoleName3.

Config = {
	RestrictedMessage = "~r~Restricted Vehicle Model.",
	InheritanceEnabled = false
}

Config.VehicleRestrictions = {
	['RoleName1 or ID'] = {
		"baller",
		"baller2",
		"baller3",
		"baller4"
	},
	['RoleName2 or ID2'] = {},
	['RoleName3 or ID3'] = {},
	['RoleName4 or ID4'] = {}
}

-- Requires Config.InheritanceEnabled to be = true
Config.Inheritances = {
	['RoleName2 or ID'] = {'RoleName1', 'RoleName3', 'RoleName4'},
    ['RoleName3'] = {'RoleName2'},
}

Example Configuration

Config = {
    RestrictedMessage = "~r~Restricted Vehicle Model.",
    InheritanceEnabled = true
}

Config.VehicleRestrictions = {
    ['Head_Admin'] = {
        "baller",
        "baller2",
        "baller3",
        "baller4",
    },
    ['Admin'] = {
        "dcd",
        "chr20",
    },
    ['Moderator'] = {
        "nf6",
        "foxsnt",
        "foxshelby",
        "gt63s",
        "fhauler",
        "rescue1",
        "um1",
        "um2",
        "um3",
        "um4",
        "um5",
        "um6",
        "um6",
        "riot",
    },
}

-- Requires Config.InheritanceEnabled to be = true
Config.Inheritances = {
    ['Head_Admin'] = {'Admin', 'Moderator'},
}

Thanks to @clewis329 for helping to test this, as well as providing the example configuration file :slight_smile:

Download

5 Likes

Very nice

Oooof ma man badger droppin sweet sweet scripts :smiling_face_with_three_hearts:

Good script from badger :badger:

This works nicely for me, exept if you get in the car normally (turn off warp in vehicle on spawn) it will not delete the vehicle. And sometimes after the script messes up like that, it stops working completely.

That should not be a problem. Sounds like you may have set something up wrong

1 Like

Does the name of this script matter? I have it named something shorter. I will try a completely fresh install of this script and see if i’ve somehow fucked something up.

do you have to assign the tag to the civilians so they can get in for role-playing purposes

It is a very useful Script but it has a small problem or bug. When I spawn a restricted car it works fine and won’t let me pick it up but when I spawn a car that is not restricted and then I spawn a restricted car it does let me drive it.

Wish you can fix it, that would be great.

Thank you.

2 Likes

This should be fixed in the latest update on GitHub I believe. Sorry about that…

Thank you sir badger :smiling_face_with_three_hearts:

VIDEO ? I CAN’T HELP HELP

[image]

Whenever I try to spawn a restricted vehicle, it disappears like it should but when I spawn a unrestricted one, and go back to the restricted car, it does not disappear.

Hi Badger, i found another glitch. If you are able to spawn Resctricted cars but you leave your vehicle in the street another player can get into the car and it is not rectricted for him.

Can you prevent another player from taking the car if a restricted vehicle is abandoned?

Thank you for all Badger, this is script is useful.

5 Likes

I have just pushed an update to the GitHub. This should fix all the problems people were having. Sorry about that.

Love your work badger :smiling_face_with_three_hearts:

Hey, I’m still having the same problem, as @Pr0D1 said. When I leave a restricted vehicle in the road and some gets in it, it allows them to do whatever they want with the vehicle. I even installed the new version in the github.

2 Likes

Thank you! Have been looking for something like this for a while.

Awesome, thanks for this script! Discord perms are amazing :clap: :innocent:

is it possible to restrict entire vehicle groups?