[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: