Server exports
Deeds and keys
Server exports that give, move and delete the property deeds in Kartlarim, change their tax line and manage key holders.
Deeds are the property papers in Kartlarim: a house, a farm, a shop or a stable. A housing or door script gives them and asks who may open the doors. The rules for target, return values, reasons and the allow list are the same as for Documents.
Extra reasons for deeds:
| Reason | When |
|---|---|
invalid_type |
type is not a key of Config.Kartlarim.DeedTypes |
invalid_name |
name is empty |
owner |
GiveDeedKey was asked to give a key to the owner |
exists |
That character already holds a key |
max_keys |
GiveDeedKey: the deed already has Config.Kartlarim.MaxKeys key holders (8 by default) |
#AddDeed
Gives a deed to a character.
lua---@param target integer|string player server id or character id
---@param data table deed fields, see below
---@return integer|false id
---@return string parcelOrReason the parcel number, or the reason
exports['fx-pocketbook']:AddDeed(target, data)
lualocal id, parcel = exports['fx-pocketbook']:AddDeed(source, {
type = 'ev',
name = 'Blue house on Main Street',
place = 'Valentine',
coords = vector3(-250.1, 680.4, 113.3),
tax = { cents = 2400, days = 7 },
})
| Field | What it does |
|---|---|
type |
Required. A key of Config.Kartlarim.DeedTypes: ev, ciftlik, dukkan, ahir by default. |
name |
Required. Up to 80 characters. |
place |
Town or area, up to 120 characters. |
parcel |
Parcel number, up to 32 characters. Default: the type's prefix and four digits, for example EV-1016. |
size |
Size text, up to 64 characters. |
coords |
vector3 or { x, y, z }. Used by "mark on map" in Kartlarim. |
registered |
Unix time of registration. Default: now. |
ownerName |
Owner's name, up to 120 characters. Default: the online character's name. |
signer |
Name under the signature, up to 80 characters. |
role |
Signer's title, up to 64 characters. |
tax |
{ cents, dueAt, days, state }, see SetDeedTax. |
#RemoveDeed
Deletes a deed. Its keys are removed with it.
lua---@param id integer deed id
---@return boolean|false ok
---@return string? reason
exports['fx-pocketbook']:RemoveDeed(id)
luaexports['fx-pocketbook']:RemoveDeed(7)
#TransferDeed
Gives a deed to a new owner, for example after a sale.
lua---@param id integer deed id
---@param target integer|string new owner
---@param ownerName? string name on the deed; default the online character's name
---@param keepKeys? boolean false removes every key; anything else keeps them
---@return boolean|false ok
---@return string? reason
exports['fx-pocketbook']:TransferDeed(id, target, ownerName, keepKeys)
luaexports['fx-pocketbook']:TransferDeed(7, buyerSource, nil, false)
- If the new owner held a key to this deed, that key is removed (an owner needs no key).
#SetDeedTax
Changes the tax line on a deed. It is shown only. Collecting the tax is up to your script.
lua---@param id integer deed id
---@param tax table { cents, dueAt?, days?, state? }
---@return boolean|false ok
---@return string? reason
exports['fx-pocketbook']:SetDeedTax(id, tax)
luaexports['fx-pocketbook']:SetDeedTax(7, { cents = 2400, days = 7, state = 'due' })
| Field | What it does |
|---|---|
cents |
Amount in cents. |
dueAt |
Unix time it is due. |
days |
Days from now it is due, used when dueAt is not given. |
state |
'paid', 'due' or 'none'. Default: 'due' when cents is above 0, else 'none'. |
#GiveDeedKey
Gives a character a key to a deed. Use it for family, partners or staff.
lua---@param id integer deed id
---@param target integer|string key holder
---@param holderName? string name shown in the key list
---@return boolean|false ok
---@return string? reason
exports['fx-pocketbook']:GiveDeedKey(id, target, holderName)
luaexports['fx-pocketbook']:GiveDeedKey(7, 'vorp:31', 'Arthur Morgan')
- A deed has at most
Config.Kartlarim.MaxKeyskey holders (default8), the same limit the app uses. When the deed already has that many, it returnsfalse, 'max_keys'.
#TakeDeedKey
Takes a key back.
lua---@param id integer deed id
---@param target integer|string key holder
---@return boolean|false ok
---@return string? reason
exports['fx-pocketbook']:TakeDeedKey(id, target)
luaexports['fx-pocketbook']:TakeDeedKey(7, 'vorp:31')
#GetDeedAccess
Returns whether a character may open the doors of a deed. Built for door scripts.
lua---@param target integer|string
---@param id integer deed id
---@return string|false access 'owner', 'key' or false
exports['fx-pocketbook']:GetDeedAccess(target, id)
lualocal access = exports['fx-pocketbook']:GetDeedAccess(source, doorDeedId)
if access then UnlockDoor(doorId) end
#GetDeeds
Returns the deeds a character owns (up to 40). Keys held on other people's deeds are not included.
lua---@param target integer|string
---@return table|false list { { id, type, name, parcel, place }, ... }
exports['fx-pocketbook']:GetDeeds(target)
luafor _, deed in ipairs(exports['fx-pocketbook']:GetDeeds(source) or {}) do
print(deed.id, deed.name, deed.parcel)
end