ngddocs/ngdredemption.md

8.5 KiB

title description published date tags editor dateCreated
ngd-redemption true 2025-02-09T19:10:56.320Z markdown 2025-01-28T00:30:34.910Z

This guide assumes you already have a Tebex store integrated with FiveM. If you do not, please refer to their documentation.


Installation Steps

  1. Install ngd-Bridge

    Follow the guide to install ngd-Bridge HERE.

  2. Install ngd-redemption

    Download and place ngd-redemption AND ngd-interactiondialog into your [ngd] folder. This script must be started after ngd-Bridge.

  3. Modify Tebex Listings

Add Commands (Click to Expand)
  • Select Tebex listing you wish to add.
  • At the bottom of the screen, click on Game Server Commands
  • Once that opens, click on the gear to expand more options. -- Make sure the package delivery option is set to deliver even if the player is offline -- Inside of the when package is purchased field, put the following:
NGDRedemption {packageId} {transaction}

See Example:

  1. Configure Packages In Script

Package Configuration (Click to Expand)
  • In a web browser, navigate to your Tebex package. -- The #s seen at the end of the link are the Package ID, and will be used to configure the items in the script.
  • Inside of the config.lua, you will see Config.Packages = { -- You will need to add the Package ID from the step above, into the [] and configure each package

  • There are several variables to the packages you can choose from:

-- Type = (You can use 'item', 'vehicle', money, name, job or 'other') -- Label = (This is what is show in-game) -- Item = (This is the item given to players if the Type = 'item') -- Qty = (This is the amount of the item given above) -- Model = (This is the vehicle spawn code if Type = 'vehicle')


  • See example from the config below: -- Package 6650632 is an item that is given to players, the menu will show it as a 'Criminal's Goody Bag', and the player will be given the quantity of each item. -- Package 6650679 is a vehicle, the menu will show it as 'Pagassi - Zentorno' and the spawn code is a 'zentorno' -- Package 6778910 will show in the menu as Bag Of Money!, and the player will get 10000 cash. (This is for servers that don't have cash as an item) -- Package 54321 will show in the menu as Change Your Name! - The player will be able to change their name, and will be restricted to 25 characters. -- Package 7891011 will show in the menu as Redeem job. The player would have the job police set at grade 2. -- 12345 is custom. You can pass whatever variables you want to a server event. -- The packages are defined in the config, you should make sure the package from Tebex matches.
Config.Packages = {
    [6650632] = {
        Type = 'item',
        Label = 'Criminal\'s Goody Bag!',
        Items = {
            { Item = 'lockpick', Qty = 5 },
            { Item = 'tosti',    Qty = 1 }
        }
    },
    [6650679] = {
        Type = 'vehicle',
        Label = 'Pagassi - Zentorno',
        Model = 'zentorno'
    },
    [6778910] = {
        Type = 'money',
        Label = 'Bag Of Money!',
        MoneyType = 'cash',
        MoneyAmount = 10000
    },
    [54321] = {
        Type = 'name',
        Label = 'Change your name!',
        CharacterLimit = '25',
    },
    [7891011] = {
        Type = 'job',
        Label = 'Redeem Job',
        JobName = 'police',
        JobGrade = 2
    },
    [12345] = {
        Type = 'other',
        Label = 'Custom Package Example',
        CustomVariable1 = 'CV1',
        CustomVariable2 = 'CV2'
    }
}
  • If the Item = 'other is set, you can set your own logic to give players whatever you would like inside of the editableserver.lua using the function:
function GiveCustom(data)

end

The above are just examples. Please modify them to fit your server. {.is-warning}

  1. Set Garages

Garage Configuration (Click to Expand)

You MUST set your garage in the editableserver.lua file. If you need help, open a ticket in our Discord {.is-warning}

  • Set your garage name/id in the Config.GarageName to ensure the vehicles are put into the correct garage!
  • The script comes pre-configured for JG and CD garages. If you don't use these, make sure you set your garage configuration in the editableserver.lua file.
  1. Test Drives

Test Drive Configuration (Click to Expand)

Test Drives (Optional)

  • The script comes with an optional 'test drive' feature that allows you to make it so players can test drive premium vehicles before purchasing them on your Tebex store.

  • This is enabled by default, and all you have to do is configure what vehicles you want, their label that will show up in the menu and the locations where the player is teleported back when the test drive is complete.

Config.TestDrives = {
    Enabled = true,
    Time = 2, --minutes
    SpawnLocation = vector4(-1319.23, -2181.06, 13.94, 152.21),
    ReturnLocation = vector4(158.26, -739.98, 246.15, 66.94),
    Vehicles = {
        ['zentorno'] = {
            Label = 'Zentorno'
        },
        ['faggio'] = {
            Label = 'Awesome Moped'
        }
    }
}

  • You must also set your vehicle keys and fuel in the following configs. The plate doesn't need to be changed unless you want it to.
--Fuel System:
Config.VehicleFuel = function(vehicle)
    Entity(vehicle).state.fuel = 100
end

--Keys System:
Config.TestDriveVehicleKeys = function(vehicle, plate)
    exports['ngd-smallresources']:GiveLogicalKey(plate)
end

--Plate
Config.TestDriveVehiclePlate = function(vehicle)
    local uniquePlate = 'Prem' .. math.random(1000, 9999)
    SetVehicleNumberPlateText(vehicle, uniquePlate)
end
  1. LOGS

Logs Configuration (Click to Expand) - The script comes pre-configured for either Discord or Fivemerr logs. Choose your log type in the config and follow the instructions below to configure it.

Discord:

  • To use the discord logging feature, set the Config.LogType = 2, and add your webhook into the top of the editableserver.lua file.

Fivemerr:

  • To use the Fivemerr logs, set the `Config.LogType = 1'.
  • Open your server.cfg and add the following:
    set fivemerr_ngdredemption 'YOUR_API_KEY'
    
  • Replace YOUR_API_KEY with your API key from the Fivemerr dashboard.

Custom / No Logs:

  • To use your own logging logic, or to use no logs at all, set the `Config.LogType = 0'
  • If you wish to use your own logic, you can add it into the following function found inside the editableserver.lua
function CustomLogs(data, message)

end
  1. In-Game Package Creation

Admin Package Creation (Click to Expand) - The script comes pre-configured for either Discord or Fivemerr logs. Choose your log type in the config and follow the instructions below to configure it.

Discord:

  • To use the discord logging feature, set the Config.LogType = 2, and add your webhook into the top of the editableserver.lua file.

Fivemerr:

  • To use the Fivemerr logs, set the `Config.LogType = 1'.
  • Open your server.cfg and add the following:
    set fivemerr_ngdredemption 'YOUR_API_KEY'
    
  • Replace YOUR_API_KEY with your API key from the Fivemerr dashboard.

Custom / No Logs:

  • To use your own logging logic, or to use no logs at all, set the `Config.LogType = 0'
  • If you wish to use your own logic, you can add it into the following function found inside the editableserver.lua
function CustomLogs(data, message)

end

Translations

  • Make sure you review the translate.lua file, as this is where you will be able to set the name of your store, garage information, etc.

Do you still need help? Open a ticket in our Discord {.is-warning}