CityRP Documentation Repository

core.plugins.billboards.sh.zad_utility

Zeros AdvertKit Utility Functions. Shared utility functions for the billboard addon.

Functions

zad.f.FunctionValidater(func) → booleanSource ☍

Check if a value is a valid function.

Parameters

  • funcanyThe value to check.

Returns

  1. booleanif the value is a function, false otherwise.
zad.f.GetOwner(ent) → boolean|PlayerSource ☍

Get the owner of an entity. Checks CityRP2's _Owner field first, then falls back to zad_Owner NWString.

Parameters

  • entEntityThe entity to get the owner of.

Returns

  1. boolean|Playerowner player, or false if no valid owner.
zad.f.GetPlayerRank(ply) → stringSource ☍

Get a player's server rank.

Parameters

  • plyPlayerThe player to get the rank of.

Returns

  1. stringplayer's server rank.
zad.f.HasValidCharacter(aString) → booleanSource ☍

Check if a string contains only valid alphanumeric characters. Strips spaces and checks for non-word characters.

Parameters

  • aStringstringThe string to validate.

Returns

  1. booleanif string contains only valid characters, false otherwise.
zad.f.InDistance(pos01, pos02, dist) → booleanSource ☍

Check if two positions are within a specified distance of each other. Uses squared distance for performance optimization.

Parameters

  • pos01VectorThe first position.
  • pos02VectorThe second position.
  • distnumberThe maximum distance to check.

Returns

  1. booleanif positions are within distance, false otherwise.
zad.f.IsAdmin(ply) → booleanSource ☍

Check if a player has admin permissions for the addon. Checks the player's rank against zad.config.AdminRanks.

Parameters

  • plyPlayerThe player to check.

Returns

  1. booleanif player is an admin, false otherwise.
zad.f.IsOwner(ply, ent) → booleanSource ☍

Check if a player owns an entity. Checks CityRP2's _Owner field first, then falls back to zad_Owner NWString.

Parameters

  • plyPlayerThe player to check ownership for.
  • entEntityThe entity to check ownership of.

Returns

  1. booleanif player owns the entity or entity is world-owned, false otherwise.
zad.f.Notify(ply, msg, ntfType)Source ☍

Send a notification message to a player. Uses CityRP2's notification system if available, otherwise falls back to ChatPrint.

Parameters

  • plyPlayerThe player to notify.
  • msgstringThe message to send.
  • ntfTypenumberThe notification type (0 = generic, 1 = error, 2 = hint, 3 = undo).
zad.f.SetOwner(ent, ply)Source ☍

Set the owner of an entity. Sets ownership via CPPI, NWString, and CityRP2's _Owner field for compatibility.

Parameters

  • entEntityThe entity to set ownership on.
  • plyPlayer|nilThe player to set as owner, or nil/invalid for world ownership.
zad.f.SetOwnerByID(ent, id)Source ☍

Set the owner of an entity by SteamID.

Parameters

  • entEntityThe entity to set ownership on.
  • idstringThe SteamID to set as owner.
zad.f.Timer_Create(timerid, time, rep, func)Source ☍

Create a tracked timer. Creates a timer and adds it to the internal timer list for tracking.

Parameters

  • timeridstringThe unique identifier for the timer.
  • timenumberThe interval in seconds.
  • repnumberThe number of repetitions (0 for infinite).
  • funcfunctionThe function to call when the timer fires.
zad.f.Timer_PrintAll()Source ☍

Print all active addon timers to console. Debug function for administrators.

zad.f.Timer_Remove(timerid)Source ☍

Remove a tracked timer. Removes the timer and removes it from the internal timer list.

Parameters

  • timeridstringThe unique identifier of the timer to remove.

Tables

zad_TimerListSource ☍