PivityGmodStore

Lua API

Glossary

TeamIndex The team's number: each team (DarkRP jobs are teams) in Garry's Mod is assigned a team index, which is an incremental number that uniquely identifies it. DarkRP job team indexes can be accessed using TEAM_VARIABLEs which were created in jobs.lua

Actor The player who is responsible for the action; who ordered it

SteamID32 STEAM_0:1:40314158, Player:SteamID()

SteamID64 76561198040894045, Player:SteamID64()

AccountID 80628317, Player:AccountID()

FactionInsensitive If set to true, the check will ignore the player's faction.

Detecting if Billy's Whitelist is running

At normal runtime:

if (GAS and GAS.JobWhitelist) then
-- My code
end

At server startup:

hook.Add("bWhitelist:Init", "MyHookIdentifier", function()
-- My code
end)


Enabling/disabling whitelists and blacklists

Is whitelist enabled? true or false

GAS.JobWhitelist:IsWhitelistEnabled( TeamIndex [number] )

Enable a whitelist

GAS.JobWhitelist:EnableWhitelist( TeamIndex [number], Actor [player] [optional] )

Disable a whitelist

GAS.JobWhitelist:DisableWhitelist( TeamIndex [number], Actor [player] [optional] )


Is blacklist enabled? true or false

GAS.JobWhitelist:IsBlacklistEnabled( TeamIndex [number] )

Enable a blacklist

GAS.JobWhitelist:EnableBlacklist( TeamIndex [number], Actor [player] [optional] )

Disable a blacklist

GAS.JobWhitelist:DisableBlacklist( TeamIndex [number], Actor [player] [optional] )


Checking if a player is whitelisted to a job

GAS.JobWhitelist:IsWhitelisted( Player [player], TeamIndex [number], FactionInsensitive [true/false] [optional] )

FactionInsensitive If set to true, the check will ignore the player's faction.

Returns true or false.


Checking if a player is blacklisted from a job

GAS.JobWhitelist:IsBlacklisted( Player [player], TeamIndex [number], FactionInsensitive [true/false] [optional] )

FactionInsensitive If set to true, the check will ignore the player's faction.

Returns true or false.


Adding to whitelists and blacklists

Add a player's SteamID to a whitelist

GAS.JobWhitelist:AddToWhitelist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, SteamID32/SteamID64/AccountID [string/number], Actor [player] [optional] )

Add a usergroup to a whitelist

GAS.JobWhitelist:AddToWhitelist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_USERGROUP, Usergroup [string], Actor [player] [optional] )

Add a player's SteamID to a blacklist

GAS.JobWhitelist:AddToBlacklist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, SteamID32/SteamID64/AccountID [string/number], Actor [player] [optional] )

Add a usergroup to a blacklist

GAS.JobWhitelist:AddToBlacklist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_USERGROUP, Usergroup [string], Actor [player] [optional] )


Removing from whitelists and blacklists

Remove a player from a whitelist

GAS.JobWhitelist:RemoveFromWhitelist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, Player [player], Actor [player] [optional] )

Remove a player's SteamID from a whitelist

GAS.JobWhitelist:RemoveFromWhitelist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, SteamID32/SteamID64/AccountID [string/number], Actor [player] [optional] )

Remove a usergroup from a whitelist

GAS.JobWhitelist:RemoveFromWhitelist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_USERGROUP, Usergroup [string], Actor [player] [optional] )


Remove a player from a blacklist

GAS.JobWhitelist:RemoveFromBlacklist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, Player [player], Actor [player] [optional] )

Remove a player's SteamID from a blacklist

GAS.JobWhitelist:RemoveFromBlacklist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_STEAMID, SteamID32/SteamID64/AccountID [string/number], Actor [player] [optional] )

Remove a usergroup from a blacklist

GAS.JobWhitelist:RemoveFromBlacklist( TeamIndex [number], GAS.JobWhitelist.LIST_TYPE_USERGROUP, Usergroup [string], Actor [player] [optional] )


Getting a list of all jobs a player can access

local AccessibleJobs, AccessibleJobsCount = GAS.JobWhitelist:GetPlayerAccessibleJobs( Player [player] )

Returns a table containing the keys of TeamIndex that the player can access and how many keys are in the table.

Table structure


Getting a player's faction

GAS.JobWhitelist:GetPlayerFaction( Player [ply] )

Returns a table containing information about the player's faction. If the player has no faction this will return nil.

Table structure

Can't find what you're looking for?

Contact support