Exports
All drugs used for server exports needs to be previously registered in server/editable/_drugs.lua > Config.Drugs table, otherwise you won't be able to see them in the APP.
getStrain
returns strain name or false if not found.
params:
playerId
number
local strain = exports['av_drugs']:getStrain(playerId)
if strain then print(strain) endgetDrug
returns a specific drug info.
if no drug name is specified it will return all drugs table or false if nothing found.
params:
playerId
numberdrug
string or false (optional)
local drugInfo = exports['av_drugs']:getDrug(playerId, drug)
if drugInfo then
print(json.encode(drugInfo, {indent = true}))
--[[
example without defining drug name:
{
"drug1": {
"income": 0,
"sold": 0,
"label": "Drug Label",
"name": "drug1",
"xp": 0
},
"drug2": {
"xp": 0,
"label": "Drug Label",
"name": "drug2"
}
}
]]--
endaddZoneRep
Adds reputation for a specific strain and drug in a zone, all param values are needed or it will return false, returns true if rep was added.
params:
zone
stringstrain
stringdrug
stringbags
numberZone names can be found here: https://docs.fivem.net/natives/?_0x98CD1D2934B76CC1
addXP
Add drug XP to a specific player, returns true if added
If the drug doesn't exist in the Player table it will add it, if is a custom drug from your own script make sure to register it first in Config.Drugs.
params:
playerId
numberdrugName
stringxp
number
removeXP
Remove drug XP from a specific player, returns true if removed.
params:
playerId number
drugName string
xp number
Last updated