[FREE] Giveaway Script

vyzo_giveaway

Hello, This script makes things easier when you want to host a giveaway on your roleplay server by creating a code that the players can redeem.

Dependency

  1. oxmysql
  2. ox_lib

Installation

  1. Git clone this repository or download the latest release from GitHub
  2. Configure config.lua
  3. Open client.lua and change the notification to yours
  4. Import the SQL vyzo_giveaway.sql
  5. Add ensure vyzo_giveaway on server.cfg after oxmysql and oxlib

Usage

  • /cga to create a new giveaway
  • /redeem to redeem a code
  • Format to give reward type car: car_CARMODEL_PLATE. Example: car_adder_VYZO or car_adder

Features

  • 0.00ms resmon when idle and 0.001ms for a blink of an eye when executing the command
  • Use your own code or auto-generated code with flexible configuration
  • Set how many players can redeem a code
  • Support logging into Discord using the Discord webhook
  • Check the code format before executing any queries (check server.lua, default are commented)
  • Available in 3 languages
  • Supported reward type: money, bank, items, and car (for ox_inventory users, items are not attached to a database so you can give weapons too)

Note

  • Tested with ESX Legacy 1.8.5 and working fine
  • You need to have esx_vehicleshop running or at least have the SQL table imported if you want to make the reward type car
  • Change the notification in client/client.lua to your notification

Preview

https://imgur.com/a/RqLFTeU

Download

vyzo_giveaway (GitHub)

Todo

  • No idea

Changelog

v1.2.0

Features

  • Add reward type: car
  • Add option can a player redeem the same code more than one

Refactor

  • Move the function into a separate file server/utils.lua for better readability
v1.1.0

Features

  • Added update functionality: Creating a giveaway with the same code will update the existing data on the database
  • Added optional automatic data deletion when the code reached its maximum usage (lulu3 suggestion)
  • Added SQL file missing
  • Added Dutch translation
  • Update en & id translation

Refactoring

  • Change callback value for better readable and give more optionality to add conditional logic on creating a giveaway function
v1.0.0

Initial release

Better Version

[:gem:] [PAID] [ESX] no_redeem use code vyzo for 5% off

8 Likes

Hey cool Script but the sql file is missing to crate.

Added! Sorry I forgot to include the SQL, thank you :grin:

Why after use, the database does not delete the data after use, but still retains it, I suggest you change it

Added as optional, thank you for suggesting.

server.lua line: 72

if result[1].reward == 'bank' or result[1] == 'money' then

change to

if result[1].reward == 'bank' or result[1].reward == 'money' then

to fix the money reward

1 Like

Updated, thank you :sweat_smile:

1 Like

Not seen before, great release :smiley:

no problem :slight_smile:

Thank you :grin:

1 Like

Very good script! It would be great if you send to Discord who created the code and in the same message the code. I also have a question, what ranges can create a code?

Thank you!

Did you mean it should log the code creator too when someone redeems the code?

What ranges? Did you mean rank? If yes, only the admin will be able to create a code

exactly, to record who created the code, for example; “admin” created the code; “code” with “x1000 money”

Added! Thank you for suggesting


Do you know the reason for that error? If I comment the notification lines and put ESX.ShowNotification(“text”, “success”, 3000), it works fine for me

Yeah because mine is modified, that’s why I stated this ^

1 Like

aaaa perfect, I have another doubt, in the message that a code was created when it should say “money, bank” it says “false”. And when it should say the item it puts “nil”
image
image

Oh my apologies, I mistype the data. Thank you for reporting :sweat_smile:

Nice post

Thank you :grinning: