Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lib.locale()
- local ver = '1.0.0'
- CreateThread(function()
- if GetResourceState(GetCurrentResourceName()) == 'started' then
- print('DRC_DRUGS STARTED ON VERSION: ' .. ver)
- end
- end)
- if Config.Framework == "ESX" then
- ESX = nil
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- elseif Config.Framework == "qbcore" then
- QBCore = nil
- QBCore = exports['qb-core']:GetCoreObject()
- elseif Config.Framework == "standalone" then
- -- ADD YOU FRAMEWORK
- end
- function BanPlayer(source, message)
- if Config.AnticheatBan then
- --Example of usage for SQZ ANTICHEAT (Higly recommended Anticheat!)
- exports['sqz_anticheat']:BanPlayer(source, message)
- end
- end
- local webhook = "YOUR_WEBHOOK"
- function Logs(source, message)
- if message ~= nil then
- if Config.Logs.enabled then
- local license = nil
- for k,v in pairs(GetPlayerIdentifiers(source))do
- if string.sub(v, 1, string.len("license:")) == "license:" then
- license = v
- end
- end
- if Config.Logs.type == "ox_lib" then
- lib.logger(source, "Drugs", message)
- elseif Config.Logs.type == "webhook" then
- local embed = {
- {
- ["color"] = 2600155,
- ["title"] = "Player: **".. GetPlayerName(source) .." | License: " .. license .. " **",
- ["description"] = message,
- ["footer"] = {
- ["text"] = "Logs by DRC SCRIPTS for DRC DRUGS!",
- },
- }
- }
- PerformHttpRequest(webhook, function(err, text, headers) end, 'POST', json.encode({username = "DRC DRUGS", embeds = embed, avatar_url = "https://i.imgur.com/RclET8O.png"}), { ['Content-Type'] = 'application/json' })
- end
- end
- end
- end
- function GetMoney(count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- if xPlayer.getMoney() >= count then
- return true
- else
- return false
- end
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- if xPlayer.Functions.GetMoney('cash') then
- return true
- else
- return false
- end
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- function RemoveMoney(count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- xPlayer.removeMoney(count)
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- xPlayer.Functions.RemoveMoney('cash', count)
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- function AddMoney(count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- xPlayer.addMoney(count)
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- xPlayer.Functions.AddMoney('cash', count)
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- function GetItem(name, count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- if xPlayer.getInventoryItem(name).count >= count then
- return true
- else
- return false
- end
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- if xPlayer.Functions.GetItemByName(name) ~= nil then
- if xPlayer.Functions.GetItemByName(name).amount >= count then
- return true
- else
- return false
- end
- else
- return false
- end
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- function AddItem(name, count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- xPlayer.addInventoryItem(name, count)
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- xPlayer.Functions.AddItem(name, count, nil, nil)
- TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[name], "add", count)
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- function RemoveItem(name, count, source)
- if Config.Framework == "ESX" then
- local xPlayer = ESX.GetPlayerFromId(source)
- xPlayer.removeInventoryItem(name, count)
- elseif Config.Framework == "qbcore" then
- local xPlayer = QBCore.Functions.GetPlayer(source)
- xPlayer.Functions.RemoveItem(name, count, nil, nil)
- TriggerClientEvent("inventory:client:ItemBox", source, QBCore.Shared.Items[name], "remove", count)
- elseif Config.Framework == "standalone" then
- -- ADD YOUR FRAMEWORK
- end
- end
- lib.callback.register('drc_drugs:getpolice', function(source)
- local policeCount = 0
- if Config.Framework == "ESX" then
- local xPlayers = ESX.GetPlayers()
- for i = 1, #xPlayers do
- local xPlayer = ESX.GetPlayerFromId(xPlayers[i])
- for _, job in pairs(Config.PoliceJobs) do
- if xPlayer.job.name == job then
- policeCount = policeCount + 1
- end
- end
- end
- return policeCount
- elseif Config.Framework == "qbcore" then
- local xPlayers = QBCore.Functions.GetPlayers()
- for i = 1, #xPlayers do
- local xPlayer = QBCore.Functions.GetPlayer(xPlayers[i])
- for _, job in pairs(Config.PoliceJobs) do
- if xPlayer.PlayerData.job.name == job then
- policeCount = policeCount + 1
- end
- end
- end
- return policeCount
- elseif Config.Framework == "standalone" then
- -- ADD YOU FRAMEWORK
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement