Whitelist fivem resource

I'm helping a well known server get discord whitelist, BUT IT WONT WORK SOMEONE HELP!!

FAXES Documentation > FiveM Documentation > Discord Whitelist Installation

Discord Whitelist Installation

As of version 3.0 of DiscordWhitelist it no longer uses any other script as a required dependency. It is now standalone and works by itself. Server owners/"developers" appeared to have much trouble installing the script. So now its a drag 'n drop!

Creating an Application ¶

To operate DiscordWhitelist we need to have a Discord bot application in our guild. This bot doesn't need to be online, just in the guild.

  • Create a new application from the Discord Developer Portal.

  • Click on 'Bot' on the left navigation bar and enable the bot. Then copy the Bot Token and have ready for the below.

  • Now in the 'General Information' tab copy the 'Client ID' and replace CLIENT_ID_HERE in the below template.

//discord.com/oauth2/authorize?client_id=CLIENT_ID_HERE&scope=bot&permissions=8

Now invite your bot to your guild.

Installing DiscordWhitelist ¶

Now it's time to install the script itself. First off...

  • Download and extract Discord Whitelist into your resources folder.

  • Open the server.js file in the resource and edit to include the settings you want reflected.

  • Add ensure DiscordWhitelist into your server.cfg.

Join My Discord

Was this article helpful?

105 out of 200 found this helpful

The permission system allows you to control which admins can perform which actions. For instance you can allow one admin to only view the console and kick players, but not restart the server and execute arbitrary commands. The permissions are saved in the txData/admins.json file and can be edited through the Admin Manager page by the Master admin, or users with all_permissions or manage.admins permissions.

Available Permissions

  • all_permissions: Root permission that allows the user to perform any action. When set, this will remove all other permissions;
  • manage.admins: Permission to create, edit and remove other admin accounts;
  • settings.view: Permission to view the settings. Tokens will be redacted;
  • settings.write: Permission to edit the settings;
  • control.server: Permission to start/stop/restart the server;
  • commands.resources: Permission to start/ensure/restart/stop resources;
  • players.ban: Permission to ban/unban players;
  • players.kick: Permission to kick one or all players;
  • players.message: Permission to to send admin messages via DM or Broadcast command;
  • players.warn: Permission to warn players;
  • players.whitelist: Permission to whitelist or remove the whitelist of players;
  • console.view: Permission to view the Live Console;
  • console.write: Permission to execute commands in the Live Console.
  • server.cfg.editor: Permission to view and edit the FXServer CFG File [eg server.cfg].

On this quick tutorial, you’ll learn to add a whitelist to any side of a useful resource, utilizing both a JSON file, or Ace Permissions. After getting applied both of those strategies, it is so simple as wrapping your code in IF statements. In your comfort, code snippets have been supplied, and a few examples given on the finish.

Stipulations:

  • A fundamental understanding of LUA
  • A fundamental understanding of how assets are created
  • A really fundamental understanding of JSON syntax
    • Sufficient to know the place commas must go as to not break your file.

So as to add a JSON whitelist to your useful resource, the very first thing you have to to do is create the whitelist file. To do that, create a brand new file inside your useful resource folder, and identify it one thing like whitelist.json. After getting accomplished this, open up the __resource.lua in your useful resource, and for those who would not have a information part, add one, like beneath:

gist.github.com
-- In the event you solely have the one file file "whitelist.json"
gist.github.com
-- In case you have a number of information information { "file.1", "file.2", "file.3", "whitelist.json" }

After getting accomplished this, open your JSON file, and add the next code:

gist.github.com
[ { "steamhex" : "steam:1100001076264E1" } ]

This entry will act as our template, which we are going to construct upon. To get somebody’s steam hexadecimal [steamhex], go to VacBanned.com, entry the individual’s steam profile url, then copy the Steam3 ID [64bit] => [Hex], then change it’s going to the one from the template, ensuring to maintain the steam: prefix, as that is required.

The subsequent step is to create entries that we wish whitelisting for; on this tutorial, we can be whitelisting two instructions, and a shopper occasion. The way in which we are going to code the whitelist, is that any entries which might be included in somebody’s whitelist entry, can be granted [except set to false], and any entries that aren’t included, can be denied. For instance:

