# PixelWar

## Requirements

* **FiveM Server** with OneSync enabled
* **oxmysql** (required dependency)
* **ox\_lib**
* **Phone**: One of the following:
  * [lb-phone](https://lbphone.com/) (v1.8+)
  * [GKSPHONE v2](https://gkshop.org/)
  * [ySeries](https://www.yflip-phone.com/)
  * [lb-tablet](https://lbscripts.com/)
  * [17mov\_Phone](https://17movement.net/products/17mov_phone)
* **Framework** (optional): ESX, QBCore, or standalone

{% stepper %}
{% step %}

### Database

Run the `sql/install.sql` file in your database using [HeidiSQL](https://www.heidisql.com/).
{% endstep %}

{% step %}

### Install Resource

1. Place the `portis-pixelwar` folder in your server's `resources/` directory.
2. Add to your `server.cfg`:

```cfg
set pixelwar_discord_webhook    "https://discord.com/api/webhooks/..."
set pixelwar_anticheat_webhook  "https://discord.com/api/webhooks/..."

ensure oxmysql
ensure ox_lib
ensure lb-phone
ensure portis-pixelwar
```

{% hint style="info" %}
Make sure `portis-pixelwar` starts **after** your phone resource and framework.
{% endhint %}
{% endstep %}
{% endstepper %}

## Verify

1. Start your server
2. Check console for: `[PixelWar] Resource started successfully`
3. Open your phone in-game — PixelWar should appear in the app list
4. Open the app — the territory map should load with all zones visible
5. Check that your gang zones are visible and zone income is ticking

## Season Reset

PixelWar runs in seasons. At the end of each season, top players and gangs receive rewards, then trophies soft-reset and a new season starts.

There is **no automatic cron** — you trigger the reset manually whenever you want.

***

### Command

```bash
pixelwar_season_end
```

> ⚠️ Console-only. Cannot be run from in-game chat.

***

### What Happens

* **Top 10 players** get SC + season badge (`Config.Trophy.solo_rewards`)
* **Top 3 gangs** get SC split among members + gang badge (`Config.Trophy.gang_rewards`)
* All trophies multiplied by `Config.Trophy.season_reset_multiplier` (default `0.5`)
* New season row is created in `pw_seasons`
* Online players receive a phone notification

***

### Config

`config/config.lua` → `Config.Trophy`:

```lua
solo_rewards = { ... }            -- top 10 player rewards
gang_rewards = { ... }            -- top 3 gang rewards
season_reset_multiplier = 0.5     -- 0.0 = full reset, 1.0 = no reset
```

## Troubleshooting

<details>

<summary>App not appearing in phone</summary>

* Make sure `portis-pixelwar` starts after your phone resource in `server.cfg`
* Check `Config.Phone` is set correctly or left as `'auto'`
* Verify ox\_lib is running

</details>

<details>

<summary>Database errors on start</summary>

* Confirm oxmysql is running before `portis-pixelwar`
* Make sure `sql/install.sql` was imported successfully

</details>

<details>

<summary>Zones not showing on map</summary>

* Verify `sql/install.sql` was imported — zones are pre-seeded in the SQL file
* Check `config/zones.lua` for valid polygon coordinates

</details>


---

# 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://portis-store.gitbook.io/portis-store-docs/pixelwar.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.
