Follow these simple steps to get the system running:
1. Download the Resource
Download the script files from your Cfx.re Keymaster account assets.
2. Upload to Server
Drag and drop the wert-christmas folder into your server's resources directory.
3. Server Configuration
Add the following line to your server.cfg file to ensure the script starts automatically:
Kod snippet'i
4. Database (SQL)
You do not need to run any manual SQL files. The script automatically synchronizes and creates the necessary database tables upon the first start.
⚙️ Configuration & Locales
Config Settings
You can adjust all system settings in the config.lua file.
Important: Please review the config.lua file carefully and configure the settings (prices, rewards, tree levels) to match your server's economy and preferences before opening it to players.
Language Editor (JSON)
All text and messages are stored in JSON format. You can easily translate the script into your preferred language or edit the text directly within the JSON files found in the locales/ folder.
👨💻 Developer Guide (Exports)
If you want to integrate the mission system with other scripts (e.g., giving mission progress from a robbery or a job), you can use the following export.
Add Mission Progress
Use this export to increment the progress of a specific mission for a player.
Syntax:
Lua
source: The player's server ID.
missionId: The unique ID of the mission (defined in your config).
amount: How much progress to add (usually 1).
Example Usage:
Below is an example of how to add progress to the 'snowball_fight' mission:
local playerSource = source
-- Adds 1 point to the 'snowball_fight' mission
exports['wert-christmas']:AddMissionProgress(playerSource, 'snowball_fight', 1)
Config = {}
-- Framework: 'esx' or 'qb' or 'qbox'
Config.Framework = 'qb'
-- Interaction
Config.Command = 'christmas'
Config.OpenKey = 'F5' -- Set to nil to disable keybind
-- Settings
Config.PlaytimeSaveInterval = 5 -- Minutes to save playtime to DB automatically
-- Database Tables
Config.DB = {
Users = 'wert_christmas_users'
}
-- Tree Levels (Playtime Rewards)
Config.TreeLevels = {
{ minutes = 30, reward = 50, type = 'snowball', label = '50 Snowballs' },
{ minutes = 60, reward = 1, type = 'item', item = 'giftbox', label = 'Gift Box' },
{ minutes = 120, reward = 250, type = 'snowball', label = '250 Snowballs' },
{ minutes = 180, reward = 1, type = 'item', item = 'rare_key', label = 'Rare Key' },
{ minutes = 240, reward = 1000, type = 'snowball', label = 'GOLD STAR' },
}
Config.DailyRewards = {
[1] = { amount = 50, type = 'snowball', label = 'Snowballs', image = './assets/snowball.png' },
[2] = { amount = 1000, type = 'money', label = '$1,000 Cash', image = 'money.png' },
[3] = { amount = 1, type = 'item', item = 'burger', label = 'Delicious Burger', image = 'burger.png' },
[4] = { amount = 100, type = 'snowball', label = '100 Snowballs', image = 'snowball.png' },
[5] = { amount = 1, type = 'item', item = 'bandage', label = 'Bandage', image = 'bandage.png' },
[6] = { amount = 5000, type = 'money', label = '$5,000 Cash', image = 'money.png' },
[7] = { amount = 1, type = 'item', item = 'weapon_pistol', label = 'Golden Pistol', image = 'pistol.png', isGolden = true },
-- U can contiune until 25
}
for i = 8, 25 do
if not Config.DailyRewards[i] then
Config.DailyRewards[i] = {
amount = i * 50,
type = 'snowball',
label = 'Snowballs',
image = 'snowball.png',
isGolden = (i % 7 == 0)
}
end
end
-- # Shop
Config.Shop = {
{
id = 1,
name = 'Astron',
price = 5000,
stock = 5,
category = 'vehicle',
spawnName = 'astron', -- Vehicle spawn code
desc = 'Luxury SUV, Winter Edition.',
rarity = 'legendary',
image = 'https://docs.fivem.net/vehicles/astron.webp'
},
{
id = 2,
name = '$50,000 Cash',
price = 1000,
stock = 999,
category = 'money',
account = 'cash',
amount = 50000,
desc = 'Instant cash in ur pocket.',
rarity = 'common',
image = 'https://static.vecteezy.com/system/resources/thumbnails/009/347/983/small/big-pile-of-us-dollar-notes-a-lot-of-money-over-transparent-background-3d-rendering-of-bundles-of-cash-png.png'
},
{
id = 3,
name = 'Laptop',
price = 1000,
stock = 999,
category = 'item',
item = 'laptop',
amount = 1,
desc = 'A Gamer Laptop',
rarity = 'common',
image = 'nui://ox_inventory/web/images/laptop.png'
},
-- Add more items...
}
Config.Missions = {
-- Mevcut Olanlar
{
id = 'snowball_fight',
title = 'Snowball Fight',
desc = 'Throw snowballs at 10 different players.',
max = 10,
reward = 150,
rarity = 'common',
icon = 'fa-snowflake'
},
{
id = 'delivery',
title = 'Santa Helper',
desc = 'Deliver 5 gifts to the NPCs.',
max = 5,
reward = 300,
rarity = 'rare',
icon = 'fa-gift'
},
-- 1. Sürüş Görevi
{
id = 'winter_drifter',
title = 'Winter Drifter',
desc = 'Drive total of 15km on slippery roads.',
max = 15,
reward = 250,
rarity = 'common',
icon = 'fa-car-side'
},
-- 2. Sosyal Görev
{
id = 'generous_soul',
title = 'Generous Soul',
desc = 'Give an item to another player.',
max = 1,
reward = 500,
rarity = 'epic',
icon = 'fa-hand-holding-heart'
},
-- 3. Tüketim Görevi
{
id = 'stay_warm',
title = 'Stay Warm',
desc = 'Drink 3 Hot Chocolates or Coffees.',
max = 3,
reward = 150,
rarity = 'common',
icon = 'fa-mug-hot'
},
-- 4. Keşif Görevi
{
id = 'chiliad_climb',
title = 'North Pole Expedition',
desc = 'Reach the top of Mount Chiliad.',
max = 1,
reward = 1000,
rarity = 'legendary',
icon = 'fa-mountain'
},
-- 5. Eğlence Görevi
{
id = 'fireworks_show',
title = 'Light Up The Sky',
desc = 'Use 3 fireworks to celebrate.',
max = 3,
reward = 400,
rarity = 'rare',
icon = 'fa-explosion'
},
-- 6. Hız Görevi
{
id = 'sleigh_speed',
title = 'Sleigh Speed',
desc = 'Reach 120 MPH in a land vehicle.',
max = 1,
reward = 200,
rarity = 'common',
icon = 'fa-gauge-high'
},
-- 7. Şans Görevi (Casino varsa)
{
id = 'lucky_star',
title = 'Lucky Star',
desc = 'Spin the lucky wheel at the Casino.',
max = 1,
reward = 600,
rarity = 'epic',
icon = 'fa-dice'
},
-- 8. Avcılık/Doğa
{
id = 'winter_hunt',
title = 'Winter Hunter',
desc = 'Hunt 3 wild animals in the wilderness.',
max = 3,
reward = 450,
rarity = 'rare',
icon = 'fa-paw'
},
-- 9. Alışveriş
{
id = 'holiday_shopping',
title = 'Holiday Shopping',
desc = 'Buy 5 items from any convenience store.',
max = 5,
reward = 200,
rarity = 'common',
icon = 'fa-bag-shopping'
},
-- 10. Aksiyon
{
id = 'snow_sniper',
title = 'Snow Sniper',
desc = 'Hit 5 players with snowballs from a distance.',
max = 5,
reward = 800,
rarity = 'legendary',
icon = 'fa-crosshairs'
},
-- 11. Zaman
{
id = 'marathon_runner',
title = 'Christmas Marathon',
desc = 'Run for 2km on foot.',
max = 2,
reward = 350,
rarity = 'rare',
icon = 'fa-person-running'
},
-- 12. Sosyal (Kalabalık)
{
id = 'party_time',
title = 'Party Time',
desc = 'Be near 5 other players at the same time.',
max = 1,
reward = 550,
rarity = 'epic',
icon = 'fa-users'
},
-- 13. Araç
{
id = 'clean_ride',
title = 'Shiny Sleigh',
desc = 'Clean your vehicle at a car wash.',
max = 1,
reward = 150,
rarity = 'common',
icon = 'fa-soap'
},
-- 14. Sağlık
{
id = 'patch_up',
title = 'Patch Up',
desc = 'Use 2 bandages to heal yourself.',
max = 2,
reward = 200,
rarity = 'common',
icon = 'fa-bandage'
},
-- 15. Keşif (Meydan)
{
id = 'city_lights',
title = 'City Lights',
desc = 'Visit the decorated Legion Square.',
max = 1,
reward = 100,
rarity = 'common',
icon = 'fa-tree'
}
}
Bridge = {}
if Config.Framework == 'esx' then
ESX = exports["es_extended"]:getSharedObject()
function Bridge.GetPlayer(source)
return ESX.GetPlayerFromId(source)
end
function Bridge.GetIdentifier(source)
local xPlayer = ESX.GetPlayerFromId(source)
return xPlayer and xPlayer.identifier or nil
end
function Bridge.GetName(source)
local xPlayer = ESX.GetPlayerFromId(source)
return xPlayer and xPlayer.getName() or "Unknown"
end
function Bridge.AddItem(source, item, count)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then xPlayer.addInventoryItem(item, count) end
end
function Bridge.AddMoney(source, type, amount)
local xPlayer = ESX.GetPlayerFromId(source)
if xPlayer then
if type == 'bank' then xPlayer.addAccountMoney('bank', amount)
else xPlayer.addMoney(amount) end
end
end
function Bridge.AddVehicle(src, model)
if not model then return false end
local ply = Bridge.GetPlayer(src)
if not ply then return false end
-- Add ur codes!
end
elseif Config.Framework == 'qb' or Config.Framework == 'qbox' then
QBCore = exports['qb-core']:GetCoreObject()
local function GeneratePlate()
local plate = QBCore.Shared.RandomInt(1) .. QBCore.Shared.RandomStr(2) .. QBCore.Shared.RandomInt(3) .. QBCore.Shared.RandomStr(2)
local result = MySQL.Sync.fetchScalar('SELECT plate FROM player_vehicles WHERE plate = ?', {plate})
if result then
return GeneratePlate()
else
return plate:upper()
end
end
function Bridge.GetPlayer(source)
return QBCore.Functions.GetPlayer(source)
end
function Bridge.GetIdentifier(source)
local Player = QBCore.Functions.GetPlayer(source)
return Player and Player.PlayerData.citizenid or nil
end
function Bridge.GetName(source)
local Player = QBCore.Functions.GetPlayer(source)
return Player and (Player.PlayerData.charinfo.firstname .. " " .. Player.PlayerData.charinfo.lastname) or "Unknown"
end
function Bridge.AddItem(source, item, count)
local Player = QBCore.Functions.GetPlayer(source)
if Player then Player.Functions.AddItem(item, count) end
end
function Bridge.AddMoney(source, type, amount)
local Player = QBCore.Functions.GetPlayer(source)
if Player then Player.Functions.AddMoney(type, amount) end
end
function Bridge.AddVehicle(src, model)
if not model then return false end
local ply = Bridge.GetPlayer(src)
if not ply then return false end
local plate = GeneratePlate()
MySQL.insert('INSERT INTO player_vehicles (license, citizenid, vehicle, hash, mods, plate, state, garage, type) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', {
ply.PlayerData.license,
ply.PlayerData.citizenid,
model,
GetHashKey(model),
'{}',
plate,
1,
'pillbox',
'car',
})
end
end
function Bridge.ItemReward(src, item, amount)
Bridge.AddItem(src, item, amount)
end