sellProperty
Description
Triggered when a player attempts to sell a property to the default buyer.
Payload Structure
lua{ source = playerId, -- The player's server ID player = playerData, -- Player data object from framework propertyId = propertyId, -- Property identifier sellPrice = sellPrice, -- Calculated sale price ownerType = ownerType, -- Current owner type (e.g., 'user', 'society') ownerIdentifier = ownerId -- Current owner identifier }
Parameters
- source (number): The server ID of the player attempting the sale
- player (table): Complete player data object provided by the framework (ESX/QBCore)
- propertyId (string/number): Unique identifier for the property being sold
- sellPrice (number): Price that will be paid for the property
- ownerType (string): Current owner type (e.g.,
user,society) - ownerIdentifier (string): Identifier of the current owner
Usage Example
luaexports.nolag_properties:registerHook('sellProperty', function(data) print(('Player %s is selling property %s for %s'):format( data.source, data.propertyId, data.sellPrice )) -- Custom validation logic if not canPlayerSellProperty(data.source, data.propertyId) then return false -- Cancel the sale end -- Optional logging logPropertyTransaction('sell', data) return true -- Allow the sale to proceed end)
Return Values
- true or nil: Allow the property sale to continue
- false: Cancel the property sale and prevent the transaction