The xPlayer object
Methods work with . and with :. Those that change something return true, or false and the reason.
Fields
| Field | |
|---|---|
source, charId, citizenid, identifier | Fixed. citizenid (8 characters) is the id to use in your tables. |
job, gang | Read live: .name, .label, .grade, .grade_name, .grade_label, .grade_salary, .isBoss, .onDuty. |
accounts, inventory, metadata, loadout, licenses, statuses, vars | Read live (copies). |
name, firstname, lastname, dob, sex, height | Identity. |
coords, group, maxWeight | Position {x,y,z,heading}, LS:MP group, max weight. |
Methods
| Identity | |
|---|---|
getName(), getFirstName(), getLastName(), setName(firstname, lastname) | |
getIdentifier(), getCitizenId(), getCharId(), getLsmpId(), getLicense() | getLicense() = "lsmp:<id>". |
getDob(), getSex(), getHeight(), isGuest() |
| Money | |
|---|---|
getMoney(), addMoney(n, reason), removeMoney(n, reason), setMoney(n, reason) | money account (cash). |
getAccounts(), getAccount(name), getAccountMoney(name) | |
addAccountMoney(name, n, reason), removeAccountMoney(…), setAccountMoney(…) | Integers ≥ 0; remove fails if the balance is not enough. |
| Job, gang | |
|---|---|
getJob(), setJob(name, grade), isOnDuty(), setDuty(bool) | |
getGang(), setGang(name, grade) |
| Inventory | |
|---|---|
getInventory(), getItem(name) · getInventoryItem(name), getItemCount(name), getItemBySlot(slot) | |
hasItem(name, n), hasItem({ "a", "b" }), canCarryItem(name, n) | |
addItem(name, n, metadata), removeItem(name, n), removeItem(name, n, metadata), removeItem(name, n, slot) | |
setItemMetadata(slot, md), clearInventory(), getWeight(), getMaxWeight(), setMaxWeight(g) | Weight in grams. |
| Statuses, licenses, weapons, vehicles | |
|---|---|
getStatus(name), getStatuses(), setStatus(name, v), addStatus(name, n), removeStatus(name, n) | |
getLicenses(), hasLicense(name), addLicense(name), removeLicense(name) | |
getLoadout(), hasWeapon(weapon), getWeaponAmmo(weapon), addWeapon(weapon, ammo), removeWeapon(weapon), setWeaponAmmo(…), addWeaponAmmo(…), removeAllWeapons() | "pistol" = "WEAPON_PISTOL". |
getVehicles() | Their vehicles (waits for the database). |
| Free data | |
|---|---|
getMeta(key), setMeta(key, value) (aliases getMetaData, setMetaData) | Saved. |
set(key, value), get(key) | Session: lost on disconnection. |
getSkin(), setSkin(table) | For an appearance resource. |
| Misc | |
|---|---|
getCoords(), setCoords(x, y, z, heading), isDead() | |
showNotification(text, kind, ms) · notify, triggerEvent(name, ...), kick(reason) | |
getGroup(), hasPermission(permission) | |
callOriginal(method, ...) | The framework version of a replaced method. |