[Release] DiscordWeaponPerms

Documentation moved [refer to following for instructions]: DiscordWeaponPerms - Badger Docs

Archived Documentation Below:

Version 1.0

Another discord script of course! With this script, you can restrict weapons to certain roles on your discord server! This script also allows restricting certain attachments to different groups as well (however, it’ll remove the weapon if they have the attachment, I’ll eventually update it to just remove the attachment from the weapon).

You must set up IllusiveTea’s discord_perms script for this to work properly. → Discord roles for permissions (im creative, i know)

How it works

roleList = {
1, -- Trusted Civ (1)
1, -- Donator (2)
1, -- Personal (3)
}

responds to it’s respective number within the other list:

restrictedWeapons = {
{}, -- Trusted Civ (1)
{}, -- Donator (2)
{
"WEAPON_RPG",
}, -- Personal (3)
}

The RPG weapon would then be restricted to only people with personal discord role within your discord server.

It’s quite simple :slight_smile:

Installation
  1. Download DiscordWeaponPerms
  2. Extract the .zip and place the folder in your /resources/ of your Fivem server
  3. Make sure you add “start DiscordWeaponPerms” in your server.cfg
  4. Enjoy :slight_smile:
Download

DiscordWeaponPerms

My Other Work

DiscordChatRoles

DiscordAcePerms

SandyVehiclesRestrict

DiscordTagIDs

DiscordVehiclesRestrict

DiscordPedPerms

BadgerAnims

DiscordWeaponPerms

BadgerTools

BadgerBankRobbery

VehicleTrustSystem

Version 2.0

  • Removing restricted weapon attachments from weapon instead of whole weapon?
14 Likes

hi bro the code in

roleList = {
1, -- Trusted Civ (1)
1, -- Donator (2)
1, -- Personal (3)
}

to get the code from the role do I have to discord in this way?

Exajmple : in discord " /@Whitelisted " and copy all number

<@&45687345345672343> (number is random for example)

“45687345345672343” and paste it this way it would look like this.

roleList = {
45687345345672343, -- Whitelisted (1)
1, -- Donator (2)
1, -- Personal (3)
}

Is that right or is this the right way?

Looks good so far

hey man is there any way to make it so it doesn’t delete the weapon and still keep it in the inventory.

EDIT: okey i tried this

RemoveWeaponFromPed(ped, weapon)
GiveWeaponToPed(ped, weapon,1000)

it kinda works, the person still has the weapon but cannot use it. But the person can still shot 1 or 2 bullets do you know any other way? Thank you.

Okey so edit 2 lol : by reducing Citizen.Wait() value i can make the thing go faster and it works really well but i dont know if it has anyother consequences.

1 Like

how do you reduce the citizen wait? could you give me an example so I can do the same?
Thanks, Snake.

Super script but why when I put the rank it works but must I restart the script in game for it to work?

What happen if the person doesnt have a role on discord?

I dont know why but i just cant configure this right, i want to limit some weapons for the police to use only but if i give myself the police role it works, but if i add my “Owner”, “Whitelisted”, “Citizen” to me it doesnt work. Does it not read past 1 role? I tried setting my “Police” role on #1 in discord_perms but that didnt work…

The people who i want to give the weapon perms have the following roles “Citizen” “Whitelisted” & “Police” and the boss also has “Police Boss” how do i set this up right so it only looks for the role “Police”? And it doesnt stop when it found some other role (can be laggy? or can be timed every 5 min?)

1 Like

Don’t understand what you’re trying to do. This script works fine, I use it on my own server. It’s also not laggy at all.

I did not say it was laggy, i’m trying to say i cant get it to work with users with more then 1 role in Discord

i use Vmenu on the vmenu weapon prossions do i need to set anything there or delete all of it for this to work or?

This just removes the weapons from their inventory if they don’t have the proper role for the weapon.

1 Like

Is it a video tut somewhere?

1 Like

I have a couple questions.

  1. If a weapon is not listed in here, is it available for everyone? (The sample data shows Trusted CIV as the first role so will randoms be able to access anything that is not listed in one of the levels or will they not be able to use anything?)
  2. If we want multiple groups to be able to access a certain weapon, (for example our level 3 CIVs can use the heavy sniper, but so can LEO) do we need to add it to both roles or is this done in a method where the 4th role can access the weapons of the 3 roles above it?
1 Like
  1. If it’s not listed, it’s available for everyone.

  2. There is no inheritance in this script. If you want multiple people to have access to something, give them all the same role that corresponds to the weapon permisisons.

Rather than give them a role that has the weapon, can weapons be listed under multiple roles or does that fail due to them not having all the roles a certain weapon is under? Basically, we have 4 levels of CIV (random, Applied 1, 2, and 3. And then we have our LEO. The higher someone is in CIV, the more/better weapons they can use but LEO Swat officers will need weapons that are set to CIV 2 and CIV 3 even though the officer may not be a CIV2 or CIV3 so my thought was to add the weapons to both the appropriate CIV role and the LEO role but now am wondering if a LEO that is CIV1 is assigned to sniper, will he be able to use the heavy sniper that is in CIV2 and in LEO if he doesn’t have the CIV2 role?

The weapons should only be listed under 1 role, not multiple

Yea, I was afraid of that after your last message but it makes sense. Time to go rework my layout. Glad I found this out before I actually tried to go live with this! Thanks for your great work!!!

1 Like

Is there a way to get this to deal with weapons that are saved in a loadout? I set certain weapons like the Heavy Sniper MK2 and sticky bombs as only available for our LEO and made sure I do not currently have the LEO role for testing purposes. I have my “default” loadout that loads onto my character automatically when I join a server through vMenu that includes these weapons. When I try to use my stick bombs, it takes them away from me but when I try to use my heavy sniper MK2, it lets me use it all I want. Now if I go into vMenu and remove the sniper and then try to put it back, I’m prevented from doing so as expected but all I have to do is log out and back in and I have it back thanks to vMenu.

Hey, So I really don’t understand this? If anyone has a good example I would love it if you could send it