Installation


8d1d102f88ecb06bac5cb4481a356d134c4fc5e5.png

Installation and setup guide

Download script zip. Unzip and find the folder containing all the files (not a folder containing a single folder). Place this folder in your resources and ensure that it will be ensured in your server.cfg (Can either ensure the folder this resource is within or the resource itself).

Requirements are ox_lib so confirm you have that running


Setting your item names and images

You can now start creating drug items.  You may need to do some renaming according to the names you have in your core (or ox_inventory) items list. 


In this variants list you can define the different item names for various drugs. Sometimes you have multiple drug items (different qualities perhaps) that all sell as the same drug (quality does get taken into account elsewhere)

5140eabc2daa8df981fde9a42a8fc5d6f79598e6.png

The names in these list need to be identical to the names in your items list.


For example if I want to add meth to my drugs. I find it in my ox_inventory list and then copy the index

85d21c308f5cf5e01e869c39ec242fff38996034.png

If I am using a system more like QBCore I will copy the name from the items list and it will be from the name attribute of the object 

d6a078297913b5999a4e59373bd12a259e98cdd7.png

While you are finding this name, also ensure that the item has an image associated with it. This image name which appears like "meth.png" or "oxy.png" is the same name the script will use when finding the images for the menu. 


Grab the images

In ox_inventory the images are located under ox_inventory>web>images. Copy all images you need and paste them in my resource under jack-drugselling>web>public. Leave the names unchanged.


Creating Drug items

This list defines all the sellable drugs. The index of each entry should exist under DRUGNAMES at the top of the config. This is just an Enum used to make accessing these names in script easier. If you want to add a new drug not in this list you can add it to the DRUGNAMES and use it in the same ways.

abab2b31e268c193f27dd09c129e708f4359ce46.png

Each drug needs a prop model, a base price, and a category.


Drug purity can be set according to different versions of a drug (base_cocaine, pure_cocaine) or by a metadata on the item. Left untouched all will have AveragePurity and the system wont affect the price

0d6146198d42384bc852170ccbd4a1b42ae9e793.png







6bdd73e8f4b5c086c4fc7797b5c20190eac202fb.png


Installation and Setup guide


Installation

After downloading my mod you will have 3 resources.

  • jack-bankrobbery (Escrowed)
  • jack-ai_lib (Escrowed)
  • jack-objectspawner_lib (Open source)

These can be put into any folder. If there's  a question of ensure order, it should be jack-objectspawn_lib -> jack-ai_lib -> jack-bankrobbery


Items

You may need to add some items to your ox_inventory > data > items list. I have included their structure at the top of the config.

  • thermite
  • drill 
  • security card
  • deposit box key

cef09a474f4d64d1e5bf859100428e8cef2d43ce.png


Dev Tools

/bankConfigEditor will show a entity raycast that lets you see AI state/task and also gizmos move objects.
668e8b38b7045c32924388ee15084af83c6a4afc.png05bd9260685ab9ea778123540f6093b071d26186.pngf918aaff6678300cc0a6f6d4e5cdbb83d2334ed5.png

Save to config will open an ox_lib input dialog prompting you to type a object index and subindex
78905d1040de59b05ece80bf13c5b8efc47fdc6d.png
This is used to find the object in the bank you are in and copy the other associated data so it can all be copied to your clipboard. For example if I want to change the door police barrier rotation I would type
policeClosedProps
doorTape
f8f93dd84881b88db10e022cbb4bdf883cf487fb.png

See the tutorial for expanding details here


Zone setup

(Enable the Config.DebugPoly to see zones and debug lines and print statements)

Depending on the MLO you are using (or none) you may have to adjust some objects or move some zones. I've created a tutorial explaining the bank creation process from scratch. TLDR is there is a dev command 'bankConfigEditor' that allows you to use gizmos on any object and then save that objects position and rotation data to your clipboard to paste into the config. This allows you to tweak positions of objects. 


Bridge (Framework support)

The resource is made to support qbx core but can easily be changed thanks to the exposed bridge functions. See the available functions below

5847b5e138f3f5c9c9f5d9482c67c1f7e158d674.png
https://imgur.com/a/QDp8Wkw

To support whatever framework you are using, modify the body of these functions accordingly. Do not change the parameters given as they are required by my code. 


Logging and Locales

Logging

Various logging functions are exposed (called when key events like getting rewards, leaving banks, police close occur). These are available:
40cd9a8eeecb7aa6509649cb33c80383d2b26a74.png
https://imgur.com/a/b2F3pVN

Locales

Locales exist under a folder and can be toggled using ox_lib methods.


Alerts and Minigames

All minigames for interactions can be modified. As long as the function returns a true or false depending on result of minigame.
(Currently using boii-minigames)
3d902bd005bae64f5a7875ea672813d6e8240c9e.png

https://imgur.com/a/2MGoOiY


Alert is found at the top of this file, this function is called once when the bank enters the 'Event_Occuring' state



Balancing

Plenty of payouts and loot tables will need to be modified to fit the economy of your server. Please keep the same format / structure so my code knows how to read it. 


282feb418c1ad8b275b4b971d1eef01e8efc7239.png


In this snippet, the curly brackets {x, y} indicate a range that a random function will use when determining the amount of a reward.


b730b8873324546de23a7d6982ac887db9dabbd1.png


In this snippet, ["itemname"] is the same as the previous but now it equals a single number (no randomness)


fc69c5839463aad6204b1c3c25d43265dccf7069.png


In this snippet there is [1] and [2], this is the same as the curly brackets {x, y} that means randomness. [1] being the lower limit and [2] being the upper. 


State bag rate limit

2a344083f80a59648925bbcaefba0533ef9a4b12.png

If you run into weird consistency errors between clients or at all, a potential issue is the statebag rate limit.

You can view your current limits using these commands
13f6bd1e02ef900912a3cf21d8f7a53c68df7a28.png
/rateLimiter_arrayUpdate_burst
/rateLimiter_arrayUpdate_rate
/rateLimiter_getinfo_burst
/rateLimiter_getinfo_rate
/rateLimiter_http_info_burst

You can set these inside of the tx_admin console
set rateLimiter_stateBag_rate 20
set rateLimiter_stateBag_burst 80
set rateLimiter_getinfo_rate 40
set rateLimiter_stateBagSize_rate 16000

I believe what works best is setting the statebag rate to 20-40 and the burst to 80 (i think thats default)
And setting the getinfo rate to 40

Again if you encounter issues txadmin may tell you, or you could just try raising these limits