All resources

rsg-housing – Developer & Server Owner Docs#

Monthly house rentals for the RSG Framework (RedM). This file documents everything: installation, configuration, the public API other scripts can use, the internal callbacks, the database, and the security model. For a player-facing overview see README.md; for what changed between versions see CHANGELOG.md.

Contents#

  1. Requirements
  2. File layout
  3. Installation and upgrading
  4. How it works
  5. Configuration reference
  6. Server API (exports)
  7. Hook events
  8. Client API
  9. Commands and permissions
  10. Internal callbacks and events
  11. Database
  12. Security model
  13. Locales
  14. NUI
  15. Troubleshooting

Requirements#

ResourceNeeded for
rsg-coreFramework, locales (@rsg-core/shared/locale.lua), notify, callbacks, commands, cron (RSGCore.Functions.CreateCron)
oxmysqlDatabase
rsg-inventoryHouse storage stashes
rsg-targetMove / remove options on placed furniture
rsg-gizmoPlacing and moving furniture
rsg-telegram (optional)Rent telegrams and the house mailbox (Config.TelegramResource)
rsg-wardrobe / rsg-character (optional)Wardrobe at the house (Config.WardrobeResource)
rsg-society (optional)Only when Config.EnableGovernor = true
rsg-log (optional)Admin and eviction logs

There is no ox_lib dependency. Everything comes from rsg-core:

FeatureUsed
Locales@rsg-core/shared/locale.lua + locale('key'), language from the rsg:locale convar
Notify (client)RSGCore.Functions.Notify({...})
Notify (server)TriggerClientEvent('RSGCore:Client:Notify', src, {...})
Callbacks (server)RSGCore.Functions.CreateCallback through the local registerCallback(name, handler) wrapper: handlers return values and the wrapper passes them to cb(...)
Callbacks (client)RSGCore.Functions.AwaitCallback(name, nil, ...) (10 s timeout, nil on timeout)
AssetsRSGCore.Functions.RequestModel / RequestAnimDict
Rent checkRSGCore.Functions.CreateCron(Config.RentCheckCronJob, job) – a standard 5-field cron expression

File layout#

