gdot336
Gold Elite
- Joined
- Jun 7, 2021
- Messages
- 86
- Reaction score
- 560
- Points
- 296
ESX:
Hidden link for visitors, to see
Log in or register now.
QB:
Hidden link for visitors, to see
Log in or register now.
STREETCODE DRUG NETWORK
A Persistent Customer Network Built for FiveM
StreetCode Drug Network turns drug sales into a server-wide customer network instead of a basic NPC sell interaction.Customers persist in SQL, have their own identities, locations, ped models, personalities, cooldowns, and dealer history.
And most importantly:
Customers can move between dealers.
A customer who doesn't get the deal they want from one player can continue looking for another available dealer.
SERVER-WIDE CUSTOMER NETWORK
Customers aren't permanently attached to one player.The system tracks which dealers a customer has successfully dealt with, including drug-specific history.
That means the same customer can build relationships with multiple dealers across your server.
The customer's dealer history is stored by:
- Customer
- Dealer
- Drug
- Last price
- Total completed deals
- Last deal
7 CUSTOMER PERSONALITIES
Every customer is assigned a personality when created.LOYAL
Prefers dealers they've dealt with before.CHEAP
Looks at previous prices and favors known dealers with lower recorded prices.SPENDER
More willing to try new dealers.HAGGLER
More likely to shop around between dealers.DESPERATE
Less concerned with dealer history and more focused on finding someone available.PICKY
Favors dealers with stronger completed-deal history.REGULAR
Balanced customer behavior.These personalities actually affect which dealer the customer chooses, rather than being cosmetic labels.
COMPETITIVE DRUG PRICING
Customer history is separated by drug.A customer's previous cocaine price isn't automatically treated as their previous weed, meth, or other drug price.
The dealer-history lookup specifically filters by the requested item.
This allows customers to develop different pricing histories with different dealers for different products.
CUSTOMER NEGOTIATION
When a customer contacts a dealer, the request contains:- Drug
- Quantity
- Current offer
- Previous dealer information when applicable
ACCEPT
DECLINE
COUNTER OFFER
If a player declines, the customer can move on to another available dealer.
If a player makes a counteroffer the customer won't accept, the customer can continue shopping.
The system also keeps track of previous dealers and prices during that negotiation.
IMMERSIVE CUSTOMER CALLS
Customers don't immediately throw the negotiation menu onto the player's screen.The customer first initiates an incoming call.
Players get:
H — Answer
G — Decline
Answering transitions into the actual customer negotiation.
Declining or missing the call ends the interaction appropriately.
CUSTOM RINGTONES
Players can customize the ringtone used for customer calls.Simply use:
/ringtone
Bring your own ringtone.
REAL CUSTOMER MEETUPS
Accepting a deal doesn't instantly complete the sale.The customer creates an active meetup containing:
- Customer ID
- Requested drug
- Amount
- Agreed price
- Customer name
- Meetup expiration
Players physically travel to the customer and complete the transaction at the meetup.
CUSTOM CUSTOMER NPCs
Admins can create customers directly in-game.Example:
/createcustomer male Marcus Bell
or:
/createcustomer female Nicole Harris
The system:
- Uses the selected gender
- Randomly selects a configured customer ped
- Randomly assigns a personality
- Uses the admin's current location
- Stores the customer server-side
PERSISTENT CUSTOMER LOCATIONS
Customers aren't just temporary peds.Their:
- Name
- Ped model
- Personality
- Coordinates
- Heading
- Cooldown
When players are near a customer, the NPC is streamed in; when they're far away, the customer is removed from the local world and can be spawned again when needed.
CUSTOMERS ACTUALLY SHOP AROUND
A customer can:Contact Dealer A
↓
Dealer A declines
Contact Dealer B
↓
Dealer B counteroffers too high
Contact Dealer C
The system prevents the customer from repeatedly contacting the same dealer during that negotiation and avoids dealers who are already handling another active meetup.
That creates an actual server-wide market, rather than every player having their own isolated NPC sellers.
SQL PERSISTENCE
Customers and dealer relationships are stored in SQL.The relationship table records:
- Customer
- Dealer identifier
- Dealer name
- Drug
- Last price
- Total deals
- Last deal
So the customer network isn't simply reset every time the resource restarts.
SERVER-SIDE VALIDATION
The actual transaction is handled server-side.The server verifies:
- The player is the current dealer
- The customer exists
- The meetup exists
- The player is close enough to the customer
- The requested item
- The requested quantity
- Player inventory
POLICE ALERT SYSTEM
The script also supports a configurable police-alert chance.When an alert is triggered, the police-side client can receive the customer's location and set a waypoint for the response. The current implementation checks the player's ESX job before displaying the alert waypoint.
THE CORE IDEA
StreetCode isn't just:NPC → Sell → Money
It's:
CUSTOMER → CALL → NEGOTIATION → DEAL → MEETUP → TRANSACTION → HISTORY
And that history feeds back into the customer's future dealer selection.The more your server uses it, the more interconnected the customer network becomes.