setInteractablePoint

Description

Triggered when an interactable point is set for a property. This occurs when players create interaction zones within their properties for various purposes.

Payload Structure

{
    source = playerId,      -- The player's server ID
    player = playerData,    -- Player data object from framework
    propertyId = propertyId,-- Property identifier
    -- Additional data specific to the interactable point
    pointData = pointData -- { id: number, name: string, label: string, interactRange: number, coords: vector3 | vector4}
}

Parameters

  • source (number): The server ID of the player setting the interaction point

  • player (table): Complete player data object provided by the framework (ESX/QBCore)

  • propertyId (string/number): Unique identifier for the property where the point is being set

  • pointData (table): { id: number, name: string, label: string, interactRange: number, coords: vector3 | vector4}

Usage Example

exports.nolag_properties:registerHook('setInteractablePoint', function(data)
    print(('Player %s is setting %s interaction point in property %s'):format(
        data.source, 
        data.pointData.label, 
        data.propertyId
    ))
    
    -- Limit interaction points per property
    local currentPoints = getInteractionPointCount(data.propertyId)
    if currentPoints >= MAX_INTERACTION_POINTS then
        TriggerClientEvent('chat:addMessage', data.source, {
            args = {'System', 'Maximum interaction points reached for this property'}
        })
        return false -- Cancel the point creation
    end
    
    -- Validate point type permissions
    if not hasInteractionPermission(data.source, data.pointData.id) then
        return false -- Cancel if no permission
    end
    
    -- Log the interaction point creation
    logInteractionPoint(data)
    
    return true -- Allow the point to be created
end)

Return Values

  • true or nil: Allow the interaction point to be created

  • false: Cancel the interaction point creation

Last updated