🤠 Wild Country Libs
Server API

Player & Character

Read player data without caring whether it lives on a VORP character object or an RSG PlayerData table. Always call these fresh — never cache the result across a Wait() or a new thread.

GetPlayer(source)server

Returns a flat snapshot table of player data. Built fresh on every call.

ParamTypeDescription
sourceintegerThe player's server ID.

Returns nil if the player isn't loaded yet. Otherwise:

return shape
{
  source    = 1,
  charid    = "ABC123",
  firstname = "John",
  lastname  = "Marston",
  job = {
    name   = "marshal",
    label  = "Marshal",
    grade  = 1,
    onduty = true, -- nil on VORP, see note below
  },
  money  = 250.0,
  gold   = 0,   -- always nil on RSG
  rol    = 0,   -- always nil on RSG
  xp     = 1200, -- always nil on RSG
  age    = 34,
  gender = "male",
  group  = "user",
}
underneath, on —
vorp_core
local user = Core.getUser(source)
local ch = user.getUsedCharacter
-- ch.money, ch.gold, ch.rol, ch.job, ch.jobLabel, ch.jobGrade ...
rsg-core
local Player = RSGCore.Functions.GetPlayer(source)
local pd = Player.PlayerData
-- pd.money.cash, pd.job.name, pd.job.label, pd.job.grade.level ...
onduty is currently VORP-incomplete. VORP doesn't expose duty status on the character object in the docs this lib was built against, so job.onduty is always nil on VORP. It works correctly on RSG. If your VORP server tracks duty separately, wire it in via _custom/server.lua.
GetCharacter(source)server

Returns the raw underlying character/player object for whichever framework is active — VORP's character, RSG's Player.

Use this when you need to call a framework-native method that GetPlayer()'s flat table doesn't expose — for example VORP's character.setSkills(...). This is the exact object server.lua and webhook.lua in wc_encounter used to resolve by hand, twice, with duplicated logic. wc_libs does it once.

ParamTypeDescription
sourceintegerThe player's server ID.
before — duplicated in two files
local function getCharacter(src)
  local user = VorpCore.getUser(src)
  if not user then return nil end
  local c = user.getUsedCharacter
  if type(c) == "function" then c = c(user) end
  return c
end
after
local ch = wc:GetCharacter(source)
GetJob(source)server

Returns just the job slice of player data.

ParamTypeDescription
sourceintegerThe player's server ID.
return shape
{
  name   = "marshal",
  label  = "Marshal",
  grade  = 1,
  onduty = true,
}
example — job-gated logic
local job = wc:GetJob(source)
if job and job.name == "bandit" then
  return -- bandits don't get roadside encounters
end