# rentProperty

## Description

Triggered when a player attempts to rent a property.

## Payload Structure

```lua
{
    source = playerId,      -- The player's server ID
    player = playerData,    -- Player data object from framework
    propertyId = propertyId,-- Property identifier
    rentAs = rentAs,       -- Rental type (e.g., 'society', 'user')
    rentDays = rentDays,   -- Number of days to rent
    autoRenew = autoRenew 
}
```

## Parameters

* **source** (number): The server ID of the player attempting the rental
* **player** (table): Complete player data object provided by the framework (ESX/QBCore)
* **propertyId** (string/number): Unique identifier for the property being rented
* **rentAs** (string): The rental context - typically 'player' for personal rental or 'gang' for organization rental
* **rentDays** (number): The duration of the rental period in days

## Usage Example

```lua
exports.nolag_properties:registerHook('rentProperty', function(data)
    print(('Player %s is renting property %s for %d days as %s'):format(
        data.source, 
        data.propertyId, 
        data.rentDays, 
        data.rentAs
    ))
    
    -- Check if player has rental limit
    if getRentalCount(data.source) >= MAX_RENTALS then
        TriggerClientEvent('chat:addMessage', data.source, {
            args = {'System', 'You have reached the maximum rental limit'}
        })
        return false -- Cancel the rental
    end
    
    -- Apply rental discount for VIP players
    if isVIPPlayer(data.source) then
        applyRentalDiscount(data.source, 0.1) -- 10% discount
    end
    
    return true -- Allow the rental to proceed
end)
```

## Return Values

* **true** or **nil**: Allow the property rental to continue
* **false**: Cancel the property rental and prevent the transaction
