# DOJ:RP Documentation (SA-MP)

{% embed url="<https://youtube.com/@WeponzTV>" %}
Devlog Series on YouTube
{% endembed %}

1. [Installation](#installation)
2. [Configuration](#configuration)
3. [Database](#database)
4. [Setting Up Admin](#setting-up-admin)
5. [Module System](#module-system)
6. [Hierarchy Structure](#hierarchy-structure)
7. [Adding Items](#adding-items)
8. [Adding Vehicles](#adding-vehicles)
9. [Adding Objects](#adding-objects)
10. [Creating Properties](#creating-properties)
11. [Creating Bus Stops](#creating-bus-stops)
12. [Creating Sprunk Machines](#creating-sprunk-machines)

## Installation

After installing the prerequisites on [Github](https://github.com/WeponzTV/dojrp_samp#prerequisites), download the `.zip` file and extract the folders/files into the root directory of your server.

## Configuration

Change any (optional) settings in the `gamemodes/DOJRP/core/config.inc` file and then compile the `main.pwn` file located in the `gamemodes` folder.

Add `gamemode0 main 1` and `plugins samp_bcrypt sscanf streamer` (add `.so` for Linux) to your `server.cfg` file located in your server's root directory and then run the server.

## Database

The script uses a SQLite-based include called `sqlitei.inc`. An existing database (`server.db`) is located in the `scriptfiles/DOJRP` folder and only contains some houses, businesses, bus stops, and sprunk machines. Unless you want to use these existing houses, businesses, bus stops, and sprunk machines the database file can be deleted and a brand new one will be automatically created upon launching your server.

## Setting Up Admin

Login as RCON admin using `/rcon login [password]` and then use `/setlevel` and set yourself as an "Owner". You can then hire Managers, Admins etc. using the same command.

## Module System

The script uses `y_hooks` which is a callback hooking system allowing you to modularize your script into multiple `.inc` files. The script's module files are located in the `gamemodes/DOJRP` folder broken down into three folders including `core`, `player`, and `server`.

## Hierarchy Structure

The modules work in a hierarchy fashion. This means code in the `core` folder can be used by modules in the `player` and `server` folders. The same goes for the `player` folder's code which can be used in the `server` folder and so on. It's important to note that the `gamemodes/DOJRP/player/accounts.inc` file acts as base for almost all of the modules located below it in the `main.pwn` file, as account functions are needed in most systems. The `gamemodes/DOJRP/player/misc.inc` file acts as a base for anything else 'non-account' related so if you cannot find a function in a specific system module, it should be in one of those files.

## Adding Items

The item system is located in the `gamemodes/DOJRP/player/inventory.inc` file and can be easily added upon by searching for one of the model id definitions and duplicating the code for another model id/item.

## Adding Vehicles

Vehicle files for each island can be located in the `scriptfiles/DOJRP/vehicles` folder. You can easily add new vehicles without having to compile the script by following the parameter format in each of the files.

## Adding Objects

Objects files for each island (and interiors) can be located in the `scriptfiles/DOJRP/objects` folder. You can easily add new objects without having to compile the script by following the parameter format in each of the files.

## Creating Properties

Houses and businesses are dynamically created using `/createhouse` and `/createbusiness` while set as an "Owner" admin level. The `scriptfiles/DOJRP/server.db` file contains some existing houses and businesses, but if you choose not to use them, you can delete the `HOUSES` and/or `BUSINESSES` table(s) in the database using SQLite browsing software.

## Creating Bus Stops

Bus stops are dynamically created using `/createstop` while set as an "Owner" admin level. The `scriptfiles/DOJRP/server.db` file contains some existing bus stops, but if you choose not to use them, you can delete the `LSBUS`, `SFBUS`, and `LVBUS` tables in the database using SQLite browsing software.

## Creating Sprunk Machines

Sprunk machines are dynamically created using `/createsprunk` while set as an "Owner" admin level and can be created inside interiors. The `scriptfiles/DOJRP/server.db` file contains some existing sprunk machines, but if you choose not to use them, you can delete the `SPRUNKS` table in the database using SQLite browsing software.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://weponztv.gitbook.io/dojrp-samp-documentation/doj-rp-documentation-sa-mp.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
