ai-drugs
Street drug sales to strangers, switched on from the radial menu, and weed plants that grow over time and are saved in the database.
ai-drugs gives players two ways to make money with drugs: selling to strangers on the street, and growing weed. The server decides every sale (price, refusal, police alert), and plants are saved in the database, so they keep growing through restarts.
What it does in the game
Street sales
- Open the radial menu and pick Sell drugs to start looking for buyers. Pick it again to stop.
- While selling, a stranger from nearby walks up to you. A Sell to the stranger prompt appears when they stand next to you.
- The server picks one drug you carry from the panel's list, a count and a price in that drug's range. The buyer may refuse (Refuse chance). The money goes to the panel's money account.
- A sale may alert the police (Police alert chance). Nobody buys while fewer than Police needed officers are on duty.
A player cannot sell more often than Time between sales, and the same stranger does not buy again for 10 minutes.
Weed plants
- Use a
weed_seedoutside to plant a weed plant. Plants cannot stand within 2 m of each other, and one character can have at most Plants per character plants. - The plant grows over Growing time: a young prop, a growing prop from 40 %, a ready prop at the end. The prompt shows the growth in percent.
- Anyone can harvest a ready plant: a progress bar, then a random number of
weed_budbetween Buds from and Buds up to. - On-duty police can destroy a growing plant.
- A ready plant that nobody harvests disappears after Rots after.
Installation
Installed by the AI Core recipe. By hand: ensure ai-drugs after ensure ai-core. It needs ai-core and OneSync.
- It stores plants in its own table
ai_drugs_plants, created at start. It needs its database permission line inenv.cfg:
add_convar_permission ai-drugs read mysql_connection_string- Items used by the defaults:
weed_seed(usable),weed_bud,coke_baggy,meth_baggy. ai-inventory has them; with another inventory, add them or change the panel. - The Sell drugs item shows on whichever radial menu AI Core supports.
Panel settings
Admin panel > Drugs. Defaults come from data/settings.json and data/plants.json. The Street sales and Weed plants settings stay on the server.
Street sales tab
Players sell to strangers after turning selling on in the radial menu.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Drugs | Up to 30 rows, each an Item with Price from and Price up to (0-1,000,000). A sale is priced between the two. | $ | weed_bud $40-80, coke_baggy $90-160, meth_baggy $120-200 |
| Time between sales | One player cannot sell more often than this. 1-600. | s | 10 |
| Refuse chance | Chance a buyer says "Not interested". 0-100. | % | 20 |
| Police alert chance | Chance that a sale alerts on-duty police. 0-100. | % | 20 |
| Police needed | On-duty officers needed before anyone buys. 0-32. | 0 | |
| Police jobs | On-duty members count as police and can destroy plants. Up to 10. | police | |
| Money account | Sale money goes to this account. | cash |
Weed plants tab
Anyone can harvest a ready plant; police destroy growing ones.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Growing time | How long a plant takes to be ready. 1-10,080. | min | 60 |
| Rots after | A ready plant nobody harvests disappears after this long. 1-10,080. | min | 120 |
| Plants per character | How many plants one character can have at once. 0-100. | 5 | |
| Buds from | Fewest buds per harvest. 1-100. | 3 | |
| Buds up to | Most buds per harvest. 1-100. | 8 | |
| Seed item | Using this item plants a weed plant. A new item works at once. | weed_seed | |
| Harvest item | A ready plant gives this item. | weed_bud |
Plant look tab
The props players see while a plant grows.
| Setting | What it changes | Unit | Default |
|---|---|---|---|
| Young plant | Prop until 40 % growth. | bkr_prop_weed_01_small_01c | |
| Growing plant | Prop from 40 %. | bkr_prop_weed_med_01a | |
| Ready plant | Prop when it can be harvested. | bkr_prop_weed_lrg_01a | |
| Draw distance | Plants further away than this have no prop. 20-300. | m | 100 |
Commands
None.
Keybinds
None. Selling starts from the radial menu (Sell drugs). Buyers and plants use prompts (E by default).
What it stands in for
No fxProvide. It does not answer another drug script's exports or events.
Compatible scripts
Items go through AI Core's inventory layer, police alerts through the dispatch layer, the sell switch through the radial layer. Any inventory, alert script and radial menu AI Core supports works (see Compatibility).
Known limits
- Only weed grows; coke and meth are sold, not made.
- Growth is time only: there is no water or fertilizer.
- Log channel:
drugs.