Skip to content

Commit 1214e97

Browse files
committed
fix: socket label not using bootstrap 4
Socket label was updated to "badge" as per the new bootstrap system.
1 parent 07e9abd commit 1214e97

File tree

2 files changed

+91
-2
lines changed

2 files changed

+91
-2
lines changed

README.md

+89
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,98 @@ You will also need to install [live_map](https://github.com/TGRHavoc/live_map) o
2323

2424
## Configuration
2525

26+
### utils/config.php
2627
Pretty much everything can be configured inside the `utils/config.php` file.
2728
The variables have a brief description so you can get an idea of what values need to be where.
2829

30+
### utils/server.php
31+
So, this is a new file that you can configure to add more servers to the livemap.
32+
If you have 3 servers you want to show, this is your config file.
33+
34+
The only thing you want to change is the `$servers` variable on line 32.
35+
I'll try and give a detailed description on how you can use this below, hopefully you'll understand :)
36+
37+
This array follows a structure and you will need to follow the structure inorder to get multiple servers working.
38+
39+
The first thing the array wants, is a `"name" => array()` added to it.
40+
"name" will be the name of the server shown to the user for easy identification.
41+
The `array()` will be another array containing the information of the server.
42+
If you don't supply any information (e.g. just use `array()`) then, it will default back to the values inside of the `utils/config.php` file.
43+
44+
The `array()` for the server can contain four key-pairs.
45+
Below is a table showing what the array wants and a brief description of what the value should be.
46+
47+
48+
| Name | Description |
49+
| ----------- | ------------ |
50+
| ip | This should be the public IP for the server. Defined in `utils/config.php` as `$fivemIP` |
51+
| fivemPort | This should be the FiveM port for the server. Defined in `utils/config.php` as `$fivemPort` |
52+
| socketPort | This should be the socket port for the server. Defined in `utils/config.php` as `$socketPort` |
53+
| liveMapName | This should be the name of the livemap resource on that server. Defined in `utils/config.php` as `$liveMapName` |
54+
55+
#### Examples
56+
If you have 3 servers running on the default IP (defined in `utils/config.php`)
57+
```php
58+
private static $servers = array(
59+
"Server 1" => array(
60+
"fivemPort" => "30120",
61+
"socketPort" => "30130",
62+
),
63+
"Server 2" => array(
64+
"fivemPort" => "30121",
65+
"socketPort" => "30131",
66+
),
67+
"Server 3" => array(
68+
"fivemPort" => "30122",
69+
"socketPort" => "30131",
70+
)
71+
);
72+
```
73+
74+
Or, if you have different servers on different IPs but, use the same ports
75+
```php
76+
private static $servers = array(
77+
"Server 1" => array(
78+
"ip" => "127.0.0.1"
79+
),
80+
"Server 2" => array(
81+
"ip" => "192.168.0.1"
82+
),
83+
"Server 3" => array(
84+
"ip" => "192.168.10.1"
85+
)
86+
);
87+
```
88+
89+
Or, a mix of both
90+
```php
91+
private static $servers = array(
92+
"Server 1" => array(
93+
"ip" => "127.0.0.1",
94+
"fivemPort" => "30121",
95+
"socketPort" => "4040"
96+
),
97+
"Server 2" => array(
98+
"ip" => "192.168.0.1"
99+
),
100+
"Server 3" => array(
101+
"ip" => "192.168.10.1",
102+
"socketPort" => "20394",
103+
"liveMapName" => "some_shit_map"
104+
)
105+
);
106+
107+
```
108+
109+
Below is the code I have running on the [demo map](http://map.tgrhavoc.me)
110+
```php
111+
private static $servers = array(
112+
"Havoc's Test server (tgrhavoc.me)" => array(),
113+
"This is an example of another server (it doesn't exist)" => array()
114+
);
115+
```
116+
117+
29118
## Thanks
30119

31120
Special thanks to the people who helped me test this, flushing out any bugs that managed to sneak in.

js/src/socket.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ function onOpen(e) {
4747
// New websocket server doesn't need to recieve this
4848
//webSocket.send("getPlayerData"); // Get any players connected to the server
4949

50-
$("#connection").removeClass("label-danger")
51-
.removeClass("label-warning")
50+
$("#connection").removeClass("badge-danger")
51+
.removeClass("badge-warning")
5252
.addClass("badge-success").text("connected");
5353
$("#socket_error").text("");
5454
}

0 commit comments

Comments
 (0)