K9 Force (k9_force)
A police K9 and guard dog: the pit bull, with a handset remote, attacks, vehicle and person searches, tracking, the kennel at Mission Row and its training room.
Runs on Qbox, QBCore and ESX. The framework is found by itself; everything framework-specific is in
bridge/client.lua and bridge/server.lua.
Needs
| Resource | Why |
|---|---|
ox_lib |
menus, notifications, callbacks |
ox_target |
the third eye on the dog, the kennel and the training room |
oxmysql |
saved dogs |
k9_force_map |
the kennel and training room map at Mission Row. The kennel fits the game's own garage behind the station's two side doors, and has been tried on the Gabz MRPD map only. A station map that leaves that garage as the game has it should take it; one that has rebuilt or filled the garage will not line up (leave it out and set Config.Kennel.enabled = false). To see what a server has at the spot, add setr k9_force_map_check 1 to server.cfg and use /k9check in game |
| an inventory | ox_inventory, or your framework's own (qb-inventory, the ESX inventory) |
Start order: your framework, ox_lib, oxmysql, ox_target, k9_force_map, then k9_force.
The dog (the pit bull) is in this resource's stream folder: nothing else to install for it.
Install
- Put the
k9_forcefolder in your resources and addensure k9_forceafter the resources above. - Nothing to add to your inventory: what handlers take at the K9 unit is kept by the script as their K9 gear
(
Config.Gear = { owned = true }), in the tablek9_force_gear. Only if you setowned = false, so that the leash, the remote and the accessories are carried inventory items again, add the items frominstall/: - ox_inventory:ox_inventory_items.luaintoox_inventory/data/items.lua- QBCore inventory:qbcore_items.luaintoqb-core/shared/items.lua- ESX inventory: runesx_items.sqlonce - the pictures ininstall/imagesgo in your inventory's image folder
Dog houses, bowls, dog food, water and toys have no inventory items either way: the script always keeps them.
3. Restart the server. The tables k9_force and k9_force_gear are made on first start.
Coming from qbx_pets: stop it and remove it from your server config. On first start this script copies every pit
bull out of the old qbx_pets table (the old table is left as it was). A leash, a remote or an accessory a handler still carries as an
inventory item moves into their K9 gear by itself the next time they are on.
The resource must keep the name k9_force: with owned = false the ox_inventory leash item names it in its export.
Who can use it
- Being issued a dog:
Config.Purchase(police job names, and the job typeleo). Empty lists = anyone. - K9 work (searches, tracking, the remote):
Config.K9.jobs/jobTypes. - Guarding and attacks:
Config.Guard.jobs/jobTypes(empty = everyone who has a dog). - The kennel:
Config.Kennel.jobs/jobTypes. - As it ships, all of these are set to the police jobs
police,sheriff,bcso,saspand the job typeleo: add your own police job names if they differ (ESX has no job types). - K9 gear (dog houses, bowls, toys):
Config.Props.jobs/jobTypes(empty = everyone).
ESX jobs have no type, so on ESX list your police jobs by name.
What handlers do
- The K9 unit (the officer beside the kennels at Mission Row, third eye; or
/k9): be issued a dog, take gear, bring a dog out, have a hurt dog treated. - K9 gear (
/k9props, or third eye on the dog > K9 actions > K9 gear, or "Open K9 gear" on the Gear page): the list of what you have. Dog houses, bowls, toys, the leash, the remote and accessories are issued once and owned; dog food and water are counted and used up. Gear cannot be handed to another player. - Third eye on the dog: follow, stay, sit, guard, attack a player, call off, tricks.
- The remote (
F9or/k9remote): pop the door beside the dog and it jumps out and comes to you, shut the door, attack, call off, back in the car. Each button sends its own tone. The remote is K9 gear (k9_remote): take one on the K9 unit's Gear page, or the key does nothing (Config.K9Remote.requireItem = falseturns that off). - With the K9 vest on: search a vehicle, sniff a person, track a scent (third eye, or
/k9search,/k9people,/k9track). - The kennel: third eye on a gate opens it, sends your dog in, or calls it out. A dog left in a bay is still there after a restart. The shelf feeds and waters the dog you have out.
- Dog houses and bowls (from your K9 gear): put down a dog house, a food bowl or a water bowl where you look, one
of each at a time (
Config.Props.limits). They stay there through restarts until you pick them up. Fill a bowl (one dog food, or one water) and call the dog to it; send the dog into a house and it is kept there like a dog in a kennel bay, lying inside for everyone until you call it out. From the server console,k9props_listshows every one that is out andk9props_clear <number | all>takes them away.Config.Props.requireItems = false: no gear is needed for any of this. - Toys (from your K9 gear): a tennis ball, rubber ball, spiky ball, rope tug, chew bone, flying disc, treat cone and a stick. With one in your hand: left click throws it (the dog fetches), G hands it to the dog, H plays tug with the rope, X puts it away, E picks one up off the ground. A dog in its muzzle cannot take a toy.
- The training room (through the door on the kennel's north wall): bite dummies, a runner on a rail, scent boxes and luggage.
/k9gear: the dog's Accessories menu (coat, collar, harness or K9 vest, muzzle). An accessory can only be worn once you have it in your K9 gear.- A leash (
k9_leash, in your K9 gear): the dog leads out in front of you.
Settings
Everything is in config.lua, each section explained where it stands.