Developers
This resource exposes a few useful integration points for other scripts:
A notify export
A tree XP helper function
Some server events you can safely trigger
A couple of client events you may want to listen to
1. Notify export
File: notify.lua
exports('Notify', Notify)Signature
Notify(src, level, key, replacements)src: player server ID (number) or0/nilfor console-only logging.level:'info' | 'success' | 'error'(mapped to provider).key: locale key string (e.g.'tree_donation_ok').replacements: optional table of placeholders to replace in the localized string.
Example localized string:
Example usage
Notification provider is controlled via Config.Notify.provider.
2. Tree XP helper
File: server/main.lua
Behaviour
Adds
xpGainXP to:xmas_players.total_xpfor the given player.Global tree XP (
xmas_tree_progress.xp).
Recalculates tree stage based on
Config.Tree.stages.Persists the new state and syncs tree status to the client:
Triggers
xmas:client:SyncTreefor that player.
Parameters
src: player server ID.xpGain: positive number; values ≤ 0 are ignored.
Example: give tree XP for another Christmas job
Note:
Xmas_AddTreeXPis a global function in the same runtime.Make sure the
Christmasresource is started before your script that calls this.
3. Server events you can trigger
3.1 Calendar
xmas:server:RequestOpenCalendar
xmas:server:RequestOpenCalendarDirection: client → server
Used by: main Christmas tree target
Effect:
Validates event date, tree state, player key (
Config.CalendarKeyItem) and per-day limits.Sends
xmas:client:OpenCalendarwith calendar data.
You can trigger this from another client UI if you want to open the calendar from a different place:
xmas:server:ClaimCalendar
xmas:server:ClaimCalendarDirection: client → server
Parameters:
day(number, event day index)Effect:
Validates that the day is claimable and matches the event window.
Gives rewards from
Config.CalendarRewards[day].Marks the day as claimed in
xmas_players.calendar_claims.Sends
xmas:client:CalendarUpdatewith latest data.
Normally this is only triggered by the built-in NUI.
You might use it if you are replacing the UI but want to reuse the server logic.
3.2 Donations
xmas:server:DonateToTree
xmas:server:DonateToTreeDirection: client → server
Used by: main tree target
Behaviour:
Finds the first matching item from
Config.DonationItemsin the player’s inventory.Removes one unit of that item.
Calls
Xmas_AddTreeXP(src, itemConfig.xp).Applies daily donation limits.
You can call this from another client script if you want a different interaction (e.g. menu):
3.3 Quest
xmas:quest:Start
xmas:quest:StartDirection: client → server
Effect:
Starts the Santa delivery quest if:
Event is active
Quest is enabled in
Config.QuestPlayer hasn’t completed it yet today
Spawns the van, gives keys, sends quest data to client.
Normally triggered by the Santa NPC target.
You can also start the quest from somewhere else:
xmas:quest:NearDrop, xmas:quest:StepComplete and xmas:quest:ReturnDone are internal and should not be triggered externally.
3.4 Weather sync
xmas:server:Weather_RequestSync
xmas:server:Weather_RequestSyncDirection: client → server
Effect:
Server responds with either:
xmas:client:Weather_Startif the event is active and weather lock is enabled.xmas:client:Weather_Stopotherwise.
Normally called automatically on client init; you generally don’t need to touch this.
You might use it if you need to re-sync weather for a specific player after some external change.
4. Client events you may want to listen to
xmas:client:SyncTree
xmas:client:SyncTreeParameters: xp, stageIndex
Fired:
On player join (initial sync).
Whenever the global tree XP or stage changes.
Use this to display custom tree info in your own UI:
xmas:client:OpenCalendar
xmas:client:OpenCalendarParameters: calendar data table
Contains:
Available days
Claimed days
Today’s day index
Whether the key is present, etc.
This is used internally by the NUI app, but you can mirror the behaviour or extend it.
xmas:client:CalendarUpdate
xmas:client:CalendarUpdateParameters: updated calendar data
Fired after a successful daily claim.
Use this if you maintain your own UI alongside or on top of the included one.
xmas:client:BeginCarryGift / xmas:client:EndCarryGift
xmas:client:BeginCarryGift / xmas:client:EndCarryGiftFired when:
Player starts carrying a Santa gift (
BeginCarryGift).Player stops carrying or turns in the gift (
EndCarryGift).
You can hook into these to add:
Custom animations
Extra HUD elements
Sounds
Example:
5. Notes
All database reads/writes go through
oxmysqland the helper functions inserver/main.lua.If you extend the system, reuse
Xmas_AddTreeXPinstead of writing to tables directly.Do not emit low-level events like
xmas:toys:Pickuporxmas:toys:CancelPlacementyourself – let the built-in placement flow handle them, or call higher-level APIs likexmas:toys:UseFromInventoryfrom inventory use handlers.
If you need extra hooks for a specific integration, the recommended pattern is to: