This Script is a drug selling script and all configs are merely examples/demonstrations of its capacity to allow for an in depth selling system. PLEASE edit the configs to drugs you have in your server following the guidelines below.
1. Introduction
Envi-Trap is a comprehensive drug dealing system for FiveM servers. It offers a wide range of customizable features to create a realistic and immersive drug dealing experience, centered around a virtual "trap phone" interface.
Config Previews
2. Debug Mode
Debug mode can be enabled for testing purposes:
Config.Debug = false
IMPORTANT: This should never be enabled on a live server.
When debug mode is enabled, you can use the following commands:
/SpawnTestSnitch: Spawns a snitch NPC at your location
/GiveTestPhone: Registers and gives you a trap phone with test data
The script defines various ped types and their behaviors, including snitches, police informants, and blacklisted peds. Personality types are also defined for different ped groups.
13. Gang and Zone Settings
The script includes a comprehensive gang system with features such as:
Configurable gang models and behaviors
Relationship levels with the player
Gang-specific weapons
Options for paying for protection
Zone settings allow you to define gang-controlled areas.
14. Special Contact Settings
The script includes a system for special contacts or "plugs" located around the map. These contacts are defined with names, phone numbers and attributes.
15. Virtual Trap Phone
Players can acquire a virtual trap phone item (Config.TrapPhoneItem) which serves as the primary interface for drug dealing activities.
16. Phone UI
Config.UsePhoneUI = true
If enabled, it provides a custom user interface for the trap phone. If disabled, it falls back to using ox_lib menus for interactions.
17. Data Storage
Config.UniqueMetadataPhones = true
This setting determines whether data is stored in the item's metadata or in a database linked to the player's identifier.
18. Messaging System
Config.MaximumMessages = 50
The system stores a limited number of messages and automatically deletes the oldest messages to prevent database clutter.
19. Time-based Sales Restrictions
Each drug has a timeBetweenSales setting that implements cooldown periods between sales for that specific drug type.
20. Quality Ratings
The system implements drug quality or purity ratings, affecting prices and desirability. This can be configured for each drug or special contact.
21. Scales for Drug Weights
The scales system allows for flexible and realistic drug weight conversions:
The 'label' field must match across all weight types for a specific drug.
The system supports four weight types: 'gram', 'quarter-ounce', 'ounce', and 'kilo'.
Include all weight types up to the highest weight you want to use for each drug.
The 'amountType' field specifies which weight category that particular item represents.
Example configuration:
['cokebaggy'] = { -- Item Name
label = 'Coke', -- MUST MATCH OTHER QUANTITIES IN amountType
basePrice = 125,
minPrice = 100,
maxPrice = 150,
maxSale = 5,
amountType = 'gram', -- Type of amount (gram, quarter-ounce, ounce, kilo) -- See docs for more info on Scales and Quantities
-- Prop Settings
prop = 'p_meth_bag_01_s',
propOffset = vec3(0.0, 0.0, 0.0),
propRot = vec3(0.0, 320.0, 0.0),
-- Animation Settings
largePackage = false, -- if the prop is a large package or not (to choose the correct animation)
highDemandZones = {0, 1, 2, 3}, -- Zones where the drug is in high demand -- See zoneSettings.lua for ZoneWealth
-- NEW --
soldToNpcs = true, -- If true, the drug can be sold to NPCs
timeBetweenSales = 120, -- Time in SECONDS until the next sale can be made
},
['coke_7g'] = { -- Item Name
label = 'Coke', -- MUST MATCH OTHER QUANTITIES IN amountType
basePrice = 850,
minPrice = 700,
maxPrice = 1050,
maxSale = 3,
amountType = 'quarter-ounce', -- Type of amount (gram, quarter-ounce, ounce, kilo) -- See docs for more info on Scales and Quantities
-- Prop Settings
prop = 'p_meth_bag_01_s',
propOffset = vec3(0.0, 0.0, 0.0),
propRot = vec3(0.0, 320.0, 0.0),
-- Animation Settings
largePackage = false, -- if the prop is a large package or not (to choose the correct animation)
highDemandZones = {1, 2, 3}, -- Zones where the drug is in high demand -- See zoneSettings.lua for ZoneWealth
-- NEW --
soldToNpcs = false, -- If true, the drug can be sold to NPCs
timeBetweenSales = 120, -- Time in SECONDS until the next sale can be made
},
['coke_1oz'] = {
label = 'Coke', -- MUST MATCH OTHER QUANTITIES IN amountType
basePrice = 3500,
minPrice = 2800,
maxPrice = 4200,
maxSale = 2,
amountType = 'ounce', -- Type of amount (gram, quarter-ounce, ounce, kilo) -- See docs for more info on Scales and Quantities
-- Prop Settings
prop = 'hei_prop_hei_drug_pack_01b',
propOffset = vec3(0.0, -0.05, -0.1),
propRot = vec3(0.0, -0.05, 0.0),
-- Animation Settings
largePackage = true,
highDemandZones = {2, 3, 4}, -- Zones where the drug is in high demand -- See zoneSettings.lua for ZoneWealth
-- NEW --
soldToNpcs = false, -- If true, the drug can be sold to NPCs
timeBetweenSales = 120, -- Time in SECONDS until the next sale can be made
},
['coke_brick'] = {
label = 'Coke', -- MUST MATCH OTHER QUANTITIES IN amountType
basePrice = 350000,
minPrice = 397600,
maxPrice = 596400,
maxSale = 2,
amountType = 'kilo', -- Type of amount (gram, quarter-ounce, ounce, kilo) -- See docs for more info on Scales and Quantities
-- Prop Settings
prop = 'hei_prop_hei_drug_pack_01b',
propOffset = vec3(0.0, -0.05, -0.1),
propRot = vec3(0.0, -0.05, 0.0),
-- Animation Settings
largePackage = true,
highDemandZones = {2, 3, 4}, -- Zones where the drug is in high demand -- See zoneSettings.lua for ZoneWealth
-- NEW --
soldToNpcs = false, -- If true, the drug can be sold to NPCs
timeBetweenSales = 120, -- Time in SECONDS until the next sale can be made
},
22. XP/Special Contacts System
The XP system is designed to be secret, creating a more immersive experience:
XP is tied to specific trap phones, not players.
Gain or lose XP based on drug sales outcomes.
Leveling up becomes more challenging over time.
To level up, you need 1000 x (current level) XP in a specific drug.
Special contacts are encountered randomly upon leveling up.
Special Contacts
Three types of special contacts are available:
The Plug: Sells large quantities of drugs directly to the player.
Zone Info Contact: Provides detailed information about any zone.
Gang Leader: Influences gang relationships and offers unique opportunities.
Example plug setup:
[1] = {
name = 'Cletus', -- Name of the contact
pedModel = 'ig_cletus',
faceVariation = false,
number = '55501281415',
special = 'plug', -- 'plug' or 'zone_info or 'gang_leader' -- [ MORE COMING SOON! ] --
gang = nil,
specialItem = 'weed_brick',
specialLabel = 'Weed',
specialItemLabel = 'Kilos of Weed',
specialItemAmount = 'kilo',
specialMax = 1,
specialPrice = 200000,
quality = false,
},
[2] = { -- EXAMPLE OF A PLUG CONTACT
name = 'Rashkovsky', -- Name of the contact
pedModel = 'ig_rashcosvki',
faceVariation = false,
number = '55501481426',
special = 'plug', -- 'plug' or 'zone_info or 'gang_leader' -- [ MORE COMING SOON! ] --
gang = nil,
specialItem = 'coke_brick',
specialLabel = 'Coke',
specialItemLabel = 'Kilos of Coke',
specialItemAmount = 'kilo',
specialMax = 1,
specialPrice = 270000,
quality = false,
},
[3] = {
name = 'Salton', -- Name of the contact
pedModel = 'a_m_m_salton_03',
faceVariation = false,
number = '55508235124',
special = 'plug', -- 'plug' or 'zone_info or 'gang_leader' -- [ MORE COMING SOON! ] --
gang = nil,
specialItem = 'meth_brick',
specialLabel = 'Meth',
specialItemLabel = 'Kilos of Meth',
specialItemAmount = 'kilo',
specialMax = 1,
specialPrice = 340000,
quality = false,
},
Please note: These items were used as placeholders during development. The script is designed for you to set these items to be existing drug items within your server to provide your players with a unique experience. You only need to add these items if you do not want to set the config up yourself and instead want to use basic items that we used for testing. Please be aware these testing items with have no effects and that will need to be handled via another script.
["coke_7g"] = {
label = "7g Bag of Coke",
weight = 0,
stack = true,
close = true,
description = "To get happy real quick",
},
["coke_1oz"] = {
label = "1oz of Coke",
weight = 0,
stack = true,
close = true,
description = "To get happy real quick",
},
["weedbaggy"] = {
label = "Weed Bag",
weight = 0,
stack = true,
close = true,
description = "Bag of Weed",
},
["weed_7g"] = {
label = "Quarter of Weed",
weight = 0,
stack = true,
close = true,
description = "7g Bag of Weed",
},
["weed_1oz"] = {
label = "1 ounce of Weed",
weight = 0,
stack = true,
close = true,
description = "7g Bag of Weed",
},
["meth_7g"] = {
label = "7g of Meth",
weight = 0,
stack = true,
close = true,
description = "7g Bag of Meth",
},
["meth_1oz"] = {
label = "1 Ounce of Meth",
weight = 0,
stack = true,
close = true,
description = "1 Ounce of Meth",
},
["coke_7g"] = {
name = 'coke_7g',
label = "7g Bag of Coke",
weight = 0,
type = 'item',
image = 'coke_7g.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "To get happy real quick",
},
["coke_1oz"] = {
name = 'coke_1oz',
label = "1oz of Coke",
weight = 0,
type = 'item',
image = 'coke_1oz.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "To get happy real quick",
},
["weedbaggy"] = {
name = 'weedbaggy',
label = "Weed Bag",
weight = 0,
type = 'item',
image = 'weedbaggy.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "Bag of Weed",
},
["weed_7g"] = {
name = 'weed_7g',
label = "Quarter of Weed",
weight = 0,
type = 'item',
image = 'weed_7g.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "7g Bag of Weed",
},
["weed_1oz"] = {
name = 'weed_1oz',
label = "1 ounce of Weed",
weight = 0,
type = 'item',
image = 'weed_1oz.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "7g Bag of Weed",
},
["meth_7g"] = {
name = 'meth_7g',
label = "7g of Meth",
weight = 0,
type = 'item',
image = 'meth_7g.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "7g Bag of Meth",
},
["meth_1oz"] = {
name = 'meth_1oz',
label = "1 Ounce of Meth",
weight = 0,
type = 'item',
image = 'meth_1oz.png',
unique = false,
shouldClose = true,
combinable = nil,
description = "1 Ounce of Meth",
},
coke_7g = { name = 'coke_7g', label = "7g Bag of Coke", weight = 0, type = 'item', image = 'coke_7g.png', unique = false, shouldClose = true, combinable = nil, description = "To get happy real quick" },
coke_1oz = { name = 'coke_1oz', label = "1oz of Coke", weight = 0, type = 'item', image = 'coke_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "To get happy real quick" },
weedbaggy = { name = 'weedbaggy', label = "Weed Bag", weight = 0, type = 'item', image = 'weedbaggy.png', unique = false, shouldClose = true, combinable = nil, description = "Bag of Weed" },
weed_7g = { name = 'weed_7g', label = "Quarter of Weed", weight = 0, type = 'item', image = 'weed_7g.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Weed" },
weed_1oz = { name = 'weed_1oz', label = "1 ounce of Weed", weight = 0, type = 'item', image = 'weed_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Weed" },
meth_7g = { name = 'meth_7g', label = "7g of Meth", weight = 0, type = 'item', image = 'meth_7g.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Meth" },
meth_1oz = { name = 'meth_1oz', label = "1 Ounce of Meth", weight = 0, type = 'item', image = 'meth_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "1 Ounce of Meth" },
coke_7g = { name = 'coke_7g', label = "7g Bag of Coke", useable = true, weight = 0, type = 'item', image = 'coke_7g.png', unique = false, shouldClose = true, combinable = nil, description = "To get happy real quick" },
coke_1oz = { name = 'coke_1oz', label = "1oz of Coke", useable = true, weight = 0, type = 'item', image = 'coke_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "To get happy real quick" },
weedbaggy = { name = 'weedbaggy', label = "Weed Bag", useable = true, weight = 0, type = 'item', image = 'weedbaggy.png', unique = false, shouldClose = true, combinable = nil, description = "Bag of Weed" },
weed_7g = { name = 'weed_7g', label = "Quarter of Weed", useable = true, weight = 0, type = 'item', image = 'weed_7g.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Weed" },
weed_1oz = { name = 'weed_1oz', label = "1 ounce of Weed", useable = true, weight = 0, type = 'item', image = 'weed_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Weed" },
meth_7g = { name = 'meth_7g', label = "7g of Meth", useable = true, weight = 0, type = 'item', image = 'meth_7g.png', unique = false, shouldClose = true, combinable = nil, description = "7g Bag of Meth" },
meth_1oz = { name = 'meth_1oz', label = "1 Ounce of Meth", useable = true, weight = 0, type = 'item', image = 'meth_1oz.png', unique = false, shouldClose = true, combinable = nil, description = "1 Ounce of Meth" },
25. Persistent Relationships
If you feel that your getting a little to much attention from the gangs there are a few settings you can alter.
This controls whether or not relationships are always active or not. If false you wont get any issues from gangs unless you have been selling this session.
Config.PersistantRelationships = true -- false = The relationship will only apply when you have been selling drugs this session. Otherwise, gangs will act normal. - (Better for optimization)
-- true = The relationship will always apply, even if you haven't sold drugs to this anyone this session. - (Better for realism)
-- Current Relationship = 4 - Will attack you when you are selling. 5 - Will attack you on sight.
This is the default relationship settings. Alter the default = math.random(3,4)
Alter the math.random to your likings. we recommend math.random(2,3)
This is per gang in gangZoneSettings.lua
relationship = {
default = math.random(3,4), -- Default relationship with this Gang. (Random for more variety!)
-- Set all to 3 to make all gangs neutral.
-- [[ 1 = Respect, 2 = Like, 3 = Neutral, 4 = Dislike, 5 = Hate ]]
minimum = 1, -- Minimum relationship with this Gang.
maximum = 5, -- Maximum relationship with this Gang.
},
26. Additional Information
Future updates will introduce more special contacts, enhancing the dynamic nature of the game world.
Remember to adjust these settings carefully to balance your server's gameplay experience. This comprehensive documentation covers the main features of the Envi-Trap system, providing both server administrators and players with a detailed understanding of its capabilities and configuration options.