πͺHooks System
Overview
API Reference
Registering Hooks
local hookId = exports.nolag_properties:registerHook(event, callback)-- Register a hook for property purchases
local hookId = exports.nolag_properties:registerHook('buyProperty', function(data)
print(('Player %s bought property %s'):format(data.source, data.propertyId))
-- Return false to cancel the purchase
if someCondition then
return false
end
-- Return true or nothing to allow the event to continue
return true
end)Removing Hooks
Event Cancellation
Best Practices
1. Keep Hooks Fast
2. Error Handling
3. Resource Cleanup
Usage Examples
Example 1: Logging System
Example 2: Permission System
Example 3: Economy Integration
Troubleshooting
Common Issues
Debug Tips
Last updated