Skip to content

Commit e4e1880

Browse files
committed
updated file select so no more "copy and rename"
also: - fixed dev mode being on (this would add junk commands) - removed server-side printing when up-to-date
1 parent c48804b commit e4e1880

6 files changed

Lines changed: 17 additions & 10 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ This script displays a nearest postal next to where PLD would go and also has a
1010
- `new-postals.json` -> [New and Improved Postals](https://forum.fivem.net/t/release-postal-code-map-new-improved-v1-1/147458)
1111
- `old-postals.json` -> [Original Postals](https://forum.fivem.net/t/release-modified-street-names-w-postal-numbers/8717)
1212
- `ocrp-postals.json` -> [OCRP Postals](https://forum.fivem.net/t/release-ocrp-community-releases/166277)
13-
4. To setup the postal map rename your file from what it was to `postals.json`
13+
4. To setup the postal map, open the `__resource.lua` file and change the variable `postalFile` to one of the files above
14+
- **NOTE**: This defaults as the `new-postals.json` file
1415

1516
## Command
1617
To draw a route to a certain postal, type `/postal [postalName]` and to remove just type `/postal`
1718

1819
It will automatically remove the route when within 100m of the destination
1920

2021
## Updates
22+
### 1.3
23+
* Improvements in selection of postal map
24+
* Fix dev mode being on
2125
### 1.2.1
2226
* Fixes to missing postals on improved postal map
2327

__resource.lua

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
1+
-- the postal map to read from
2+
-- change it to whatever model you want that is in this directory
3+
local postalFile = 'new-postals.json'
4+
15
resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
26

37
client_scripts {
48
'config.lua',
59
'cl.lua'
610
}
711
server_script 'sv.lua'
8-
file 'postals.json'
12+
13+
file(postalFile)
14+
postal_file(postalFile)
15+
916
file 'version.json'

cl.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
local raw = LoadResourceFile(GetCurrentResourceName(), 'postals.json')
1+
local raw = LoadResourceFile(GetCurrentResourceName(), GetResourceMetadata(GetCurrentResourceName(), 'postal_file'))
22
local postals = json.decode(raw)
33

44
local nearest = nil
@@ -108,7 +108,7 @@ RegisterCommand('postal', function(source, args, raw)
108108
end)
109109

110110
--[[Development shit]]
111-
local dev = true
111+
local dev = false
112112
if dev then
113113
local devLocal = json.decode(raw)
114114
local next = 0

sv.lua

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
-- version check
22
Citizen.CreateThread(function()
3-
print('nearest-postal by BlockBa5her started')
43
local vRaw = LoadResourceFile(GetCurrentResourceName(), "version.json")
54
if vRaw then
65
local v = json.decode(vRaw)
76
PerformHttpRequest("https://raw.githubusercontent.com/blockba5her/nearest-postal/master/version.json", function(code, res, headers)
87
if code == 200 then
98
local rv = json.decode(res)
10-
if rv.version == v.version then
11-
print('nearest-postal up to date!')
12-
else
9+
if rv.version ~= v.version then
1310
print((
1411
[[
1512

version.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"version":"1.2.1","changelog":"Fix missing improved postals"}
1+
{"version":"1.3","changelog":"changed loading of postal json; fixed dev mode being on; disable version check message when up to date"}

0 commit comments

Comments
 (0)