GithubHelp home page GithubHelp logo

rebel-promocodes's Introduction

rebel-promocodes

image

Store: Rebel Scripts

Discord: Discord Link

About:

This script gives admins and owners power to create promo codes with ease. You can create promo codes for items, vehicles and money.

When a code is created a discord webhook will be sent with the new codes information. It will also send a discord webhook when a player redeems a code.

Features:

  • | Create promo codes for items, vehicles and money

  • | Set item quantity, example 5x joints

  • | Set item uses, example 5 uses

  • | Nice promo code creator menu built with qb-input

  • | Discord webhook messages for when a code is created and redeemed.

Resmon: In use (0.00) | Idle (0.00)

Dependencies

Other Resources

Rebel Trucking [QB/ESX]

Rebel Impound Job [QB]

Installation

  1. Put the rebel-promocodes folder in your resources directory
  2. Add ensure rebel-promocodes in your server.cfg
  3. Insert insert.sql to your sql database
  4. Add this to your qb-core/shared.lua
['governmentcode'] 			 	 	 = {['name'] = 'governmentcode', 			  		['label'] = 'Government Code', 				['weight'] = 0, 		['type'] = 'item', 		['image'] = 'receipt.png', 			['unique'] = true, 		['useable'] = false, 	['shouldClose'] = false,   ['combinable'] = nil,   ['description'] = 'A code which can be redeemed somewhere... Cough cough /redeemp {code}'},
  1. Add this to your qb-inventory/html/js/app.js under the function FormatItemInfo
} else if (itemData.name == "governmentcode") {
    $(".item-info-title").html("<p>" + itemData.label + "</p>");
    $(".item-info-description").html("<p>" + itemData.info.label + "</p>");

How to integrate this script in other resources

You can integrate this script into other resources very easily. Here is an example:

Garbage Job, when the player picks up a trash bag he/she has a 10% chance to get a government code(promo code) for $1000 Cash

function GiveGarbageTreasure(source)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)

    local chance = math.random (0,100)
    local code = "Government:"..math.random(100,999).."qbcore"..math.random(100,999)

    if chance >= 90 then
        TriggerEvent('rebel-promocodes:server:giveitemwithcode', Player.PlayerData.citizenid, "money", "cash", 1000, 1, "Garbage Treasure", code)
    end
end

This will give the player a government code item which looks like this:

image

Server:

TriggerEvent('rebel-promocodes:server:giveitemwithcode', citizenid, type, item, amount, uses, wherefrom, code)

Client:

TriggerServerEvent('rebel-promocodes:server:giveitemwithcode', citizenid, type, item, amount, uses, wherefrom, code)

citizenid = The players citizenid, for example Player.PlayerData.citizenid

type = Item type, can be either "Item", "Vehicle" or "Money"

item = Which Item the code should give, for example "Joint" for Item, "Adder" for vehicle, "Cash" for money. You get it.

amount = Amount is how much of the item the code should give, for example 10

uses = How many uses the code should have, for example 10. A player can only use a code once.

wherefrom = Where the code was created from, for example "Bank Robbery"

code = What the code should be, for example "codegen:"..math.random(100,999)

rebel-promocodes's People

Contributors

rebelscripts avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.