Configuration
SHARED
Don't touch the first line
```lua
Config, Noti, Lang = {}, {}, {}
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\
-- $$ __$$\ $$ __$$\ $$$\ $$ |$$ _____|\_$$ _|$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |
-- $$ / \__|$$ / $$ |$$$$\ $$ |$$ | $$ | $$ / \__|$$ | $$ |$$ | $$ |$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |
-- $$ | $$ | $$ |$$ $$\$$ |$$$$$\ $$ | $$ |$$$$\ $$ | $$ |$$$$$$$ |$$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |
-- $$ | $$ | $$ |$$ \$$$$ |$$ __| $$ | $$ |\_$$ |$$ | $$ |$$ __$$< $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ |
-- $$ | $$\ $$ | $$ |$$ |\$$$ |$$ | $$ | $$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |
-- \$$$$$$ | $$$$$$ |$$ | \$$ |$$ | $$$$$$\ \$$$$$$ |\$$$$$$ |$$ | $$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |
-- \______/ \______/ \__| \__|\__| \______| \______/ \______/ \__| \__|\__| \__| \__| \______| \______/ \__| \__|
-- Use "esx" or "qb"
Config.Framework = "qb"
-- If you are using one of the most recent versions of ESX, set the script name. Default = "es_extended"
Config.ESXExport = "es_extended"
-- Default ESX: "esx:getSharedObject" | Default QB: "qb-core"
Config.Core = "qb-core"
-- oxmysql, mysql-async or ghmattisql
Config.Mysql = "oxmysql"
-- Command to open the menu
Config.command = "rewards"
-- $$\ $$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$\
-- $$$\ $$ |$$ __$$\\__$$ __|\_$$ _|$$ _____|\_$$ _|$$ __$$\ $$ __$$\\__$$ __|\_$$ _|$$ __$$\ $$$\ $$ |$$ __$$\
-- $$$$\ $$ |$$ / $$ | $$ | $$ | $$ | $$ | $$ / \__|$$ / $$ | $$ | $$ | $$ / $$ |$$$$\ $$ |$$ / \__|
-- $$ $$\$$ |$$ | $$ | $$ | $$ | $$$$$\ $$ | $$ | $$$$$$$$ | $$ | $$ | $$ | $$ |$$ $$\$$ |\$$$$$$\
-- $$ \$$$$ |$$ | $$ | $$ | $$ | $$ __| $$ | $$ | $$ __$$ | $$ | $$ | $$ | $$ |$$ \$$$$ | \____$$\
-- $$ |\$$$ |$$ | $$ | $$ | $$ | $$ | $$ | $$ | $$\ $$ | $$ | $$ | $$ | $$ | $$ |$$ |\$$$ |$$\ $$ |
-- $$ | \$$ | $$$$$$ | $$ | $$$$$$\ $$ | $$$$$$\ \$$$$$$ |$$ | $$ | $$ | $$$$$$\ $$$$$$ |$$ | \$$ |\$$$$$$ |
-- \__| \__| \______/ \__| \______|\__| \______| \______/ \__| \__| \__| \______| \______/ \__| \__| \______/
function notifications(notitype, message, time)
-- Change this trigger for your notification system keeping the variables
TriggerEvent('codem-notification', message, time, notitype)
end
-- Notifications types:
Noti.info = 'info'
Noti.check = 'check'
Noti.error = 'error'
-- Notification time:
Noti.time = 5000
-- $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$$$$$$$\
-- $$ | $$ __$$\ $$$\ $$ |$$ __$$\ $$ | $$ |$$ __$$\ $$ __$$\ $$ _____|
-- $$ | $$ / $$ |$$$$\ $$ |$$ / \__|$$ | $$ |$$ / $$ |$$ / \__|$$ |
-- $$ | $$$$$$$$ |$$ $$\$$ |$$ |$$$$\ $$ | $$ |$$$$$$$$ |$$ |$$$$\ $$$$$\
-- $$ | $$ __$$ |$$ \$$$$ |$$ |\_$$ |$$ | $$ |$$ __$$ |$$ |\_$$ |$$ __|
-- $$ | $$ | $$ |$$ |\$$$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ | $$ |$$ |
-- $$$$$$$$\ $$ | $$ |$$ | \$$ |\$$$$$$ |\$$$$$$ |$$ | $$ |\$$$$$$ |$$$$$$$$\
-- \________|\__| \__|\__| \__| \______/ \______/ \__| \__| \______/ \________|
Lang.alreadyDelivered = "You already have that reward"
Lang.received = "You have received your daily reward!"
Lang.futureDay = "You cannot select a future day"
Lang.oneReward = "You can only redeem one reward per day"
-- $$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$$$$$$\ $$$$$$$\ $$$$$$\
-- $$ __$$\ $$ _____|$$ | $\ $$ |$$ __$$\ $$ __$$\ $$ __$$\ $$ __$$\
-- $$ | $$ |$$ | $$ |$$$\ $$ |$$ / $$ |$$ | $$ |$$ | $$ |$$ / \__|
-- $$$$$$$ |$$$$$\ $$ $$ $$\$$ |$$$$$$$$ |$$$$$$$ |$$ | $$ |\$$$$$$\
-- $$ __$$< $$ __| $$$$ _$$$$ |$$ __$$ |$$ __$$< $$ | $$ | \____$$\
-- $$ | $$ |$$ | $$$ / \$$$ |$$ | $$ |$$ | $$ |$$ | $$ |$$\ $$ |
-- $$ | $$ |$$$$$$$$\ $$ / \$$ |$$ | $$ |$$ | $$ |$$$$$$$ |\$$$$$$ |
-- \__| \__|\________|\__/ \__|\__| \__|\__| \__|\_______/ \______/
Rewards = {
-- Type options = "item", "money", "vehicle", "weapon"
-- Amount is for money or items
-- Itemname is for item gta name and vehicle model
[1] = {
type = "money",
amount = 500,
itemname = nil,
imageUrl = "./assets/rewards/money.png",
label = "Money"
},
[2] = {
type = "item",
amount = 3,
itemname = "goldbar",
imageUrl = "./assets/rewards/goldbar.png",
label = "Gold Bar"
},
[3] = {
type = "item",
amount = 2,
itemname = "ruby",
imageUrl = "./assets/rewards/ruby.png",
label = "Ruby"
},
[4] = {
type = "item",
amount = 1,
itemname = "mobile",
imageUrl = "./assets/rewards/mobile.png",
label = "Mobile"
},
[5] = {
type = "weapon",
amount = 1,
itemname = "weapon_revolver",
imageUrl = "./assets/rewards/revolver.png",
label = "Revolver"
},
[6] = {
type = "money",
amount = 1000,
itemname = nil,
imageUrl = "./assets/rewards/money.png",
label = "Money"
},
[7] = {
type = "item",
amount = 1,
itemname = "emerald_ring",
imageUrl = "./assets/rewards/emerald_ring.png",
label = "Emerald Ring"
},
[8] = {
type = "item",
amount = 5,
itemname = "bratte",
imageUrl = "./assets/rewards/bratte.png",
label = "Bratte"
},
[9] = {
type = "item",
amount = 20,
itemname = "weed",
imageUrl = "./assets/rewards/weed.png",
label = "Weed"
},
[10] = {
type = "weapon",
amount = 1,
itemname = "weapon_knife",
imageUrl = "./assets/rewards/weapon_knife.png",
label = "Knife"
},
[11] = {
type = "item",
amount = 1,
itemname = "radio",
imageUrl = "./assets/rewards/radio.png",
label = "Radio"
},
[12] = {
type = "money",
amount = 1000,
itemname = nil,
imageUrl = "./assets/rewards/money.png",
label = "Money"
},
[13] = {
type = "item",
amount = 20,
itemname = "cigarrette",
imageUrl = "./assets/rewards/cigarette.png",
label = "Cigarette"
},
[14] = {
type = "item",
amount = 5,
itemname = "firstaid",
imageUrl = "./assets/rewards/firstaid.png",
label = "First Aid"
},
[15] = {
type = "weapon",
amount = 1,
itemname = "weapon_snspistol",
imageUrl = "./assets/rewards/weapon_snspistol.png",
label = "SNS Pistol"
},
[16] = {
type = "item",
amount = 20,
itemname = "strawberry",
imageUrl = "./assets/rewards/strawberry.png",
label = "Strawberry"
},
[17] = {
type = "item",
amount = 10,
itemname = "huntingbait",
imageUrl = "./assets/rewards/huntingbait.png",
label = "Bait"
},
[18] = {
type = "money",
amount = 1500,
itemname = nil,
imageUrl = "./assets/rewards/money.png",
label = "Money"
},
[19] = {
type = "item",
amount = 5,
itemname = "catrice",
imageUrl = "./assets/rewards/catrice.png",
label = "Catrice"
},
[20] = {
type = "item",
amount = 2,
itemname = "lockpick",
imageUrl = "./assets/rewards/lockpick.png",
label = "Lockpick"
},
[21] = {
type = "item",
amount = 1,
itemname = "rope",
imageUrl = "./assets/rewards/rope.png",
label = "Rope"
},
[22] = {
type = "item",
amount = 10,
itemname = "sprunk",
imageUrl = "./assets/rewards/sprunk.png",
label = "Sprunk"
},
[23] = {
type = "item",
amount = 50,
itemname = "goldchip",
imageUrl = "./assets/rewards/goldchip.png",
label = "Gold Chip"
},
[24] = {
type = "item",
amount = 10,
itemname = "donut",
imageUrl = "./assets/rewards/popdonut.png",
label = "Donut"
},
[25] = {
type = "weapon",
amount = 1,
itemname = "weapon_smg",
imageUrl = "./assets/rewards/weapon_smg.png",
label = "SMG"
},
[26] = {
type = "money",
amount = 2000,
itemname = nil,
imageUrl = "./assets/rewards/money.png",
label = "Money"
},
[27] = {
type = "item",
amount = 1,
itemname = "cryptostick",
imageUrl = "./assets/rewards/cryptostick.png",
label = "Cryptostick"
},
[28] = {
type = "item",
amount = 50,
itemname = "meth_blue",
imageUrl = "./assets/rewards/meth_blue.png",
label = "Meth"
},
[29] = {
type = "item",
amount = 5,
itemname = "adrenaline",
imageUrl = "./assets/rewards/adrenaline.png",
label = "Adrenaline"
},
[30] = {
type = "item",
amount = 5,
itemname = "emerald",
imageUrl = "./assets/rewards/emerald.png",
label = "Emerald"
},
[31] = {
type = "item",
amount = 5,
itemname = "repair_kit",
imageUrl = "./assets/rewards/repairkit.png",
label = "Repair Kit"
}
}
```
SERVER CONFIGURATION
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$$$\ $$$$$$$$\ $$\ $$\ $$$$$$\
-- $$ __$$\ \_$$ _|$$ | $$ |$$ _____| \_$$ _|\__$$ __|$$ _____|$$$\ $$$ |$$ __$$\
-- $$ / \__| $$ | $$ | $$ |$$ | $$ | $$ | $$ | $$$$\ $$$$ |$$ / \__|
-- $$ |$$$$\ $$ | \$$\ $$ |$$$$$\ $$ | $$ | $$$$$\ $$\$$\$$ $$ |\$$$$$$\
-- $$ |\_$$ | $$ | \$$\$$ / $$ __| $$ | $$ | $$ __| $$ \$$$ $$ | \____$$\
-- $$ | $$ | $$ | \$$$ / $$ | $$ | $$ | $$ | $$ |\$ /$$ |$$\ $$ |
-- \$$$$$$ |$$$$$$\ \$ / $$$$$$$$\ $$$$$$\ $$ | $$$$$$$$\ $$ | \_/ $$ |\$$$$$$ |
-- \______/ \______| \_/ \________| \______| \__| \________|\__| \__| \______/
function GiveItemToPlayer(playerID, itemName, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
xPlayer.addInventoryItem(itemName, amount)
return true
else
local xPlayer = QBCore.Functions.GetPlayer(playerID)
xPlayer.Functions.AddItem(itemName, amount)
return true
end
end
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\
-- $$ __$$\ \_$$ _|$$ | $$ |$$ _____| $$$\ $$$ |$$ __$$\ $$$\ $$ |$$ _____|\$$\ $$ |
-- $$ / \__| $$ | $$ | $$ |$$ | $$$$\ $$$$ |$$ / $$ |$$$$\ $$ |$$ | \$$\ $$ /
-- $$ |$$$$\ $$ | \$$\ $$ |$$$$$\ $$\$$\$$ $$ |$$ | $$ |$$ $$\$$ |$$$$$\ \$$$$ /
-- $$ |\_$$ | $$ | \$$\$$ / $$ __| $$ \$$$ $$ |$$ | $$ |$$ \$$$$ |$$ __| \$$ /
-- $$ | $$ | $$ | \$$$ / $$ | $$ |\$ /$$ |$$ | $$ |$$ |\$$$ |$$ | $$ |
-- \$$$$$$ |$$$$$$\ \$ / $$$$$$$$\ $$ | \_/ $$ | $$$$$$ |$$ | \$$ |$$$$$$$$\ $$ |
-- \______/ \______| \_/ \________| \__| \__| \______/ \__| \__|\________| \__|
function GiveMoneyToPlayer(playerID, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
xPlayer.addMoney(amount)
return true
else
local xPlayer = QBCore.Functions.GetPlayer(playerID)
xPlayer.Functions.AddMoney('cash', amount, "Reward")
return true
end
end
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$$$\ $$$$$$\ $$$$$$$\ $$$$$$\ $$\ $$\
-- $$ __$$\ \_$$ _|$$ | $$ |$$ _____| $$ | $\ $$ |$$ _____|$$ __$$\ $$ __$$\ $$ __$$\ $$$\ $$ |
-- $$ / \__| $$ | $$ | $$ |$$ | $$ |$$$\ $$ |$$ | $$ / $$ |$$ | $$ |$$ / $$ |$$$$\ $$ |
-- $$ |$$$$\ $$ | \$$\ $$ |$$$$$\ $$ $$ $$\$$ |$$$$$\ $$$$$$$$ |$$$$$$$ |$$ | $$ |$$ $$\$$ |
-- $$ |\_$$ | $$ | \$$\$$ / $$ __| $$$$ _$$$$ |$$ __| $$ __$$ |$$ ____/ $$ | $$ |$$ \$$$$ |
-- $$ | $$ | $$ | \$$$ / $$ | $$$ / \$$$ |$$ | $$ | $$ |$$ | $$ | $$ |$$ |\$$$ |
-- \$$$$$$ |$$$$$$\ \$ / $$$$$$$$\ $$ / \$$ |$$$$$$$$\ $$ | $$ |$$ | $$$$$$ |$$ | \$$ |
-- \______/ \______| \_/ \________| \__/ \__|\________|\__| \__|\__| \______/ \__| \__|
function GiveWeaponToPlayer(playerID, weapon, amount)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
xPlayer.addWeapon(weapon, amount)
return true
else
local xPlayer = QBCore.Functions.GetPlayer(playerID)
xPlayer.Functions.AddItem(weapon, amount)
return true
end
end
-- $$$$$$\ $$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$$$\ $$\ $$\ $$$$$$\ $$$$$$\ $$\ $$$$$$$$\
-- $$ __$$\ \_$$ _|$$ | $$ |$$ _____| $$ | $$ |$$ _____|$$ | $$ |\_$$ _|$$ __$$\ $$ | $$ _____|
-- $$ / \__| $$ | $$ | $$ |$$ | $$ | $$ |$$ | $$ | $$ | $$ | $$ / \__|$$ | $$ |
-- $$ |$$$$\ $$ | \$$\ $$ |$$$$$\ \$$\ $$ |$$$$$\ $$$$$$$$ | $$ | $$ | $$ | $$$$$\
-- $$ |\_$$ | $$ | \$$\$$ / $$ __| \$$\$$ / $$ __| $$ __$$ | $$ | $$ | $$ | $$ __|
-- $$ | $$ | $$ | \$$$ / $$ | \$$$ / $$ | $$ | $$ | $$ | $$ | $$\ $$ | $$ |
-- \$$$$$$ |$$$$$$\ \$ / $$$$$$$$\ \$ / $$$$$$$$\ $$ | $$ |$$$$$$\ \$$$$$$ |$$$$$$$$\ $$$$$$$$\
-- \______/ \______| \_/ \________| \_/ \________|\__| \__|\______| \______/ \________|\________|
function GiveVehicleToPlayer(playerID, vehicleProps)
if Config.Framework == "esx" then
local xPlayer = ESX.GetPlayerFromId(playerID)
SqlFunc(Config.Mysql, 'execute',
'INSERT INTO owned_vehicles (owner, plate, vehicle, stored) VALUES (@owner, @plate, @vehicle, @stored)', {
['@owner'] = xPlayer.identifier,
['@plate'] = vehicleProps.plate,
['@vehicle'] = json.encode(vehicleProps),
['@stored'] = 1
})
return true
else
local xPlayer = QBCore.Functions.GetPlayer(playerID)
SqlFunc(Config.Mysql, 'execute',
'INSERT INTO player_vehicles (citizenid, plate, mods, stored) VALUES (@citizenid, @plate, @mods, @state)', {
['@citizenid'] = Player.PlayerData.citizenid,
['@plate'] = vehicleProps.plate,
['@mods'] = json.encode(vehicleProps),
['@state'] = 1
})
return true
end
end
Last updated