Kartik Scripts

Events

Events other resources can listen to (hooks) or trigger (to drive kartik-properties UI and flows). Everything the tablet does internally goes through permission-checked callbacks; the events below are the ones meant for integration.

Local events are fired with TriggerEvent and only reach the same side (client→client, server→server). Listen with AddEventHandler. Net events are registered with RegisterNetEvent and can be sent from the server with TriggerClientEvent, or fired locally on the client with TriggerEvent.


🟦 Client: listen

client:enteredProperty

AddEventHandler('kartik-properties:client:enteredProperty', function(propertyId) end)

Fired after the local player finishes entering a property. Covers instanced shells, IPL interiors and walk-in yard zones.

ArgTypeDescription
propertyIdnumberThe property entered.

client:leftProperty

AddEventHandler('kartik-properties:client:leftProperty', function(propertyId) end)

Fired when the local player leaves a property's interior or walk-in zone, whether by exiting, being kicked, or the session ending.

ArgTypeDescription
propertyIdnumberThe property left.

Example: HUD / weather sync

AddEventHandler('kartik-properties:client:enteredProperty', function(id)
    exports['my-hud']:SetLocation(('Property #%d'):format(id))
    TriggerEvent('qb-weathersync:client:DisableSync')
end)

AddEventHandler('kartik-properties:client:leftProperty', function()
    exports['my-hud']:ClearLocation()
    TriggerEvent('qb-weathersync:client:EnableSync')
end)

🟦 Client: trigger

client:openApp

TriggerClientEvent('kartik-properties:client:openApp', source, route, tabletType, extra)

Opens the property tablet on a given screen.

ArgTypeRequiredDescription
routestring⬜Screen to open (default 'home'). See the table below.
tabletTypestring⬜'user' (default) or 'admin'. The admin tablet refuses players without state/approver/admin rights.
extratable⬜Extra fields merged into the screen's payload.

Common routes:

RouteScreen
home / dashboardTablet home
my-propertiesPlayer's properties
listingsProperties for sale / rent
leaseMy leases
contractsContracts
transactionsMy transactions
financingMy mortgages
designsLayout marketplace
redemptionsTebex redemptions inbox
settingsTablet settings
marketLand market (Block mode)
company, company-licence, company-ledger, company-customers, …Company hub (Block mode)
portfolio, portfolio-properties, portfolio-startersCompany portfolio (Block mode)
jobhub, jobhub-properties, jobhub-sales, jobhub-starters, …Realtor Job Hub (Classic mode)
starterSelectStarter apartment picker
admin (with tabletType = 'admin')Admin registry
-- phone app button → open the listings screen
TriggerEvent('kartik-properties:client:openApp', 'listings')

Screens the player's role can't see are still hidden; every action is re-checked on the server.

client:openManager

TriggerClientEvent('kartik-properties:client:openManager', source, propertyId, isController)

Opens a single property's management record, the same screen as Manage Property at the door. The screen only shows what the player is to that property (owner, tenant or keyholder).

ArgTypeRequiredDescription
propertyIdnumber✅Property to open.
isControllerboolean⬜true when opened from the in-house controller.

client:useLockpick

TriggerClientEvent('kartik-properties:client:useLockpick', source)

Starts a lockpick attempt on the nearest locked property door (skill check, then the server resolves it and may trip the alarm). Use it when your inventory handles the lockpick item itself.

client:forceExitProperty

TriggerClientEvent('kartik-properties:client:forceExitProperty', source, propertyId)

Makes the player leave propertyId if they are inside it (shell, IPL or walk-in). Does nothing otherwise.

client:highlightPropertyZone

TriggerClientEvent('kartik-properties:client:highlightPropertyZone', source, propertyId)

Draws the property's yard-zone polygon for about 10 seconds. The player gets an error notification if the property has no yard zone.

client:notify

TriggerClientEvent('kartik-properties:client:notify', source, message, msgType)

Shows a notification in the tablet's style. msgType is 'success', 'error' or 'inform'.

client:spawnInStarter / client:starterUnavailable

TriggerClientEvent('kartik-properties:client:spawnInStarter', source, propertyId, entranceCoords)
TriggerClientEvent('kartik-properties:client:starterUnavailable', source)

The end of the new-character flow. spawnInStarter ends the tutorial session, enters the starter unit, fires the framework's OnPlayerLoaded, and opens the clothing menu when Config.Clothing.OpenOnStarterSpawn is on. starterUnavailable does the same without entering a unit, for when no starter stock is left.

Both handlers are in the editable file client/open/starter.lua. Change them if your multicharacter needs a different spawn sequence. See AssignStarterApartment.


🟥 Server: listen

server:dispatchAlert

AddEventHandler('kartik-properties:server:dispatchAlert', function(propertyId, coords, isMonitored, reason) end)

Fired whenever a forced-entry signal reaches a property with power on. This is the hook for your police dispatch.

ArgTypeDescription
propertyIdnumberThe property.
coordstableEntrance coordinates (x, y, z).
isMonitoredbooleantrue when the alarm tier is at or above Config.Security.MonitoredTier, meaning police should be alerted. false means a local ring only.
reasonstring'lockpick', 'raid' or 'motion'.

A ready-to-edit handler ships in bridge/dispatch/server/server.lua (with a commented ps-dispatch example). Signals are suppressed while the property's breaker is tripped (see Security Subsystem).

AddEventHandler('kartik-properties:server:dispatchAlert', function(propertyId, coords, isMonitored, reason)
    if not isMonitored then return end
    exports['ps-dispatch']:CustomAlert({
        coords = vector3(coords.x, coords.y, coords.z),
        message = ('Property alarm (%s)'):format(reason),
        dispatchCode = '10-33',
    })
end)

server:evicted

AddEventHandler('kartik-properties:server:evicted', function(leaseId, tenantCid) end)

Fired after a tenant is evicted, either for unpaid rent in the billing sweep or by the landlord. By this point the tenant's keys are revoked and their stashes are impounded.

ArgTypeDescription
leaseIdnumberThe lease that ended.
tenantCidstringCitizen id of the tenant.

server:blockSold

AddEventHandler('kartik-properties:server:blockSold', function(blockId, buyerCompanyId, price) end)

Block mode only. Fired when a land block changes hands on the market.

ArgTypeDescription
blockIdnumberThe block sold.
buyerCompanyIdnumberThe buying company.
pricenumberSale price.

server:playerUnloaded

AddEventHandler('kartik-properties:server:playerUnloaded', function(src) end)

Fired by the framework bridge when a character logs out (QBCore, Qbox or ESX), so you can clean up per-player state without depending on a specific framework's event.


  • Exports
  • Inventory item hook kartik-properties.useItem (alias usePropertyKey): see Items

On this page