[RELEASE] [ESX] [UNSUPPORTED] Daily rewards

this resource is not supported by me anymore, check this thread for future updates

Welp… I’m back at it again, this time i got a daily rewards system for you. This allows you to reward your players for playing on your server (items,money,weapons). It’s pretty simple so there’s not much i need to write here. You can setup static rewards or random ones.

Download: el_daily_rewards.zip (8.4 KB)
Source: GitHub
Documentation: GitHub Readme

Screenshots:
FiveM_GTAProcess_hBym73xXyb
FiveM_GTAProcess_rIAkMcNHIl
The border is different on each pic because it’s changing colors, everyone likes a bit of RGB, right?

If there’s already something like this out there, please link me it so i can check it out and probably even link it here, thanks.

24 Likes

Nice job bro :slight_smile:

1 Like

gonna test it now <3

Was working on this myself so its great someone has put this out!

1 Like

this is all im getting [ERROR] [MySQL] An error happens on MySQL for query “SELECT identifier,next_collect FROM daily_free {=}”: No database selected
and i selected the database any ideas ?

1 Like

is your mysql-async configured correctly? i’m also fixing some other bugs right now but that’s something i’ve never seen before tbh

Does this work with a server that restarts automaticly? I got my server restarting 2x a day. I wonder what it does with your 24h timer :slightly_smiling_face:

1 Like

Nice release, keep it up!

1 Like

yes the script runs off an irl timer. so even if you restart your server its linked to the database. so the time is real time 24 hours.

yes, it saves automagically

2 Likes

yes its configured correctly

just about to update, i fixed something because ESX was being really weird for some reason

Update!
Changelog:

  • Fixed weird startup bug

And that’s about it lol, it took longer than expected

Will u release ur Property Key System too?

sorry but no

Good job.

1 Like

have a problem. when i double click claim will get 2 for reward

2 Likes

That’s a big problem. I think as you click confirm it should force close the UI on client side. That should fix.

[ERROR] [MySQL] An critical error happens on MySQL for query "SELECT identifier,next_collect FROM `daily_free` {=}": Object reference not set to an instance of an object.   at MySqlConnector.Core.ConnectionPool.GetPool (System.String connectionString) [0x0001a] in <53978a6dc2b1412fb709503d15dfc36a>:0
  at MySql.Data.MySqlClient.MySqlConnection.CreateSessionAsync (System.Nullable`1[T] ioBehavior, System.Threading.CancellationToken cancellationToken) [0x00012] in <53978a6dc2b1412fb709503d15dfc36a>:0
  at System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable`1+ConfiguredValueTaskAwaiter[TResult].GetResult () [0x0001e] in <4ac30274d31c4b8099694c24336fcb22>:0
  at MySql.Data.MySqlClient.MySqlConnection.OpenAsync (System.Nullable`1[T] ioBehavior, System.Threading.CancellationToken cancellationToken) [0x000bc] in <53978a6dc2b1412fb709503d15dfc36a>:0
  at MySQLAsync.Operation`1[TResult].ExecuteAsync (System.String query, System.Collections.Generic.IDictionary`2[TKey,TValue] parameters, CitizenFX.Core.CallbackDelegate callback, System.Boolean debug) [0x000aa] in <25ffe552fd484023b5b41531f38bf148>:0

how to fix it error on my cmd

Bonjour , anyone know why i got this problem ?

ref (@el_daily_rewards/server.lua:39)
setImmediate (@mysql-async/mysql-async.js:14431)

The code in server.lua :39 is :
TriggerClientEvent(“free:setTimeout”, source, 0)

Seem like, if you replace this :

RegisterServerEvent(“free:updateTimeout”)
AddEventHandler(“free:updateTimeout”, function()
local identifier = getSteamIdentifier(GetPlayerIdentifiers(source))
if not identifier then return end
local now = os.time()
if timecache[identifier] then
TriggerClientEvent(“free:setTimeout”, source, timecache[identifier])
else
MySQL.Async.fetchAll(‘SELECT next_collect FROM daily_free WHERE identifier[email protected];’, {[’@identifier’] = identifier}, function(collect)
if collect[1] then
TriggerClientEvent(“free:setTimeout”, source, collect[1].next_collect)
timecache[identifier] = collect[1].next_collect
else
TriggerClientEvent(“free:setTimeout”, source)
timecache[identifier] = 0
end
end)
end
end)

With this :

RegisterServerEvent(“free:updateTimeout”)
AddEventHandler(“free:updateTimeout”, function()
local identifier = getSteamIdentifier(GetPlayerIdentifiers(source))
if not identifier then return end
local now = os.time()
if timecache[identifier] then
TriggerClientEvent(“free:setTimeout”, source, timecache[identifier])
else
MySQL.Async.fetchAll(‘SELECT next_collect FROM daily_free WHERE identifier[email protected];’, {[’@identifier’] = identifier}, function(collect)
if collect[1] then
TriggerClientEvent(“free:setTimeout”, source, collect[1].next_collect)
timecache[identifier] = collect[1].next_collect
else
–TriggerClientEvent(“free:setTimeout”, source)
timecache[identifier] = 0
Wait(0)
end
end)
end
end)

I didn’t read all the script. So i don’t know what I disable. May the reward does not proc with this. Need testing.

Edit : Seem like to work, but… let’s wait an answer from the OP