[ESX] FzD Advent Calendar

[ESX] FzD Advent Calendar

Information:
I made this resource for Christmas on my server, this advent calendar has features like:

  • Can only open days that passed or current on, so if you are on day 10 you can not open day 11 or above
  • The use of weighted randoms to decide what gift to get, meaning that you can added multiple rewards and add different chances got the reward making some harder to get them others, check the bottom of this topic for config.
  • Custom made model that is held in your hand open on the advent calendar

Preview:
Video

Tebex: (£5.00 excl. tax)
FzD Developments | Advent Calendar (tebex.io)

Dependencies:
mysql-async

Framework:
ESX

Config:

Config = {}

-- Make sure you set this config first, as the generates the reward as soon as someone connects to the server.

Config.Gifts = {

    --[[
        weightRandom - The lower the number the more chance of getting the time, the higher the number the harder
        For example if one item had a weightRandom of 5 and another of 1, you are more like to get the item that had the weightedRandom of 1

        item - This will be the item spawn code

        label - This will be what the item will be displayed as

        type - This should be set to any of the following:

            - cash
            - bank
            - item
            - weapon

        amount - The amount of the item then receive if giving a weapon I recommend leaving it at 1

        image - This will be the image that it displays in the advent calender, check html/images/rewards
    ]]

    [1] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [2] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [3] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [4] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [5] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [6] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [7] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [8] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [9] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [10] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [11] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [12] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [13] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [14] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [15] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [16] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [17] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [18] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [19] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [20] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [21] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [22] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [23] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    },
    [24] = {
        Items = {
            {weightRandom = 5,  item = 'cash',                  label = 'Money',           type = 'bank',       amount = 1000,      image = 'cash'},
            {weightRandom = 1,  item = 'bread',                 label = 'Money Rolls',     type = 'item',       amount = 50,        image = 'moneyrolls'},
            {weightRandom = 1,  item = 'weapon_combatpistol',   label = 'Combat Pistol',   type = 'weapon',     amount = 1,         image = 'weapon'},
        }
    }, -- Don't add anymore tables, their is only 24 days in December
}

Config.Notify = function(msg)
    exports['mythic_notify']:SendAlert('inform', msg)
end

Other Resources:

1 Like

[ script:FzD-Advent] SCRIPT ERROR: ?:-1: attempt to index a nil value

I uploaded sql and started the server and got the error message in Sec

1 Like

I will check this now there was no error on my end give me two seconds

1 Like

All fixed, you should be able to redownload it from keymaster as I pushed out a update. I forgot to add the ESX.PlayerLoaded event.

Okey, the error is so far away if you open the window with / avent, you get a message under F8

Sorry about that this issue it now fixed, and the updated version is now on the download

You can also write to him he is very helpful when it comes to adjustments or errors / problems

Doesn’t mention it uses Escrow system, this is required as of Releases Rules and F.A.Q

Unlisted until topic has been changed, we will handle stricter on these since customers are reporting they don’t know what they buy.

Hello, we habe the Problem that the script doesnt add Money to you… why

Also tried it with type=‘cash’ and ‘bank’ but nothing