gist.github.com
[ { "steamhex" : "steam:person1", "command1" : true, "command2" : true, "event" : true }, { "steamhex" : "steam:person2",

This file has been truncated. show original

In the above example, person1 will have access to command1, command2, and event; person2 will have access to command1 and event; and person3 will only have access to event. This will make more sense later on in the tutorial.

The next step is setting up the whitelist in our client script. To start, add the following code somewhere near the top of one of your client files:

gist.github.com
-- Local whitelist variable local Whitelist = {}

We now need to replicate what we entered in the JSON file; following the example above:

gist.github.com
-- Local whitelist variable local Whitelist = {} -- Boolean for whether player is whitelisted for command1 Whitelist.command1 = false -- Boolean for whether player is whitelisted for command2 Whitelist.command2 = false -- Boolean for whether player is whitelisted for event Whitelist.event = false

Once you have entered these, ensure they are all set to false, and place the following code below the above code:

gist.github.com
-- When the resource is loaded on the client AddEventHandler["onClientResourceStart", function [ResourceName] -- If the started resource is this resource if[GetCurrentResourceName[] == ResourceName] then -- Pass whitelist object to server for updating TriggerServerEvent["Whitelist:WhitelistCheck", Whitelist] end end]

This will pass our whitelist object to the server script for populating. Once you have pasted this code, open a server script of your choice, and add the following code to it:

gist.github.com
-- Whitelist check on server join RegisterServerEvent["Whitelist:WhitelistCheck"] AddEventHandler["Whitelist:WhitelistCheck", function[Whitelist] -- Loop though all whitelist entries for i in pairs[Whitelist] do -- Set all entries to pending Whitelist[i] = "pending" finish -- Gather all the information from the whitelist.json file

This file has been truncated. show original

[Make certain to broaden this gist]

After getting accomplished this, head again to your shopper script, and add this code:

gist.github.com
-- Return from whitelist examine RegisterNetEvent["Whitelist:Return:WhitelistCheck"] AddEventHandler["Whitelist:Return:WhitelistCheck", perform[NewWhitelist] -- Replace native whitelist values with server ones Whitelist = NewWhitelist finish]

We now have all we have to add whitelist checking to our script. Beneath is an instance utilizing the instance set-up from above:

gist.github.com
-- /command1 command RegisterCommand["command1", perform[] -- Examine if the participant is whitelisted to make use of this command if Whitelist.command1 then -- Code right here can be run if the participant is whitelisted -- If participant is just not whitelisted else -- Code right here can be run if the participant NOT is whitelisted finish finish]

This file has been truncated. show original

[Make certain to broaden this gist]

You may have added a JSON whitelist to your useful resource, effectively accomplished.

So as to add an Ace Permissions whitelist to your useful resource, the very first thing you have to to do is create the whitelist file. To do that, create a brand new file inside your useful resource folder, and identify it one thing like whitelist.cfg. After getting accomplished this, open up your server.cfg file, and add the next line above your assets:

gist.github.com
exec "assets/your-resource-name-here/whitelist.cfg"

After getting accomplished this, return to your useful resource folder, and open the whitelist.cfg file, as soon as open, paste on this code:

gist.github.com
# # Permissions # Add your participant's identifiers within the sections beneath. # # Primary Person # Instructions: # - /command1 add_principal identifier.steam:1100001076264E1 whitelist.group.person

This file has been truncated. show original

On this tutorial, we can be whitelisting two teams: person and advanced_user. person could have entry to command1, whereas advanced_user could have entry to command1, command2, and occasion. To be taught extra about how this works, see the “Additional Studying” part on the backside of this publish.

The subsequent step is establishing the whitelist in our shopper script. To start out, add the next code someplace close to the highest of one in all your shopper information:

gist.github.com
-- Native whitelist variable native Whitelist = {}

Now, we have to replicate what we entered within the CFG file; following the instance above:

gist.github.com
-- Native whitelist variable native Whitelist = {} -- Boolean for whether or not participant is whitelisted for command1 Whitelist.command1 = false -- Boolean for whether or not participant is whitelisted for command2 Whitelist.command2 = false -- Boolean for whether or not participant is whitelisted for occasion Whitelist.occasion = false

After getting entered these, guarantee they’re all set to false, and place the next code beneath the above code:

gist.github.com
-- When the useful resource is loaded on the shopper AddEventHandler["onClientResourceStart", perform [ResourceName] -- If the began useful resource is that this useful resource if[GetCurrentResourceName[] == ResourceName] then -- Move whitelist object to server for updating TriggerServerEvent["Whitelist:WhitelistCheck", Whitelist] finish finish]

This may go our whitelist object to the server script for populating. After getting pasted this code, open a server script of your alternative, and add the next code:

gist.github.com
-- Whitelist examine on server be part of RegisterServerEvent["Whitelist:WhitelistCheck"] AddEventHandler["Whitelist:WhitelistCheck", perform[Whitelist] -- Loop by way of all whitelist entries for i in pairs[Whitelist] do -- Grant participant permission to command primarily based on Ace group Whitelist[i] = IsPlayerAceAllowed[supply, "whitelist." .. i] finish -- Return whietlist object to shopper TriggerClientEvent["Whitelist:Return:WhitelistCheck", supply, Whitelist]

This file has been truncated. show original

[Make certain to broaden this gist]

After getting accomplished this, head again to your shopper script, and add this code:

gist.github.com
-- Return from whitelist examine RegisterNetEvent["Whitelist:Return:WhitelistCheck"] AddEventHandler["Whitelist:Return:WhitelistCheck", perform[NewWhitelist] -- Replace native whitelist values with server ones Whitelist = NewWhitelist finish]

We now have all we have to add whitelist checking to our script. Beneath is an instance utilizing the instance code above:

gist.github.com
-- /command1 command RegisterCommand["command1", perform[] -- Examine if the participant is whitelisted to make use of this command if Whitelist.command1 then -- Code right here can be run if the participant is whitelisted -- If participant is just not whitelisted else -- Code right here can be run if the participant NOT is whitelisted finish finish]

This file has been truncated. show original

[Make certain to broaden this gist]

You may have now added an Ace Permissions Whitelist to your useful resource, congratulations.

JSON Instance

GitHub

inferno-collection/Warn

A really fundamental warn command. Contribute to inferno-collection/Warn improvement by creating an account on GitHub.

Ace Instance

GitHub

TomGrobbe/vMenu

vMenu is a customized server sided coach/menu, constructed utilizing a customized model of NativeUI. It has full permissions assist, so the server proprietor can resolve who’s allowed to do what. – TomGrobbe/vMenu

JSON & Ace Instance

GitHub

inferno-collection/Fire-EMS-Pager

A easy useful resource that enables gamers to show their pager on, and tune it to name varieties. – inferno-collection/Hearth-EMS-Pager

Fundamentals: Aces & Principals Aces and principals are the default “permissions” system constructed into fxserver. It’s very straightforward to make use of, so long as you recognize the fundamentals and also you simply begin attempting out some stuff.

It’s additionally very straightforward to make use of this from inside assets. Simply use ExecuteCommand[] so as to add/take away aces or principals, and use IsPlayerAceAllowed[] to examine if a participant is allowed entry to an ace [both instantly or through inherited permissions].

Video liên quan

Chủ Đề