cityrp.access
Access and Flags - Shared.
- Servercityrp.access.accessdb(aname, asteamid, tname, tsteamid, access, action, timeuntil, reason, areason, onlyadmin)Source ☍
-
Add an access modification to the database.
Parameters
- anamestringThe administrator's name.
- asteamidstringThe administrator's SteamID.
- tnamestringTarget name.
- tsteamidstringTarget SteamID.
- accessstringAccess to modify.
- actionstringTake/give.
- timeuntilnumberRequired playtime for the access to be restored, 0 for permanent.
- reasonstringModification reason.
- areasonstringAdmin-only info, announced to admins if non-empty.
- onlyadminstring|nilOn a give, close only the take rows this admin issued, or every take row when omitted.
- Servercityrp.access.addcommands()Source ☍
-
Register and add access commands.
- Servercityrp.access.BanTime(player, access) → string|integerSource ☍
-
Check how long a player is blacklisted for.
Parameters
- playerPlayerThe player to check.
- accessstringAccess tag string to check.
Returns
- string|integer0 if the player is not blacklisted, or a formatted time-remaining string.
- Servercityrp.access.blacklistcommand(player, arguments)Source ☍
-
Command callback to issue a team blacklist.
Parameters
- playerPlayerCalling player.
- argumentsstring[]Arguments table:
{target, team_or_access_name, playtime, ...reason}.
- Servercityrp.access.checkexpired(ply)Source ☍
-
Check if a player's blacklists have expired. A letter is restored only once no row still holds it, and the log closes exactly the rows that ran out.
Parameters
- plyPlayerThe player to check for.
- Servercityrp.access.ClearBlacklist(player, letter, adminsteamid)Source ☍
-
Drop open blacklist rows on a letter.
Parameters
- playerPlayerThe player.
- letterstringSingle access tag.
- adminsteamidstring|nilDrop only this admin's row, or every row when omitted.
- Sharedcityrp.access.decompose(accessString) → table<string, boolean>Source ☍
-
Decompose an access string into a character lookup table.
Parameters
- accessStringstringThe access string to decompose.
Returns
- table<string, boolean>Table keyed by character, true for each character present in the string.
- Servercityrp.access.describe(letters) → stringSource ☍
-
The names of the access letters in a string, as the admin hub prints them.
Parameters
- lettersstringAccess letters.
Returns
- stringEach letter's name from
cityrp.accessnames, or the letter itself, joined with commas.
- Servercityrp.access.DropExpiredBlacklists(player, letter, timePlayed) → integerSource ☍
-
Drop every open blacklist row on a letter whose time has passed, leaving the rest in place.
Parameters
- playerPlayerThe player.
- letterstringSingle access tag.
- timePlayednumberThe player's current
_TimePlayed.
Returns
- integerHow many rows were dropped.
- Sharedcityrp.access.getAccess(ply) → table<string, boolean>Source ☍
-
Get a player's access table (character -> true lookup), building it from the access string if it's missing.
Internal
This function is internal. Whilst you can call it, you probably shouldn't.
Does not guard against non-local-player misuse; use hasAccess() instead.
Parameters
- plyPlayerPlayer to check.
Returns
- table<string, boolean>The player's access table.
- Sharedcityrp.access.getAccessString(ply) → stringSource ☍
-
Get a player's access string.
Parameters
- plyPlayerPlayer to check.
Returns
- stringThe player's access string.
- Servercityrp.access.GetBlacklist(player, letter) → number|nilSource ☍
-
Read the blacklist enforced on a letter, folded across every open row: a permanent row beats any timed one, otherwise the longest wins.
Parameters
- playerPlayerThe player.
- letterstringSingle access tag.
Returns
- number|nil0 for permanent, the
_TimePlayedthe longest row lifts at, or nil with no open rows.
- Servercityrp.access.GetBlacklistedLetters(player) → string[]Source ☍
-
Every letter the player has an open blacklist row on.
Parameters
- playerPlayerThe player.
Returns
- string[]
- Servercityrp.access.giveAccess(player, access)Source ☍
-
Give player a set of access tags.
Parameters
- playerPlayerThe player to add to.
- accessstringAccess tag string to add.
- Servercityrp.access.giveaccesscommand(player, arguments)Source ☍
-
Command callback to give access.
Parameters
- playerPlayerCalling player.
- argumentsstring[]Arguments table:
{target, access, ...reason}.
- Sharedcityrp.access.hasAccess(ply, access) → booleanSource ☍
-
Check if a player has the required access.
Parameters
- plyPlayerPlayer to check.
- accessstringAccess tag string to check.
Returns
- booleanIf the player has all the flags.
- Servercityrp.access.IsBlacklistedBy(player, letter, adminsteamid) → booleanSource ☍
-
Whether a given admin holds an open blacklist row on a letter.
Parameters
- playerPlayerThe player.
- letterstringSingle access tag.
- adminsteamidstringSteamID of the admin.
Returns
- boolean
- Servercityrp.access.list(player)Source ☍
-
List access tags to a player.
Parameters
- playerPlayerThe player being listed to.
- Servercityrp.access.Load(player)Source ☍
-
Load a player's access from the DB, replaying any unexpired blacklists and syncing the result to their client.
Parameters
- playerPlayerThe player to load.
- Servercityrp.access.modcangive(admin, target, access) → stringSource ☍
-
The letters of a give a moderator may lift, i.e. those they hold a blacklist row on. A lift below Moderator S2 closes only the caller's own rows, so a row another admin holds is not theirs.
Parameters
Returns
- stringThe letters of
accessthe moderator may lift, in the order asked, or "" for none.
- stringThe letters of
- Servercityrp.access.NoticeLonger(player, target, letter, existing, expire)Source ☍
-
Tell an issuer that a longer blacklist already covers a letter their new one is stacking under. Read
existingbefore the new row is written, or it contaminates the comparison.Parameters
- Servercityrp.access.playeraction(target, access, action)Source ☍
-
Perform an action on a player in response to an access change, e.g. stripping the physgun on 'p' being taken.
action: | "take" | "give"Parameters
- targetPlayerTarget player.
- accessstringAccess modified.
- action"give"|"take"The action performed.
- Servercityrp.access.RemainingText(player, expires) → stringSource ☍
-
How long a blacklist has left, worded for a notice.
Parameters
- playerPlayerThe blacklisted player, whose time played the expiry counts against.
- expiresintegerThe expiry from
GetBlacklist: 0 for permanent, otherwise a time played.
Returns
- string
"permanently", or"for <time> more".
- Servercityrp.access.selfTakeAccess(player, access, expire, reason)Source ☍
-
Take access from a player as a self-service or automated action (not staff-issued), logging it as the player acting on themselves and blacklisting re-grant until it expires.
Parameters
- playerPlayerThe player losing access.
- accessany
- expireany
- reasonany
- Servercityrp.access.SetBlacklist(player, letter, expires, adminsteamid)Source ☍
-
Record one open blacklist row. A second row by the same admin on the letter collapses to the longer.
Parameters
- playerPlayerThe player.
- letterstringSingle access tag.
- expiresstring|number
_TimePlayedthe row lifts at, 0 for permanent. A string is read as a number, as the log returns it. - adminsteamidstring|nilSteamID of the admin who issued the row.
- Servercityrp.access.takeAccess(player, access)Source ☍
-
Remove a set of access tags from a player.
Parameters
- playerPlayerThe player to remove from.
- accessstringAccess tag string to remove.
- Servercityrp.access.takeaccesscommand(player, arguments)Source ☍
-
Command callback to take access.
Parameters
- playerPlayerCalling player.
- argumentsstring[]Arguments table:
{target, access, playtime, ...reason}.
- Servercityrp.access.unblacklistcommand(player, arguments)Source ☍
-
Command callback to unblacklist a player from a team or access by name.
Parameters
- playerPlayerCalling player.
- argumentsstring[]Arguments table:
{target, team_or_access_name, ...reason}.
- Sharedcityrp.access.flagsSource ☍
-
Flag definitions. These represent roles/permissions resolved via metatable methods, rather than characters stored in an access string.
- Servercityrp.access.nlrtimersSource ☍
-
List of NLR spawning timers, keyed by SteamID, valued by the unix timestamp the ban lifts at.
- Sharedcityrp.accessSource ☍
- Sharedcityrp.access.loggerSource ☍
-
A namespaced, level-filterable logger. Obtain instances via cityrp.logging.GetLogger rather than constructing directly.
- ServertimeleftSource ☍