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.
Returns a flat snapshot table of player data. Built fresh on every call.
| Param | Type | Description |
|---|---|---|
| source | integer | The player's server ID. |
Returns nil if the player isn't loaded yet. Otherwise:
{
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",
}
local user = Core.getUser(source)
local ch = user.getUsedCharacter
-- ch.money, ch.gold, ch.rol, ch.job, ch.jobLabel, ch.jobGrade ...
local Player = RSGCore.Functions.GetPlayer(source)
local pd = Player.PlayerData
-- pd.money.cash, pd.job.name, pd.job.label, pd.job.grade.level ...
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.
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.
| Param | Type | Description |
|---|---|---|
| source | integer | The player's server ID. |
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
local ch = wc:GetCharacter(source)
Returns just the job slice of player data.
| Param | Type | Description |
|---|---|---|
| source | integer | The player's server ID. |
{
name = "marshal",
label = "Marshal",
grade = 1,
onduty = true,
}
local job = wc:GetJob(source)
if job and job.name == "bandit" then
return -- bandits don't get roadside encounters
end