FilePurpose
fxmanifest.luaManifest and dependencies
shared/config.luaAll settings, the house list (Config.Houses), door list (Config.HouseDoors), furniture list (Config.DecorProps)
server/server.luaDatabase setup, rent logic, keys, storage, doors, props, admin panel, rent check, public API
server/versionchecker.luaPrints a console notice when a newer version exists
client/client.luaBlips, door prompt and key animation, house menu prompt [J], NUI bridge, admin panel bridge, /myhouse, client API
client/props.luaFurniture streaming, spawning, move / remove targets, placement with rsg-gizmo
html/NUI (index.html, style.css, app.js)
locales/*.json11 languages: en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru
installation/rsg-housing.sqlSchema (the script also builds it automatically)

Installation and upgrading#

  1. Put rsg-housing in your resources folder and ensure rsg-housing after its dependencies.
  2. Start the server. With Config.AutoDatabase = true (default) the tables, missing columns, the widened houseid columns and the indexes are created on start. Nothing is ever dropped or rewritten.
  3. Manual install: set Config.AutoDatabase = false and import installation/rsg-housing.sql (it uses CREATE TABLE IF NOT EXISTS and INSERT IGNORE, so re-importing is safe).
  4. Set each house's rent in /houseadmin, or run UPDATE rsg_housing SET rent = 50;.

Adding a house. Add an entry to Config.Houses (and its doors to Config.HouseDoors):

{
    name       = 'House 49',
    houseid    = 'house49',            -- unique, up to 20 characters
    region     = 'newhanover',         -- gets the database row automatically (optional: rent = 50)
    menucoords = vector3(0.0, 0.0, 0.0), -- where [J] opens the panel (server checks distance to this)
    blipcoords = vector3(0.0, 0.0, 0.0),
    showblip   = true
},

Without region the console warns that the house has no row and cannot be rented until one exists.

Door ids in Config.HouseDoors are door hashes (doorid) with the position of the door (doorcoords) and the owning houseid. Vacant houses stay unlocked so players can view them.

Upgrading. Replace the folder and restart. Existing guests keep full access; new columns get safe defaults.

How it works#

  • Renting. At the house menu spot press [J]. The first month is paid up front in cash. The update is conditional (WHERE rented = 0), so two players can't rent the same house, and the money is refunded if the house was taken. Config.MaxHousesPerPlayer limits houses per character.
  • Rent cycle. Rent is due on the same calendar day each month (DATE_ADD(rent_due, INTERVAL 1 MONTH)). A tenant can pay when due within one month, never further ahead. The hourly rent check (Config.RentCheckCronJob) sends one reminder per period (Config.ReminderDays before) and evicts tenants more than Config.GracePeriodDays past due. Tenants are also reminded at login (Config.LoginRentReminder).
  • Keys and permissions. The tenant has a key (guest = 0) with every permission. Guests (guest = 1) get doors, storage, wardrobe, mailbox individually (Config.GuestDefaultPermissions at first). A key can have an expiry (Config.GuestDurations). At most Config.MaxGuests guests per house.
  • Doors. Hold [ENTER] near a door. The server checks distance (3 m), the key and the doors permission, then broadcasts the new state to everyone. Without a key, Config.AllowKnock makes the visitor knock and notifies the tenant. State lives in memory: rented houses lock on restart, vacant houses stay open.
  • Storage. An rsg-inventory stash house_<houseid> sized by the tenant's tier (Config.StorageTiers). Upgrades cost the price difference and last for the tenancy. The stash is always emptied when a tenancy ends.
  • Belongings. When a tenancy ends by eviction, by an admin without "delete storage", or by the tenant when Config.PurgeStorageOnLeave = false, the items are moved to a retrieval stash houseret_<citizenid>_<houseid>. The old tenant opens it with /housebelongings at the old house for Config.RetrievalDays days. RetrievalDays = 0 deletes storage immediately.
  • Decorating. Tenants place furniture from Config.DecorProps with rsg-gizmo. The client only sends a prop key; model and price come from the server config. Placement is checked on the server (tenant, key exists, within Config.PropPlaceRadius of the menu spot, gizmo validity, cash, Config.MaxPropsPerHouse counted inside the INSERT). Furniture is stored in rsg_housing_props, spawned locally for players within Config.PropStreamDistance, and deleted when the tenancy ends.
  • At Home. In-memory flag that changes the house blip for everyone; cleared automatically when the tenant logs off or moves Config.HomeAutoAwayDistance away.
  • Governor income. With Config.EnableGovernor, rent and storage upgrades are paid to the rsg-society job account of the house's region (Config.GovernorJobs).
  • Push-to-talk. Every open/close of a panel goes through applyNuiFocus(enable). With Config.AllowPushToTalkWhileOpen, SetNuiFocusKeepInput is on and all controls on groups 0–2 are disabled except Config.PushToTalkControls.

Configuration reference#

Single-value options in shared/config.lua (defaults are generated from the file):

OptionDefaultDescription
Debugfalseextra server console output for the rent check and admin actions
AutoDatabasetruecreate/update the tables on start; set false to import installation/rsg-housing.sql manually
MaxHousesPerPlayer1how many houses a player can rent at once
GracePeriodDays3days after the due date before the tenant is evicted
ReminderDays3send a reminder telegram this many days before rent is due
RentCheckCronJob'0 * * * *'how often to check for due / overdue rent (every hour on the hour)
MaxRent1000000highest rent an admin can set in /houseadmin
AdminPermission'admin'rsg-core permission needed for /houseadmin
InteractDistance5.0max distance (server checked) from the house menu for renting, paying and storage
MenuPromptDistance1.5how close to the house menu spot the [J] prompt appears
HouseNameMin3shortest custom house name a tenant can set
HouseNameMax30longest custom house name (max 30, the database column size)
GuestSearchMin2characters typed before the guest search runs
GuestSearchResults6max players shown in the guest search
MaxGuests8max guests (keys) a tenant can give out per house
GuestSearchScope'nearby'who the guest search finds: 'nearby' (online players close to the tenant), 'online' (any online player) or 'all' (every character, searches the whole players table)
GuestSearchDistance25.0'nearby' range in metres
GuestDurations{ 0, 24, 168 }key lengths a tenant can choose in hours (0 = until removed)
AllowKnocktruevisitors without a key knock instead of getting an error; the tenant is told if online
KnockCooldown20seconds between knocks per player
LoginRentRemindertrueremind tenants about rent that is due soon or overdue when they log in
WardrobeResource'rsg-wardrobe'
TelegramResource'rsg-telegram'
MailboxMax50telegrams shown in the house mailbox
AllowPushToTalkWhileOpentrue
HomeAutoAwayDistance75.0tenant is set to 'away' automatically past this distance from the house (0 = never)
HomeCheckInterval15seconds between automatic 'away' checks (also clears tenants who log off)
OwnedHouseBlipsfalsewhen true, only your own rented house shows a blip
PurgeStorageOnLeavetruetrue: storage is deleted when a tenant moves out. false: it is kept for Config.RetrievalDays (see below)
RetrievalDays3days an evicted / departed tenant can collect their belongings with /housebelongings at the house (0 = delete straight away)
EndTenancyRefundPercent0% of the unused rent refunded when a tenant ends the tenancy early (0 = no refund)
EnableGovernorfalsewhen true, rent and storage upgrades are paid into the region's governor society account (rsg-society). The old name Config.EnableGovenor still works
Decoratingtrue
MaxPropsPerHouse25
PropPlaceRadius40.0furniture must be within this distance of the house menu spot (server checked)
PropStreamDistance80.0furniture spawns for a player this close to the house
PropRefundPercent50% of the price refunded when a tenant removes an item

Structured options:

Config.GuestDefaultPermissions – what a new guest can use: { doors = true, storage = true, wardrobe = true, mailbox = true }.

Config.Blips – blip look per state: vacant, mine, rented, home, each { sprite = '...', colour = '...' }.

Config.StorageTiers – list of { key, slots, weight, price }. weight is in grams like rsg-inventory. Tier 1 is included with the tenancy; key also selects the locale storage_tier_<key>. rsg-inventory caps stashes at its own Config.Stash.MaxSlots / MaxWeight.

Config.GovernorJobs – region -> rsg-society job. The regions are the region values in rsg_housing.

Config.DecorProps – list of { key, label, model, price }. key is stored in the database, so don't rename it once used. Models were checked against femga/rdr3_discoveries objects/object_list.lua; add your own after checking the model name.

Config.PushToTalkControls – list of control hashes left enabled while a panel has focus (default 0x4BC9DABB).

Config.Houses / Config.HouseDoors – see Installation.

Server API (exports)#

All are server-side: exports['rsg-housing']:Name(...). They trust the calling script (the checks a player action goes through are not repeated), so only call them from server code you control. House ids that don't exist return nil / false / empty.

ExportReturnsDescription
GetHouse(houseid)house table or nilOne house, see below
GetHouses()list of house tablesEvery configured house (one query)
IsHouseRented(houseid)booleanFrom the in-memory cache, no query
GetTenant(houseid)citizenid, fullname or nilFrom the cache
GetPlayerHouses(citizenid)list of house idsHouses the character rents
GetHouseAccess(citizenid, houseid)'tenant', 'guest' or nilActive keys only (expired keys don't count)
HasHouseAccess(citizenid, houseid, perm?)booleanperm = 'doors', 'storage', 'wardrobe', 'mailbox'; without perm, any access. Tenants have every permission
GetHouseAt(coords, radius?)houseid, distance or nilClosest house menu spot within radius (default Config.InteractDistance)
GetHouseByDoor(doorid)houseid or nilDoor hash to house
GetDoorState(doorid)true locked / false unlocked / nil unknown
SetHouseDoors(houseid, locked)booleanLock or unlock every door of a house and sync to all players
GetHouseGuests(houseid)list{ citizenid, name, perms = {doors,storage,wardrobe,mailbox}, expires_text }
AddGuest(houseid, citizenid, opts?)ok, reasonopts = { hours = 0, perms = { doors = true, ... } }. Reasons: invalid_house, not_rented, invalid_player, is_tenant, exists, limit. hours is not limited to Config.GuestDurations here
RemoveGuest(houseid, citizenid)boolean
SetHouseRent(houseid, rent)boolean0 .. Config.MaxRent; applies from the next payment
EvictTenant(houseid, opts?)booleanopts = { purge = false }; sends the tenant a telegram/notification; belongings are kept for retrieval unless purge = true
OpenHouseStorage(src, houseid)booleanOpens the house stash for a player without a permission check
GetHouseProps(houseid)list{ id, key, model, coords = {x,y,z}, rot = {x,y,z} }

House table (GetHouse / GetHouses):

{
    houseid = 'house1', name = 'House 1', customName = nil, region = 'newhanover',
    rent = 50, rented = true, citizenid = 'ABC12345', tenant = 'John Marston',
    due = '18/12/2026 14:00', overdue = false, storageTier = 1, home = false,
    coords = vector3(220.0, 984.5, 190.8)   -- house menu spot
}

citizenid, tenant and due are nil for vacant houses.

Examples

local housing = exports['rsg-housing']

-- 1. Let tenants and guests with the storage permission use your own stash at a house
RSGCore.Functions.CreateCallback('myres:server:cellar', function(source, cb, houseid)
    local Player = RSGCore.Functions.GetPlayer(source)
    cb(Player and housing:HasHouseAccess(Player.PlayerData.citizenid, houseid, 'storage') or false)
end)

-- 2. Which house is the player standing at?
local houseid, dist = housing:GetHouseAt(GetEntityCoords(GetPlayerPed(src)), 10.0)

-- 3. Tax office: list overdue tenants
for _, h in ipairs(housing:GetHouses()) do
    if h.rented and h.overdue then print(('%s owes rent on %s (due %s)'):format(h.tenant, h.name, h.due)) end
end

-- 4. Lawman raid: unlock every door of the house and open its storage
housing:SetHouseDoors(houseid, false)
housing:OpenHouseStorage(src, houseid)   -- you decide who may call this

-- 5. Quest reward: give a character a 24 hour key without storage access
local ok, reason = housing:AddGuest(houseid, citizenid, { hours = 24, perms = { storage = false } })
if not ok then print('could not add guest: ' .. reason) end

-- 6. Evict a wanted tenant and delete their belongings
housing:EvictTenant(houseid, { purge = true })

-- 7. All houses a character rents
for _, id in ipairs(housing:GetPlayerHouses(citizenid)) do print(id) end

Hook events#

Server-side events fired by rsg-housing. They are plain TriggerEvents (not net events), so clients can't fire or spoof them. Listen with AddEventHandler.

EventArgumentsFired when
rsg-housing:server:houseRentedhouseid, citizenid, rentA tenant rents a house (after the cache and doors are updated)
rsg-housing:server:rentPaidhouseid, citizenid, rentA tenant pays a month
rsg-housing:server:tenancyEndedhouseid, citizenid, reasonAny tenancy ends. reason = 'left' (tenant), 'evicted' (unpaid rent), 'admin' (/houseadmin), 'api' (EvictTenant)
rsg-housing:server:guestAddedhouseid, citizenid, hoursA key is given (hours = 0 means until removed)
rsg-housing:server:guestRemovedhouseid, citizenidA guest key is removed by hand (expired keys are cleaned silently)
AddEventHandler('rsg-housing:server:tenancyEnded', function(houseid, citizenid, reason)
    if reason == 'evicted' then
        print(('%s was evicted from %s'):format(citizenid, houseid))
        -- e.g. remove a stash your own script created for that house
    end
end)

AddEventHandler('rsg-housing:server:houseRented', function(houseid, citizenid, rent)
    -- e.g. give a welcome item with rsg-inventory
end)

Client API#

exports['rsg-housing']:Name(...) on the client.

ExportReturnsDescription
IsHouseRented(houseid)booleanAnyone rents it
IsMyHouse(houseid)booleanThe local player rents it
GetMyHouses()list of house ids
GetHouseName(houseid)string or nilThe tenant's custom name, otherwise the config name
GetNearestHouse(coords?, maxDist?)houseid, distance or nilDefaults: the player's position, 50.0
OpenHouseMenu(houseid)booleanOpens the panel as if [J] was pressed (the server still checks distance on every action)
IsHouseMenuOpen()booleanA house or admin panel has focus

Local client event: rsg-housing:client:housesUpdated (myHouses) fires whenever the set of houses changes (myHouses = { [houseid] = true }).

-- radial menu / command: open the panel of the nearest house
RegisterCommand('housemenu', function()
    local houseid = exports['rsg-housing']:GetNearestHouse(nil, 3.0)
    if houseid then exports['rsg-housing']:OpenHouseMenu(houseid) end
end)

-- react when the player rents or loses a house
AddEventHandler('rsg-housing:client:housesUpdated', function(myHouses)
    for houseid in pairs(myHouses) do print('I rent', houseid) end
end)

Commands and permissions#

CommandWhoDescription
/houseadminConfig.AdminPermission (rsg-core permission, default admin)Admin panel: every house, rent, due date, storage tier, doors, evict, teleport, open storage, rename reset, guests. Every admin action is re-checked on the server and logged to rsg-log (rsghousing)
/myhouseeveryoneGPS route to the house you rent; run again to clear
/housebelongingsformer tenantsOpen the belongings kept after a tenancy ended (stand within Config.InteractDistance + 10 of the old house)

Admin panel actions (server callback rsg-housing:server:admin): list, house, setRent, shiftDue, setDue, setStorage, resetName, removeGuest, doors, evict, teleport, storage.

Internal callbacks and events#

These are the plumbing between the NUI, client and server. They are not a stable API (use the exports above), but are listed for debugging and auditing. Every one validates its arguments on the server.

Server callbacks (all prefixed rsg-housing:server:): getState(), getHouseStatus(houseid), rentHouse(houseid), payRent(houseid), setHome(houseid, on), upgradeStorage(houseid, level), renameHouse(houseid, name), endTenancy(houseid), addGuest(houseid, citizenid, hours), setGuestPermission(houseid, citizenid, perm, allowed), searchPlayers(houseid, query), removeGuest(houseid, citizenid), outfits(houseid, action, id), mailbox(houseid, action, id), toggleDoor(doorid), getProps(houseid), prePlaceProp(houseid, key), placeProp(houseid, key, coords, rot), moveProp(houseid, id, coords, rot), removeProp(houseid, id), admin(action, houseid, data).

Server net events: rsg-housing:server:openStorage (houseid), rsg-housing:server:loginCheck () (rate limited; sends the login rent reminder).

Client events (server to client): SyncOwnedHouses (owned, mine), SyncDoors (states), SetDoorState (doorid, state), openAdmin, propAdded, propMoved, propRemoved, propsCleared (all rsg-housing:client:).

All state-changing callbacks return { ok, msg, type }, which the NUI shows as a toast.

Database#

TablePurpose
rsg_housingOne row per house: region, houseid (unique), tenant citizenid / fullname, rented, rent, rent_due, reminder_sent, custom_name, storage_tier
rsg_housekeysKeys: the tenant (guest = 0) and guests (guest = 1) with perm_doors, perm_storage, perm_wardrobe, perm_mailbox, optional expires
rsg_housing_propsPlaced furniture: houseid, model_key, position (x,y,z) and rotation (rx,ry,rz)
rsg_housing_retrievalBelongings waiting for an old tenant: houseid, citizenid, expires (unique per house and character)

Stashes live in rsg-inventory's inventories table: house_<houseid> and houseret_<citizenid>_<houseid>. The mailbox reads rsg_telegrams (rsg-telegram); the wardrobe reads playeroutfit (rsg-character). houseid columns are varchar(20).

Security model#

  • Nothing is trusted from the client. Prices, rent, storage sizes, furniture models and prices come from the database/config. Clients send ids, never amounts.
  • Every action checks: the player exists, the key / tenancy (and the guest permission for that feature), distance to the house menu spot or door, and a per-player cooldown. Admin actions re-check the rsg-core permission on every call.
  • Money is removed before goods are granted and refunded if the conditional database update loses a race (renting, paying, upgrading, placing furniture).
  • Limits are enforced in the database statement where it matters (one tenant per house; furniture count inside the INSERT) and by Config.MaxGuests, Config.MaxPropsPerHouse, Config.MaxHousesPerPlayer.
  • Privacy. The guest search only returns logged-in players near the tenant by default (Config.GuestSearchScope); 'all' scans every character.
  • NUI. Every player-controlled string (house names, character names, telegram text) is HTML-escaped before it is rendered.
  • API. Exports are server-side and trust the caller. Hook events are server-only TriggerEvents, so clients can't spoof them.
  • For other scripts: a script that lets players act on a house must check HasHouseAccess (and distance) itself on the server. OpenHouseStorage and SetHouseDoors do not.

Locales#

All text comes from locales/<lang>.json (en, de, el, es, fr, ja, nl, pl, pt-br, ro, ru; the same keys in every file). The language follows rsg-core: setr rsg:locale de. To add a language copy en.json, translate the values, keep every %s / %d in the same order and keep **bold** markers and ~e~ / ~t6~ / ~q~ colour codes. NUI strings are listed in UI_STRINGS / ADMIN_STRINGS in client/client.lua and sent to the NUI when it opens; a new NUI string needs adding to that list too.

NUI#

html/index.html + style.css + app.js: the leather-and-gold house panel (rent card, guests with permission chips and key length, storage tiers, decorating list, wardrobe, mailbox) and the admin panel. The panel is draggable (position is remembered; double-click the header to reset). No native <select> or <datalist> is used. NUI callbacks are close, action, searchPlayers, outfits, mailbox, admin, adminClose; each is re-validated by the server callback behind it.

Troubleshooting#

ProblemFix
"Table doesn't exist" on startCheck oxmysql starts before rsg-housing and the database user can CREATE and ALTER; or set Config.AutoDatabase = false and import the SQL
Console: "has no row in rsg_housing"Add region = '...' to the house in Config.Houses, or insert the row
Can't rent a houseThe house has no row (see above), it's already rented, the player is farther than Config.InteractDistance from menucoords, or MaxHousesPerPlayer is reached
Panel blocks push-to-talkConfig.AllowPushToTalkWhileOpen = true and the control in Config.PushToTalkControls
Furniture doesn't appearrsg-gizmo / rsg-target must be started; the model must exist; the player must be within Config.PropStreamDistance
Mailbox / wardrobe unavailablersg-telegram / rsg-wardrobe isn't started or Config.TelegramResource / Config.WardrobeResource don't match the folder names
/houseadmin does nothingThe player needs Config.AdminPermission in rsg-core
/myhouse shows no routeThe GPS route uses StartGpsMultiRoute; check the client console for native errors
Items missing after an evictionThey were moved to the retrieval stash: the old tenant uses /housebelongings at the house within Config.RetrievalDays

Not included#

Per-house upgrades such as a bath or stable need interior coordinates per MLO. Tenancy transfer between players needs a consent flow for the receiving player.

rsg-economy integration#

Config.Economy = { Enabled, ReplaceGovernor }. payGovernor(region, amount, houseid, reason) first calls payTreasury, which finds the town with GetRegionAt(house menucoords) and calls DepositTreasury(region, amount, reason, 'rsg-housing'). When that succeeds and ReplaceGovernor is true it stops; otherwise the existing governor payout (Config.EnableGovernor, Config.GovernorJobs) runs as before. Called for new rentals, monthly rent payments and storage upgrades. Refunds do not take money back out of the treasury. Skipped when rsg-economy is not started or the house is outside every town's region radius.

Support: https://rexshack.tebex.store

<!-- BEGIN AUTO-REFERENCE (generated from the code; re-run the generator instead of editing by hand) -->

Technical reference#

Generated from the source of rsg-housing 3.3.0. Names, arguments and defaults below are read straight from the code.

Dependencies#

rsg-core, oxmysql, rsg-inventory, rsg-target, rsg-gizmo

Database#

Tables: rsg_housing, rsg_housekeys, rsg_housing_props, rsg_housing_retrieval.

Tables are created automatically on start while Config.AutoDatabase = true (default). Nothing is ever dropped or overwritten. Column changes (new columns, widening houseid to varchar(20)) only run when the column is missing or too short, so a normal restart runs no ALTER TABLE. For a manual install set Config.AutoDatabase = false and import installation/rsg-housing.sql once.

-- shared/config.lua
Config.AutoDatabase = true -- false = import the SQL file yourself

Configuration#

OptionDefaultNotes
Config.Debugfalse
Config.AutoDatabasetruecreate/update the tables on start; set false to import installation/rsg-housing.sql manually
Config.MaxHousesPerPlayer1how many houses a player can rent at once
Config.GracePeriodDays3days after the due date before the tenant is evicted
Config.ReminderDays3send a reminder telegram this many days before rent is due
Config.RentCheckCronJob'0 * * * *'how often to check for due / overdue rent (every hour on the hour)
Config.MaxRent1000000highest rent an admin can set in /houseadmin
Config.AdminPermission'admin'rsg-core permission needed for /houseadmin
Config.InteractDistance5.0max distance (server checked) from the house menu for renting, paying and storage
Config.MenuPromptDistance1.5how close to the house menu spot the [J] prompt appears
Config.HouseNameMin3shortest custom house name a tenant can set
Config.HouseNameMax30longest custom house name (max 30, the database column size)
Config.GuestSearchMin2characters typed before the guest search runs
Config.GuestSearchResults6max players shown in the guest search
Config.MaxGuests8max guests (keys) a tenant can give out per house
Config.GuestSearchScope'nearby'who the guest search finds: 'nearby' (online players close to the tenant), 'online' (any online player) or 'al
Config.GuestSearchDistance25.0'nearby' range in metres
Config.GuestDurations{ 0, 24, 168 }key lengths a tenant can choose in hours (0 = until removed)
Config.AllowKnocktruevisitors without a key knock instead of getting an error; the tenant is told if online
Config.KnockCooldown20seconds between knocks per player
Config.LoginRentRemindertrueremind tenants about rent that is due soon or overdue when they log in
Config.GuestDefaultPermissionstablewhat a newly added guest can use (the tenant can change each guest from the guest list)
Config.WardrobeResource'rsg-wardrobe'
Config.TelegramResource'rsg-telegram'
Config.MailboxMax50telegrams shown in the house mailbox
Config.AllowPushToTalkWhileOpentrueWhile the NUI has focus, game controls are blocked but push-to-talk keeps working.
Config.PushToTalkControlstable
Config.HomeAutoAwayDistance75.0tenant is set to 'away' automatically past this distance from the house (0 = never)
Config.HomeCheckInterval15seconds between automatic 'away' checks (also clears tenants who log off)
Config.Blipstableblip look per house state (sprite + colour modifier)
Config.StorageTierstable
Config.OwnedHouseBlipsfalsewhen true, only your own rented house shows a blip
Config.PurgeStorageOnLeavetruetrue: storage is deleted when a tenant moves out. false: it is kept for Config.RetrievalDays (see below)
Config.RetrievalDays3days an evicted / departed tenant can collect their belongings with /housebelongings at the house (0 = delete
Config.EndTenancyRefundPercent0% of the unused rent refunded when a tenant ends the tenancy early (0 = no refund)
Config.EnableGovernorfalsewhen true, rent and storage upgrades are paid into the region's governor society account (rsg-society). The old
Config.GovernorJobstableregion (rsg_housing.region) -> rsg-society job account that receives the money
Config.Decoratingtrue
Config.MaxPropsPerHouse25
Config.PropPlaceRadius40.0furniture must be within this distance of the house menu spot (server checked)
Config.PropStreamDistance80.0furniture spawns for a player this close to the house
Config.PropRefundPercent50% of the price refunded when a tenant removes an item
Config.DecorPropstablemodels checked against femga/rdr3_discoveries objects/object_list.lua
Config.Housestablehouse config
Config.HouseDoorstabledoor config
Config.EconomytableRent and storage upgrade payments are deposited into the treasury of the town nearest to the house.
Config.Enabledtrue
Config.ReplaceGovernorfalse

Exports#

Server

ExportArgumentsFile
GetHousehouseidserver/server.lua
GetHouses``server/server.lua
IsHouseRentedhouseidserver/server.lua
GetTenanthouseidserver/server.lua
GetPlayerHousescitizenidserver/server.lua
GetHouseAccesscitizenid, houseidserver/server.lua
HasHouseAccesscitizenid, houseid, permserver/server.lua
GetHouseAtcoords, radiusserver/server.lua
GetHouseByDoordooridserver/server.lua
GetDoorStatedooridserver/server.lua
SetHouseDoorshouseid, lockedserver/server.lua
GetHouseGuestshouseidserver/server.lua
AddGuesthouseid, citizenid, optsserver/server.lua
RemoveGuesthouseid, citizenidserver/server.lua
SetHouseRenthouseid, rentserver/server.lua
EvictTenanthouseid, optsserver/server.lua
OpenHouseStoragesrc, houseidserver/server.lua
GetHousePropshouseidserver/server.lua

Client

ExportArgumentsFile
IsHouseRentedhouseidclient/client.lua
IsMyHousehouseidclient/client.lua
GetMyHouses``client/client.lua
GetHouseNamehouseidclient/client.lua
GetNearestHousecoords, maxDistclient/client.lua
OpenHouseMenuhouseidclient/client.lua
IsHouseMenuOpen``client/client.lua
-- example
local result = exports['rsg-housing']:GetHouse(houseid)

Callbacks#

CallbackSideArgumentsFile
rsg-housing:server:getStateserversourceserver/server.lua
rsg-housing:server:getHouseStatusserversource, houseidserver/server.lua
rsg-housing:server:rentHouseserversrc, houseidserver/server.lua
rsg-housing:server:payRentserversrc, houseidserver/server.lua
rsg-housing:server:setHomeserversrc, houseid, onserver/server.lua
rsg-housing:server:upgradeStorageserversrc, houseid, levelserver/server.lua
rsg-housing:server:renameHouseserversrc, houseid, valueserver/server.lua
rsg-housing:server:endTenancyserversrc, houseidserver/server.lua
rsg-housing:server:addGuestserversrc, houseid, targetCid, hoursserver/server.lua
rsg-housing:server:setGuestPermissionserversrc, houseid, targetCid, perm, allowedserver/server.lua
rsg-housing:server:searchPlayersserversrc, houseid, queryserver/server.lua
rsg-housing:server:removeGuestserversrc, houseid, targetCidserver/server.lua
rsg-housing:server:outfitsserversrc, houseid, action, idserver/server.lua
rsg-housing:server:mailboxserversrc, houseid, action, idserver/server.lua
rsg-housing:server:toggleDoorserversource, dooridserver/server.lua
rsg-housing:server:getPropsserversrc, houseidserver/server.lua
rsg-housing:server:prePlacePropserversrc, houseid, keyserver/server.lua
rsg-housing:server:placePropserversrc, houseid, key, coords, rotserver/server.lua
rsg-housing:server:movePropserversrc, houseid, id, coords, rotserver/server.lua
rsg-housing:server:removePropserversrc, houseid, idserver/server.lua
rsg-housing:server:adminserversrc, action, houseid, dataserver/server.lua
-- client side
RSGCore.Functions.TriggerCallback('rsg-housing:server:getState', function(result)
    -- use result
end)

Events#

Server events can be fired by any client, so every handler re-validates the player, the arguments and any permission, distance or cooldown on the server. Never add a reward to a handler without those checks.

EventSideArgumentsFile
RSGCore:Client:OnPlayerLoadedclient``client/client.lua
rsg-housing:client:SyncOwnedHousesclientowned, mineclient/client.lua
rsg-housing:client:SyncDoorsclientdoorsclient/client.lua
rsg-housing:client:SetDoorStateclientdoorid, stateclient/client.lua
rsg-housing:client:openAdminclient``client/client.lua
RSGCore:Client:OnPlayerUnloadclient``client/client.lua
rsg-housing:client:propAddedclienthouseid, propclient/props.lua
rsg-housing:client:propMovedclienthouseid, id, coords, rotclient/props.lua
rsg-housing:client:propRemovedclienthouseid, idclient/props.lua
rsg-housing:client:propsClearedclienthouseidclient/props.lua
rsg-housing:client:placePropclienthouseid, keyclient/props.lua
rsg-housing:server:openStorageserverhouseidserver/server.lua
rsg-housing:server:loginCheckserver``server/server.lua
-- from a client script
TriggerServerEvent('rsg-housing:server:openStorage', houseid)
-- from a server script
TriggerClientEvent('RSGCore:Client:OnPlayerLoaded', source)

Commands#

CommandNotesFile
/myhouseclient/client.lua
/housebelongingslocale('retrieval_help')server/server.lua
/houseadminlocale('admin_command_help')server/server.lua

Locales#

Language files in locales/: de, el, en, es, fr, ja, nl, pl, pt-br, ro, ru. Set the language with setr rsg:locale "en".

<!-- END AUTO-REFERENCE -->