MrNewbScripts
My DiscordSee The StoreCommunity_BridgeGithub
  • MOTD
  • MrNewbVehicleKeys
    • Install
      • Framework
        • esx
        • qb-core
        • qbox
      • inventory
        • 🐂ox_inventory
        • qb-inventory
        • qb-inventoryv2
        • origen_inventory
        • ps-inventory
        • jpr-inventory
        • qs-inventory
      • Inventory Images
    • Exports
      • Server Exports
      • Client Exports
    • Backwards Events
      • Client Events
      • Server Events
    • FAQ
    • Commands
    • Snippet Examples
      • qb-vehicleshop
      • qb-garages
      • Common qb-core Snippets
  • MrNewbBeeKeeping
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory Images
      • Inventory
        • 🐂ox_inventory
  • MrNewbPrescriptions
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • 🐂ox inventory
        • qs-inventory
        • qb-inventory V1
        • qb-inventory v2
      • Inventory Images
    • Exports
      • Server Exports
      • Client Exports
    • Snippet Examples
      • qb-drugs
      • qbx_ambulancejob
    • FAQ
  • MrNewbPlateCarriers
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • 🐂ox_inventory
        • qb-inventoryv2
      • Inventory Images
    • Exports
      • Server Exports
  • MrNewbCustomPlates
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • ox_inventory Steps
      • Inventory Images
  • MrNewbNameChanger
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory
        • 🐂ox_inventory
        • ps-inventory
        • qb-inventoryv2
        • qb-inventory
      • Inventory Images
  • MrNewbPawn
    • Install
  • MrNewbPhoneTracker
    • Install
      • Frameworks
        • qb-core
        • qbox
        • ESX
      • Inventory Images
      • Inventory
        • 🐂ox_inventory
  • MrNewbWeaponTints
    • Install
      • inventory
        • ox_inventory Steps
      • Inventory Images
  • MrNewbGiftBox
    • Install
      • Framework
        • qb-core
        • qbox
        • ESX
      • inventory
        • ox_inventory Steps
      • Inventory Images
    • Exports
      • Server Exports
Powered by GitBook
On this page
  1. MrNewbPrescriptions
  2. Snippet Examples

qb-drugs

This is a example of the CreatePrescription export, this will allow you to add the data to items via metadata that can be used and have effects.

local function givePrescriptionMed(src)
    local random = math.random(1,100)
    local luck = 50
    if random >= luck then return end
    local meds = {
	name = 'zombix',
	usableitem = 'zombix',
	uses = 3,
	label = 'Zombix 250 MG',
	description = 'Zombix 250 MG',
	price = 500,
	icon = 'fa-solid fa-briefcase-medical',
	effect = 'stamina',
	value = 1.4,
	timecycle = 'drug_wobbly',
	strength = 0.56,
	time = 30,
    }
    exports.MrNewbPrescriptions:CreatePrescription(src , meds)
end

RegisterNetEvent('qb-drugs:server:giveStealItems', function(drugType, amount)
    local src = source
    local Player = QBCore.Functions.GetPlayer(src)
    if not Player or StolenDrugs == {} then return end
    for k, v in pairs(StolenDrugs) do
        if drugType == v.item and amount == v.amount then
            givePrescriptionMed(src)
            exports['qb-inventory']:AddItem(src, drugType, amount, false, false, 'qb-drugs:server:giveStealItems')
            table.remove(StolenDrugs, k)
        end
    end
end)
PreviousSnippet ExamplesNextqbx_ambulancejob

Last updated 6 months ago