saveSettings
Description
Triggered when property settings are saved. This occurs when players modify configuration options for their properties such as access permissions, appearance settings, or functional parameters.
Payload Structure
lua{ source = playerId, -- The player's server ID player = playerData, -- Player data object from framework propertyId = propertyId,-- Property identifier settings = data -- {price: number, rentPrice: number, label: string, description: string, forSale: boolean, forRent: boolean, forMortgage: boolean, tags: table<string>, images: table<string>, allowedPoints: table<string>} }
Parameters
- source (number): The server ID of the player saving the settings
- player (table): Complete player data object provided by the framework (ESX/QBCore)
- propertyId (string/number): Unique identifier for the property whose settings are being saved
- settings (table):
| Property | Type | Description |
|---|---|---|
| price | number | Selling price of the property |
| rentPrice | number | Rental price of the property |
| label | string | Short label or title for the property |
| description | string | Detailed description of the property |
| forSale | boolean | Indicates if the property is for sale |
| forRent | boolean | Indicates if the property is available for rent |
| forMortgage | boolean | Indicates if the property is available for mortgage |
| tags | table | List of tags associated with the property |
| images | table | List of image URLs for the property |
| allowedPoints | table | List of points or features allowed for the property |
Usage Example
luaexports.nolag_properties:registerHook('saveSettings', function(params) local source = params.source local player = params.player local propertyId = params.propertyId local settings = params.settings print(('Player %s is saving settings for property %s'):format( source, propertyId )) -- Validate settings changes if not validateSettings(settings) then TriggerClientEvent('chat:addMessage', source, { args = {'System', 'Invalid settings configuration'} }) return false -- Cancel settings save end -- Check for restricted settings if hasRestrictedSettings(settings) and not hasAdminPermission(source) then TriggerClientEvent('chat:addMessage', source, { args = {'System', 'You do not have permission to modify these settings'} }) return false -- Cancel if restricted settings without permission end -- Log settings changes logSettingsChange(source, settings, propertyId) -- Trigger settings update notifications notifyPropertyMembers(propertyId, 'settings_updated', settings) return true -- Allow settings to be saved end)
Common Setting Types
- access: Player access permissions and key management
- functionality: Feature toggles and behavioral settings
- security: Security measures and protection settings
- automation: Automated systems and scheduling
Return Values
- true or nil: Allow the settings to be saved
- false: Cancel the settings save operation