Register veto
Use this export to validate or block actions.
Export
exports['qs-housing']:RegisterHouseTransactionVeto('my_script', function(ctx)
-- Block action
return false, 'You cannot do this.'
-- Allow action
return true
end)
Remove veto
exports['qs-housing']:UnregisterHouseTransactionVeto('my_script')
Available actions
| Action | Description |
|---|---|
sell_bank | Sell house to bank |
list_player_sale | Put house for sale |
buy_from_player | Buy a house from another player |
transfer | Transfer house for free |
ctx data
| Field | Description |
|---|---|
ctx.action | Current action |
ctx.house | House name/key |
Extra data depends on the action.
Examples:
ctx.price
ctx.buyerSource
ctx.toIdentifier
Example
exports['qs-housing']:RegisterHouseTransactionVeto('house_rules', function(ctx)
if ctx.action == 'transfer' then
return false, 'Transfers disabled.'
end
if ctx.action == 'list_player_sale' and ctx.price > 5000000 then
return false, 'Price too high.'
end
return true
end)
Important
qs-housing must start before your script.
ensure qs-housing
ensure your_resource
