|
1 | | -import { Steps } from 'nextra/components' |
| 1 | +import Link from 'next/link'; |
2 | 2 |
|
3 | | -# Change states of status indicators |
| 3 | +# Status indicators |
4 | 4 |
|
5 | | -You can change the states of individual status indicators. |
6 | | -This is useful if you want to indicate certain YES or NO states for players. |
| 5 | +You can either manually change the state of a status indicator, or use the integrated minimum group trigger. |
| 6 | +Both methods are explained in their respective sections. |
7 | 7 |
|
8 | | -This guide will show you how to change the state of `house_robbery` status indicator, but it works the same for all indicators. |
9 | | - |
10 | | - |
11 | | - |
12 | | -## Requirements |
13 | | -- ability to write your own custom logic for controlling the states |
14 | | - |
15 | | - |
16 | | - |
17 | | -## Configuration |
18 | | -You need to find the status indicator ID. This can be found in the `config.lua` file. |
19 | | -Each status indicator needs to have a unique ID so you can identify it. |
20 | | - |
21 | | -```lua filename="config.lua" {2} /'house_robbery'/ |
22 | | -statusIndicators = { |
23 | | - { id = 'house_robbery', label = 'House robbery', icon = 'mdi:house', defaultState = true }, |
24 | | - { id = 'store_robbery', label = 'Store robbery', icon = 'mdi:store', defaultState = false }, |
25 | | - { id = 'bank_robbery', label = 'Bank robbery', icon = 'mdi:bank' }, |
26 | | -}, |
27 | | -``` |
28 | | - |
29 | | - |
30 | | - |
31 | | -## Steps |
32 | | - |
33 | | -<Steps> |
34 | | - |
35 | | -### Create a custom server resource |
36 | | -The state can be only changed from server-side resources. |
37 | | -Create a new resource (or use an existing one) and add the following custom logic to it's server-side file. |
38 | | - |
39 | | -### Use the `setIndicatorState` export |
40 | | -```lua filename="server.lua" /'house_robbery'/ /true/ |
41 | | -exports.ac_scoreboard:setIndicatorState('house_robbery', true) |
42 | | -``` |
43 | | - |
44 | | -The first argument is the indicator ID from `config.lua`. |
45 | | -The second argument is a boolean value that sets the corresponding state. |
46 | | - |
47 | | -You can also use non-networked `ac_scoreboard:setIndicatorState` server event, which works the same way. |
48 | | -```lua filename="server.lua" /'house_robbery'/ /true/ |
49 | | -TriggerEvent('ac_scoreboard:setIndicatorState', 'house_robbery', true) |
50 | | -``` |
51 | | - |
52 | | -### Test it |
53 | | -Run your custom logic and see how the indicator state changes. |
54 | | -All indicator changes take effect immediately after reopening the scoreboard. |
55 | | - |
56 | | -**In case it's not working, read this whole page again from the beginning and check if you missed something.** |
57 | | - |
58 | | -</Steps> |
| 8 | +<div className="flex gap-2 mt-4"> |
| 9 | + <Link href="./status-indicators/group-trigger" className="bg-gray-700 p-2 rounded-md w-fit text-white font-medium hover:bg-gray-600 transition-colors">Group trigger</Link> |
| 10 | + <Link href="./status-indicators/manual" className="bg-gray-700 p-2 rounded-md w-fit text-white font-medium hover:bg-gray-600 transition-colors">Manual</Link> |
| 11 | +</div> |
0 commit comments