πͺSetup
Steps
1. Dependcies
es_extended (legacy)
oxmysql
ox_lib
tebex store for the premium page
2. Language
To change the language the script uses, you have to change the ox_lib locale.
To change the singles messaages head to locales/lang.json. You have to go into the file that fits to the language you set, or you may have to create it. Please dont change the key, this will break something. Just change the value. Notice that the %s are placeholders.
3. Configuration
The main settings are handled with convars. This is a list of the convars you can set, and to what it defaults.
To set the count of tasks. (max. 4)
set syntax_dailyrewards:taskCount 4
To set the time when the tasks refresh. The arg is a cron expression.
set syntax_dailyrewards:refreshTime "59 23 * * *"
To enable the usage of ox_target
setr syntax_dailyrewards:target 1
To set the premium package - The ID is there:
setr syntax_dailyrewards:premiumPackageId 1234567
4. Notification
Shared functions are located in the shared.lua
5. Data Files
There are 3 data files.
Those files are loaded and need to return a table.
NOTE: the image argument should always be the file name of an image located in web/img.
5.1. Locations
Located in data/locations.lua
LuaLS annotation:
---@class RawStation
---@field name string;
---@field coords vector3|vector4;
---@field blip {id: number, colour: number, scale: number, name: string?}?;
---@field ped {model: string|number, scenario: string?, target: boolean?, heading: number?}?;
---@field marker {sprite: number, scale: vector3, rot: vector3, colour: vector4, bobUpAndDown: boolean?, faceCamera: boolean?}?;
5.2. Rewards
Located in data/rewards.lua and data/premium_rewards.lua
LuaLS annotation:
---@class RawReward
---@field day number;
---@field label string;
---@field image string;
---@field enableNotify boolean?;
---@field onClaim function|table;
β
-- NOTE:
-- EXAMPLES::
-- onClaim = function(xPlayer())
-- print(xPlayer.getName()
-- end
--
-- onClaim = {
-- type = 'item',
-- name = 'bread',
-- amount = 5
-- }
--
-- onClaim = {
-- {
-- type = 'money',
-- name = 'bank',
-- amount = 500
-- },
-- {
-- type = 'notify',
-- data = {
-- description = 'You claimed this lol',
-- type = 'success'
-- }
-- }
-- }
5.3. Tasks
Located in data/tasks.lua
LuaLS annotation
---@class RawTask
---@field id number;
---@field title string;
---@field description string;
---@field goal number;
---@field rewards table<number, {image: string, label: string}>
---@field enableNotify boolean;
---@field onClaim function|table;
The tasks we provide to you are not ready to be used in producted. There aren't any security checks and they are just as an example. If you have a task with id 6 and its mission it is to farm 5 bread. In your farming script after farming a bread trigger the following:
It is a server event with args: playerId, taskId, count
TriggerEvent('syntax_dailyrewards:server:increaseTaskCount', source, 6, 1)
Note: Our script will automaticly notify the player when a task is complete and we will cancel the event. Dont worry.
6. Saving
We use a caching system to save the taskdata, which leads to a better performance.
To save the data: restart the server, drop a player, execute /savetaskdata.
Last updated