├── .all-contributorsrc ├── .eslintrc.json ├── .github ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── support_question.md ├── .gitignore ├── .versionrc ├── .vscode └── settings.json ├── dist ├── .gitkeep └── livemap.js ├── docs ├── CHANGELOG.md ├── README.md ├── config.md ├── events.md └── license.md ├── example_client ├── blip_helper.lua ├── blips_client.lua ├── client_icon.lua ├── client_position.lua ├── client_spanwed.lua ├── client_vehicle_info.lua ├── client_weapons.lua ├── readme.md ├── reverse_car_hashes.lua ├── reverse_location_hashes.lua └── reverse_weapon_hashes.lua ├── fxmanifest.lua ├── mkdocs.yml ├── package.json ├── server ├── blips_server.lua ├── setup_nucleus.lua ├── update_check.lua └── wrapper.lua ├── src ├── blips.js ├── server.js ├── sockets.js └── wrapper.js ├── tools ├── bump-fxmanifest.js └── standard-version-bump.js ├── version.json ├── webpack.config.js └── yarn.lock /.all-contributorsrc: -------------------------------------------------------------------------------- 1 | { 2 | "projectName": "live_map", 3 | "projectOwner": "TGRHavoc", 4 | "repoType": "github", 5 | "repoHost": "https://github.com", 6 | "files": [ 7 | "docs/README.md" 8 | ], 9 | "types": { 10 | "testing": { 11 | "symbol": "⚠️", 12 | "description": "Tested changes and confirmed bugs." 13 | } 14 | }, 15 | "imageSize": 100, 16 | "commit": true, 17 | "commitConvention": "angular", 18 | "contributors": [ 19 | { 20 | "login": "TGRHavoc", 21 | "name": "Jordan Dalton", 22 | "avatar_url": "https://avatars.githubusercontent.com/u/1770893?v=4", 23 | "profile": "https://tgrhavoc.co.uk/", 24 | "contributions": [ 25 | "code", 26 | "bug", 27 | "ideas", 28 | "doc" 29 | ] 30 | }, 31 | { 32 | "login": "xlxAciDxlx", 33 | "name": "AciD", 34 | "avatar_url": "https://avatars.githubusercontent.com/u/7502881?v=4", 35 | "profile": "https://xlxacidxlx.com/", 36 | "contributions": [ 37 | "bug" 38 | ] 39 | }, 40 | { 41 | "login": "davwheat", 42 | "name": "David Wheatley", 43 | "avatar_url": "https://avatars.githubusercontent.com/u/7406822?v=4", 44 | "profile": "https://github.com/davwheat", 45 | "contributions": [ 46 | "bug" 47 | ] 48 | }, 49 | { 50 | "login": "KjayCopper", 51 | "name": "KjayCopper", 52 | "avatar_url": "https://avatars.githubusercontent.com/u/20233127?v=4", 53 | "profile": "https://github.com/KjayCopper", 54 | "contributions": [ 55 | "testing" 56 | ] 57 | }, 58 | { 59 | "login": "jiynn", 60 | "name": "jiynn", 61 | "avatar_url": "https://avatars.githubusercontent.com/u/33206565?v=4", 62 | "profile": "https://github.com/jiynn", 63 | "contributions": [ 64 | "bug" 65 | ] 66 | }, 67 | { 68 | "login": "mbergwall2222", 69 | "name": "mbergwall2222", 70 | "avatar_url": "https://avatars.githubusercontent.com/u/20733527?v=4", 71 | "profile": "https://github.com/mbergwall2222", 72 | "contributions": [ 73 | "bug" 74 | ] 75 | }, 76 | { 77 | "login": "JayMontana36", 78 | "name": "Jasen Samuels", 79 | "avatar_url": "https://avatars.githubusercontent.com/u/6281870?v=4", 80 | "profile": "https://sites.google.com/site/jaymontana36jasen/", 81 | "contributions": [ 82 | "bug" 83 | ] 84 | }, 85 | { 86 | "login": "avery1227", 87 | "name": "Avery Johnson", 88 | "avatar_url": "https://avatars.githubusercontent.com/u/12959747?v=4", 89 | "profile": "https://github.com/avery1227", 90 | "contributions": [ 91 | "code" 92 | ] 93 | }, 94 | { 95 | "login": "TomGrobbe", 96 | "name": "Tom", 97 | "avatar_url": "https://avatars.githubusercontent.com/u/31419184?v=4", 98 | "profile": "https://tomgrobbe.nl/", 99 | "contributions": [ 100 | "code" 101 | ] 102 | }, 103 | { 104 | "login": "matsn0w", 105 | "name": "matsn0w", 106 | "avatar_url": "https://avatars.githubusercontent.com/u/15019582?v=4", 107 | "profile": "http://matsn0w.dev", 108 | "contributions": [ 109 | "bug", 110 | "code" 111 | ] 112 | } 113 | ], 114 | "contributorsPerLine": 7, 115 | "skipCi": true 116 | } 117 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "commonjs": true, 4 | "es6": true, 5 | "node": true 6 | }, 7 | "extends": "eslint:recommended", 8 | "globals": { 9 | "Atomics": "readonly", 10 | "SharedArrayBuffer": "readonly" 11 | }, 12 | "parserOptions": { 13 | "ecmaVersion": 2018 14 | }, 15 | "rules": { 16 | "indent": [ 17 | "error", 18 | 4 19 | ], 20 | "linebreak-style": [ 21 | "error", 22 | "unix" 23 | ], 24 | "quotes": [ 25 | "error", 26 | "double" 27 | ], 28 | "semi": [ 29 | "error", 30 | "always" 31 | ], 32 | "no-console": "off", 33 | "no-undef": "off" 34 | } 35 | } -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ["https://www.paypal.com/donate?hosted_button_id=4PPJGZNAGWJHL"] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F41B Bug Report" 3 | about: "If something isn't working as expected \U0001F914." 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Desktop (please complete the following information):** 27 | - OS: [e.g. iOS] 28 | - Browser [e.g. chrome, safari] 29 | - Version [e.g. 22] 30 | 31 | **Smartphone (please complete the following information):** 32 | - Device: [e.g. iPhone6] 33 | - OS: [e.g. iOS8.1] 34 | - Browser [e.g. stock browser, safari] 35 | - Version [e.g. 22] 36 | 37 | **Possible Solution** 38 | 39 | 40 | **Additional context/Screenshots** 41 | Add any other context about the problem here. If applicable, add screenshots to help explain. 42 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F680 Feature Request" 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/support_question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "\U0001F917 Support Question" 3 | about: "If you have a question \U0001F4AC, please check out the discussions" 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | --------------^ Click "Preview" for a nicer view! 11 | 12 | For usage and support questions, please check out the discussions page. Thanks! 😁. 13 | 14 | https://github.com/TGRHavoc/live_map/discussions 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | server/blips\.json 2 | node_modules/ 3 | obj/ 4 | yarn-error.log 5 | client/blip_helper.lua 6 | client/blips_client.lua 7 | client/client_icon.lua 8 | client/client_position.lua 9 | client/client_spanwed.lua 10 | client/client_vehicle_info.lua 11 | client/client_weapons.lua 12 | client/client.lua.old 13 | client/readme.md 14 | client/reverse_car_hashes.lua 15 | client/reverse_location_hashes.lua 16 | client/reverse_weapon_hashes.lua 17 | livemap_uuid 18 | -------------------------------------------------------------------------------- /.versionrc: -------------------------------------------------------------------------------- 1 | { 2 | "header": "# Changelog\n", 3 | "commit-all": true, 4 | "releaseCommitMessageFormat": "chore(release): v{{currentTag}}", 5 | "infile": "docs/CHANGELOG.md", 6 | "scripts": { 7 | "prerelease": "yarn webpack", 8 | "precommit": "git add dist/" 9 | }, 10 | "bumpFiles": [ 11 | { 12 | "filename": "version.json", 13 | "updater": "tools/standard-version-bump.js" 14 | }, 15 | { 16 | "filename": "fxmanifest.lua", 17 | "updater": "tools/bump-fxmanifest.js" 18 | }, 19 | { 20 | "filename": "package.json", 21 | "type": "json" 22 | } 23 | ], 24 | "types": [ 25 | { 26 | "type": "feat", 27 | "section": "Features" 28 | }, 29 | { 30 | "type": "fix", 31 | "section": "Bug Fixes" 32 | }, 33 | { 34 | "type": "refactor", 35 | "section": "Changes" 36 | }, 37 | { 38 | "type": "perf", 39 | "section": "Performance Changes" 40 | }, 41 | { 42 | "type": "test", 43 | "section": "Tests", 44 | "hidden": true 45 | }, 46 | { 47 | "type": "build", 48 | "section": "Build System", 49 | "hidden": true 50 | }, 51 | { 52 | "type": "ci", 53 | "section": "Continuous Intergration", 54 | "hidden": true 55 | } 56 | ] 57 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "eslint.autoFixOnSave": true, 3 | "eslint.packageManager": "yarn", 4 | "eslint.run": "onSave", 5 | "editor.codeActionsOnSave": { 6 | "source.fixAll.eslint": true 7 | } 8 | } -------------------------------------------------------------------------------- /dist/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TGRHavoc/live_map/0380be4ac3a1b0cfeaf0f0e3c62614a4534844a9/dist/.gitkeep -------------------------------------------------------------------------------- /dist/livemap.js: -------------------------------------------------------------------------------- 1 | /******/ (() => { // webpackBootstrap 2 | /******/ var __webpack_modules__ = ({ 3 | 4 | /***/ 529: 5 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 6 | 7 | const blipLog = __webpack_require__(731).getLogger("LiveMap Blips"); 8 | const fs = __webpack_require__(747); 9 | const path = __webpack_require__(622); 10 | 11 | const BlipController = (SocketController) => { 12 | let playerWhoGeneratedBlips = null; 13 | let blips = null; 14 | const blipFile = GetConvar("blip_file", "server/blips.json"); 15 | 16 | // Middleware to send the blips 17 | const getBlips = (ctx) => { 18 | if (blips === null){ 19 | ctx.body = JSON.stringify({ 20 | error: "blip cache is empty" 21 | }); 22 | }else{ 23 | ctx.body = JSON.stringify(blips); 24 | } 25 | }; 26 | 27 | // function to save blips to blip file 28 | const saveBlips = () => { 29 | const saved = SaveResourceFile(GetCurrentResourceName(), blipFile, JSON.stringify(blips, null, 4), -1); 30 | 31 | if (saved) { 32 | blipLog.info("Saved blip file"); 33 | } else { 34 | blipLog.warn("Error writing to blip file... Maybe permissions aren't correct?"); 35 | } 36 | }; 37 | // function to load blips from blip file 38 | const loadBlips = () => { 39 | const loaded = LoadResourceFile(GetCurrentResourceName(), blipFile); 40 | if (loaded) { 41 | try { 42 | blips = JSON.parse(loaded); 43 | } catch (err) { 44 | blipLog.warn("Error when parsing blips.json file. Please make sure it's valid JSON. %s", err.message); 45 | } 46 | } else { 47 | // Make an empty blip file? 48 | blips = {}; 49 | saveBlips(); 50 | } 51 | }; 52 | 53 | const getDistanceBetween = (p1, p2) => { 54 | let x = Math.pow(p2.x - p1.x, 2); 55 | let y = Math.pow(p2.y - p1.y, 2); 56 | let z = Math.pow(p2.z - p1.z, 2); 57 | 58 | return Math.sqrt(x + y + z); 59 | }; 60 | 61 | const getBlipIndex = (sprite, pos) => { 62 | if (blips[sprite] === undefined){ 63 | return -1; 64 | } 65 | 66 | blips[sprite].forEach((blip, index) => { 67 | if (blip.pos == pos){ 68 | return index; 69 | } 70 | }); 71 | 72 | return -1; 73 | }; 74 | 75 | const validBlip = (blip) => { 76 | if (blip["sprite"] === undefined || blip["sprite"] === null) { 77 | blipLog.debug("Blip didn't have sprite: %o", blip); 78 | blipLog.warn("Blip has no sprite..."); 79 | return false; 80 | } 81 | 82 | if (blip["pos"] === undefined || blip["pos"] === null) { 83 | blipLog.debug("Blip didn't have pos: %o", blip); 84 | blipLog.warn("Blip has no position..."); 85 | return false; 86 | } 87 | 88 | if (typeof(blip.pos) !== "object"){ 89 | blipLog.warn("Blip position must be an object"); 90 | return false; 91 | } 92 | 93 | if (blip.pos["x"] === undefined || blip.pos["y"] === undefined || blip.pos["z"] === undefined){ 94 | blipLog.debug("Invalid position: %o", blip.pos); 95 | blipLog.warn("Blip position invalid"); 96 | return false; 97 | } 98 | 99 | if (typeof(blip.pos.x) !== "number" || typeof(blip.pos.y) !== "number" || typeof(blip.pos.z) !== "number"){ 100 | blipLog.warn("Blip pos must be numbers"); 101 | blipLog.debug("Invalid position: %o", blip.pos); 102 | return false; 103 | } 104 | 105 | return true; 106 | }; 107 | 108 | on("onResourceStart", (name) => { 109 | if (name === GetCurrentResourceName()){ 110 | loadBlips(); 111 | } 112 | }); 113 | on("onResourceStop", (name) => { 114 | if (name === GetCurrentResourceName()){ 115 | saveBlips(); 116 | } 117 | }); 118 | 119 | onNet("livemap:blipsGenerated", (blipTable) => { 120 | let playerIdentifier = GetPlayerIdentifier(source, 0); 121 | if (playerWhoGeneratedBlips === null || playerWhoGeneratedBlips !== playerIdentifier){ 122 | blipLog.warn("playerWhoGeneratedBlips doesn't match... Not using the blips recieved"); 123 | return; 124 | } 125 | 126 | blips = blipTable; 127 | saveBlips(); 128 | }); 129 | 130 | onNet("livemap:AddBlip", (blip) => { 131 | if (!validBlip(blip)){ 132 | return; 133 | } 134 | 135 | //Extract the spite 136 | const sprite = blip.sprite.toString(); 137 | delete blip.sprite; 138 | 139 | // Make sure it's to 2 dp 140 | blip.pos.x = blip.pos.x.toFixed(2); 141 | blip.pos.y = blip.pos.y.toFixed(2); 142 | blip.pos.z = blip.pos.z.toFixed(2); 143 | 144 | // Get the index of the blip.. Making sure it exists 145 | let blipIndex = getBlipIndex(sprite, blip); 146 | 147 | if (blipIndex !== -1){ 148 | blipLog.debug("Duplicate blip: %d = %o", blipIndex, blip); 149 | blipLog.warn("Blip already exists... Cannot add it!"); 150 | return; 151 | } 152 | 153 | if (blips[sprite] === undefined){ 154 | blips[sprite] = []; 155 | } 156 | 157 | blips[sprite].push(blip); 158 | 159 | SocketController.AddBlip(sprite, blip); 160 | }); 161 | 162 | onNet("livemap:UpdateBlip", (blip) => { 163 | if(!validBlip(blip)){ 164 | return; 165 | } 166 | 167 | //Extract the spite 168 | const sprite = blip.sprite.toString(); 169 | delete blip.sprite; 170 | 171 | // Make sure it's to 2 dp 172 | blip.pos.x = blip.pos.x.toFixed(2); 173 | blip.pos.y = blip.pos.y.toFixed(2); 174 | blip.pos.z = blip.pos.z.toFixed(2); 175 | 176 | // Get the index of the blip.. Making sure it exists 177 | let blipIndex = getBlipIndex(sprite, blip); 178 | 179 | if (blipIndex !== -1){ 180 | blips[sprite][blipIndex] = blip; 181 | SocketController.UpdateBlip(sprite, blip); 182 | }else{ 183 | if (blips[sprite] === undefined){ 184 | blips[sprite] = []; 185 | } 186 | 187 | blips[sprite].push(blip); 188 | SocketController.AddBlip(sprite, blip); 189 | } 190 | }); 191 | 192 | onNet("livemap:RemoveBlip", (blip) => { 193 | if (!validBlip(blip)){ 194 | return; 195 | } 196 | 197 | //Extract the spire 198 | const sprite = blip.sprite.toString(); 199 | delete blip.sprite; 200 | 201 | // Make sure it's to 2 dp 202 | blip.pos.x = blip.pos.x.toFixed(2); 203 | blip.pos.y = blip.pos.y.toFixed(2); 204 | blip.pos.z = blip.pos.z.toFixed(2); 205 | 206 | // Get the index of the blip.. Making sure it exists 207 | let blipIndex = getBlipIndex(sprite, blip); 208 | if (blipIndex !== -1) { 209 | delete blips[sprite][blipIndex]; 210 | blipLog.info("Removed blip: %o", blip); 211 | SocketController.RemoveBlip(sprite, blip); 212 | }else{ 213 | blipLog.warn("Cannot delete a blip that doesn't exist"); 214 | } 215 | }); 216 | 217 | onNet("livemap:RemoveClosestBlip", (playerPos) => { 218 | let closest, sprite, currentBest; 219 | for (let spriteId in blips){ 220 | blips[spriteId].forEach(blip => { 221 | let myDistance = getDistanceBetween(playerPos, blip.pos); 222 | if (currentBest === undefined || myDistance < currentBest){ 223 | currentBest = myDistance; 224 | closest = blip; 225 | sprite = spriteId; 226 | } 227 | }); 228 | } 229 | 230 | if (currentBest === undefined) { // Possibly no blips.. 231 | return; 232 | } 233 | 234 | blipLog.info("Removing closest blip. It's sprite is %d and position (dis=%d) is %o", sprite, closest.pos); 235 | 236 | const blipToDelete = getBlipIndex(sprite, closest.pos); 237 | if (blipToDelete == -1){ 238 | blipLog.debug("Closest blip doesn't exist? %o\n%O", closest, blips); 239 | return; 240 | } 241 | 242 | delete blips[sprite][blipToDelete]; 243 | SocketController.RemoveBlip(sprite, closest); 244 | }); 245 | 246 | RegisterCommand("blips", (src, args) => { 247 | if (src === 0) { 248 | blipLog.warn("Please run this command in game. Make sure you have ACE permissions set up"); 249 | blipLog.warn("https://docs.tgrhavoc.me/livemap-resource/faq/#how-do-i-get-blips"); 250 | return; 251 | } 252 | 253 | let playerIdentifier = GetPlayerIdentifier(src, 0); 254 | if (args[0] === "generate") { 255 | playerWhoGeneratedBlips = playerIdentifier; 256 | blipLog.warn("Generating blips using the in-game natives: Player %s is generating them.", playerIdentifier); 257 | emitNet("livemap:getBlipsFromClient", src); 258 | } 259 | }, true); 260 | 261 | return { 262 | getBlips 263 | }; 264 | }; 265 | 266 | 267 | module.exports = BlipController; 268 | 269 | 270 | /***/ }), 271 | 272 | /***/ 376: 273 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 274 | 275 | const socketLog = __webpack_require__(731).getLogger("LiveMap Sockets"); 276 | const WS = __webpack_require__(439); 277 | 278 | const SocketController = (access) => { 279 | 280 | const hook = (wss) => { 281 | wss.broadcast = (data) => { 282 | wss.clients.forEach(function each(client) { 283 | if (client.readyState === WS.OPEN) { 284 | client.send(data); 285 | } 286 | }); 287 | }; 288 | wss.on("connection", function connection(ws, req) { //ws, res 289 | socketLog.trace("Access is: %s", access); 290 | if (access !== "*") { // We don't want to accept all requests 291 | if (req.headers.origin !== access) { 292 | ws.close(); 293 | socketLog.warn("Someone tried connecting from an invalid origin: %s", req.headers.origin); 294 | } 295 | } 296 | socketLog.debug("connection made from", req.headers.origin); 297 | }); 298 | websocketServer = wss; 299 | }; 300 | 301 | let playerData = {}; 302 | let websocketServer = null; 303 | 304 | const makeSurePlayerExists = (id) => { 305 | if (playerData[id] === undefined){ 306 | playerData[id] = {}; 307 | } 308 | }; 309 | 310 | const SendPlayerData = () => { 311 | if (websocketServer == null) return; 312 | 313 | let payload = []; 314 | for (let identifier in playerData){ 315 | payload.push(playerData[identifier]); 316 | } 317 | websocketServer.broadcast(JSON.stringify({ 318 | type: "playerData", 319 | payload: payload 320 | })); 321 | }; 322 | 323 | const checkInputs = (identifier, key, data) => { 324 | if (!identifier) { 325 | socketLog.debug("Empty identifier: ", identifier); 326 | socketLog.warn("Identifier cannot be null or empty when adding player data"); 327 | return false; 328 | } 329 | if (!key) { 330 | socketLog.warn("Key for the data cannot be null or empty when adding player data"); 331 | return false; 332 | } 333 | if (!data) { 334 | socketLog.warn("Cannot add no data to player"); 335 | return false; 336 | } 337 | 338 | return true; 339 | }; 340 | 341 | const validBlip = (blip) => { 342 | if (blip["sprite"] === undefined || blip["sprite"] === null) { 343 | socketLog.debug("Blip didn't have sprite: %o", blip); 344 | socketLog.warn("Blip has no sprite..."); 345 | return false; 346 | } 347 | 348 | if (blip["pos"] === undefined || blip["pos"] === null) { 349 | socketLog.debug("Blip didn't have pos: %o", blip); 350 | socketLog.warn("Blip has no position..."); 351 | return false; 352 | } 353 | 354 | if (typeof (blip.pos) !== "object") { 355 | socketLog.warn("Blip position must be an object"); 356 | return false; 357 | } 358 | 359 | if (blip.pos["x"] === undefined || blip.pos["y"] === undefined || blip.pos["z"] === undefined) { 360 | socketLog.debug("Invalid position: %o", blip.pos); 361 | socketLog.warn("Blip position invalid"); 362 | return false; 363 | } 364 | 365 | if (typeof (blip.pos.x) !== "number" || typeof (blip.pos.y) !== "number" || typeof (blip.pos.z) !== "number") { 366 | socketLog.warn("Blip pos must be numbers"); 367 | socketLog.debug("Invalid position: %o", blip.pos); 368 | return false; 369 | } 370 | 371 | return true; 372 | }; 373 | 374 | // The old, internal events... I can now just call them so... Make them functions! 375 | const AddPlayerData = (identifier, key, data) => { 376 | UpdatePlayerData(identifier, key, data); // It'll get added in here anyways... 377 | }; 378 | const UpdatePlayerData = (identifier, key, data) => { 379 | if (!checkInputs(identifier, key, data)) { 380 | return; 381 | } 382 | makeSurePlayerExists(identifier); 383 | 384 | playerData[identifier][key] = data; 385 | }; 386 | const RemovePlayerData = (identifier, key) => { 387 | if(!checkInputs(identifier, key, "s")) { 388 | return; 389 | } 390 | makeSurePlayerExists(identifier); 391 | 392 | if (playerData[identifier][key] !== undefined) { 393 | delete playerData[identifier][key]; 394 | } 395 | }; 396 | const RemovePlayer = (identifier) => { 397 | if (!identifier) { 398 | socketLog.warn("Cannot remove player with no identifier"); 399 | return; 400 | } 401 | 402 | delete playerData[identifier]; 403 | websocketServer.broadcast(JSON.stringify({ 404 | type: "playerLeft", 405 | payload: identifier 406 | })); 407 | }; 408 | const AddBlip = (blip) => { 409 | if(!validBlip(blip)) { 410 | return; 411 | } 412 | 413 | websocketServer.broadcast(JSON.stringify({ 414 | type: "addBlip", 415 | payload: blip 416 | })); 417 | }; 418 | const RemoveBlip = (blip) => { 419 | if(!validBlip(blip)) { 420 | return; 421 | } 422 | 423 | websocketServer.broadcast(JSON.stringify({ 424 | type: "removeBlip", 425 | payload: blip 426 | })); 427 | }; 428 | const UpdateBlip = (blip) => { 429 | if(!validBlip(blip)) { 430 | return; 431 | } 432 | 433 | websocketServer.broadcast(JSON.stringify({ 434 | type: "updateBlip", 435 | payload: blip 436 | })); 437 | }; 438 | 439 | return { 440 | hook, 441 | SendPlayerData, 442 | AddPlayerData, 443 | UpdatePlayerData, 444 | RemovePlayerData, 445 | RemovePlayer, 446 | AddBlip, 447 | UpdateBlip, 448 | RemoveBlip, 449 | }; 450 | }; 451 | 452 | module.exports = SocketController; 453 | 454 | /***/ }), 455 | 456 | /***/ 607: 457 | /***/ ((module, __unused_webpack_exports, __webpack_require__) => { 458 | 459 | const wrapperLog = __webpack_require__(731).getLogger("LiveMap Wrapper"); 460 | 461 | const EventsWrapper = (SocketController) => { 462 | 463 | const setStaticData = (source, id) => { 464 | SocketController.AddPlayerData(id, "identifier", id); 465 | SocketController.AddPlayerData(id, "name", GetPlayerName(source)); 466 | }; 467 | 468 | onNet("onResourceStart", (name) => { 469 | if (name == GetCurrentResourceName()){ 470 | if (GetNumPlayerIndices() !== 0){ 471 | wrapperLog.info("Players on the server... Initializing them"); 472 | for(let i = 0; i < GetNumPlayerIndices(); i++){ 473 | const id = GetPlayerIdentifier(GetPlayerFromIndex(i), 0); 474 | setStaticData(GetPlayerFromIndex(i), id); 475 | } 476 | } 477 | } 478 | }); 479 | 480 | onNet("livemap:playerSpawned", () => { 481 | setStaticData(source, GetPlayerIdentifier(source)); 482 | }); 483 | 484 | onNet("livemap:AddPlayerData", (k, d) => { 485 | SocketController.AddPlayerData(GetPlayerIdentifier(source, 0), k, d); 486 | }); 487 | 488 | onNet("livemap:UpdatePlayerData", (k, d) => { 489 | SocketController.UpdatePlayerData(GetPlayerIdentifier(source, 0), k, d); 490 | }); 491 | 492 | onNet("livemap:RemovePlayerData", (k) => { 493 | SocketController.RemovePlayerData(GetPlayerIdentifier(source, 0), k); 494 | }); 495 | 496 | onNet("livemap:RemovePlayer", () => { 497 | SocketController.RemovePlayer(GetPlayerIdentifier(source, 0)); 498 | }); 499 | 500 | onNet("playerDropped", () => { 501 | SocketController.RemovePlayer(GetPlayerIdentifier(source, 0)); 502 | }); 503 | 504 | // Internal events for server-side scripts. See https://github.com/TGRHavoc/live_map/issues/45 505 | on("livemap:internal_AddPlayerData", (id, k, d) => { 506 | SocketController.AddPlayerData(id, k, d); 507 | }); 508 | 509 | on("livemap:internal_UpdatePlayerData", (id, k, d) => { 510 | SocketController.UpdatePlayerData(id, k, d); 511 | }); 512 | 513 | on("livemap:internal_RemovePlayerData", (id, k) => { 514 | SocketController.RemovePlayerData(id, k); 515 | }); 516 | 517 | on("livemap:internal_RemovePlayer", (id) => { 518 | SocketController.RemovePlayer(id); 519 | }); 520 | 521 | return {}; 522 | }; 523 | 524 | module.exports = EventsWrapper; 525 | 526 | /***/ }), 527 | 528 | /***/ 747: 529 | /***/ ((module) => { 530 | 531 | "use strict"; 532 | module.exports = require("fs");; 533 | 534 | /***/ }), 535 | 536 | /***/ 605: 537 | /***/ ((module) => { 538 | 539 | "use strict"; 540 | module.exports = require("http");; 541 | 542 | /***/ }), 543 | 544 | /***/ 639: 545 | /***/ ((module) => { 546 | 547 | "use strict"; 548 | module.exports = require("koa");; 549 | 550 | /***/ }), 551 | 552 | /***/ 775: 553 | /***/ ((module) => { 554 | 555 | "use strict"; 556 | module.exports = require("koa-body");; 557 | 558 | /***/ }), 559 | 560 | /***/ 757: 561 | /***/ ((module) => { 562 | 563 | "use strict"; 564 | module.exports = require("koa-router");; 565 | 566 | /***/ }), 567 | 568 | /***/ 622: 569 | /***/ ((module) => { 570 | 571 | "use strict"; 572 | module.exports = require("path");; 573 | 574 | /***/ }), 575 | 576 | /***/ 731: 577 | /***/ ((module) => { 578 | 579 | "use strict"; 580 | module.exports = require("simple-console-logger");; 581 | 582 | /***/ }), 583 | 584 | /***/ 439: 585 | /***/ ((module) => { 586 | 587 | "use strict"; 588 | module.exports = require("ws");; 589 | 590 | /***/ }) 591 | 592 | /******/ }); 593 | /************************************************************************/ 594 | /******/ // The module cache 595 | /******/ var __webpack_module_cache__ = {}; 596 | /******/ 597 | /******/ // The require function 598 | /******/ function __webpack_require__(moduleId) { 599 | /******/ // Check if module is in cache 600 | /******/ var cachedModule = __webpack_module_cache__[moduleId]; 601 | /******/ if (cachedModule !== undefined) { 602 | /******/ return cachedModule.exports; 603 | /******/ } 604 | /******/ // Create a new module (and put it into the cache) 605 | /******/ var module = __webpack_module_cache__[moduleId] = { 606 | /******/ // no module.id needed 607 | /******/ // no module.loaded needed 608 | /******/ exports: {} 609 | /******/ }; 610 | /******/ 611 | /******/ // Execute the module function 612 | /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); 613 | /******/ 614 | /******/ // Return the exports of the module 615 | /******/ return module.exports; 616 | /******/ } 617 | /******/ 618 | /************************************************************************/ 619 | var __webpack_exports__ = {}; 620 | // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 621 | (() => { 622 | const Koa = __webpack_require__(639); 623 | const koaBody = __webpack_require__(775); 624 | const Router = __webpack_require__(757); 625 | const WS = __webpack_require__(439); 626 | const http = __webpack_require__(605); 627 | const logger = __webpack_require__(731); 628 | 629 | const app = new Koa(); 630 | const server = http.createServer(app.callback()); 631 | const router = new Router(); 632 | const wss = new WS.Server({ server }); 633 | 634 | const debugLevel = GetConvar("livemap_debug_level", "warn"); 635 | const access = GetConvar("livemap_access_control", "*"); 636 | 637 | logger.configure({ 638 | level: debugLevel 639 | }); 640 | const log = logger.getLogger("LiveMap"); 641 | 642 | router.use(async (ctx, next) => { 643 | ctx.response.append("Access-Control-Allow-Origin", access); 644 | next(); 645 | }); 646 | 647 | const SocketController = __webpack_require__(376)(access); 648 | SocketController.hook(wss); 649 | 650 | __webpack_require__(607)(SocketController); 651 | 652 | // Passing the SocketController through as we need it to keep blips updated on the client. Plus, I can't seem to just "require" the server in the BlipController. 653 | const BlipController = __webpack_require__(529)(SocketController); 654 | 655 | router.get("/blips", BlipController.getBlips); 656 | router.get("/blips.json", BlipController.getBlips); 657 | 658 | app.use(koaBody( 659 | { 660 | patchKoa: true, 661 | })) 662 | .use(router.routes()) 663 | .use(router.allowedMethods()); 664 | 665 | // Start a server on the socket_port... 666 | const port = GetConvarInt("socket_port", 30121); 667 | 668 | server.listen(port, "127.0.0.1", function listening() { 669 | log.info("Listening on %d", port); 670 | }); 671 | 672 | setInterval(SocketController.SendPlayerData, GetConvarInt("livemap_milliseconds", 500)); // Default = half a second. 673 | 674 | })(); 675 | 676 | /******/ })() 677 | ; -------------------------------------------------------------------------------- /docs/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### [3.2.1](https://github.com/TGRHavoc/live_map/compare/v3.2.0...v3.2.1) (2021-12-28) 4 | 5 | ## [3.2.0](https://github.com/TGRHavoc/live_map/compare/v3.1.4...v3.2.0) (2021-10-20) 6 | 7 | 8 | ### Features 9 | 10 | * add setup_nucleus ([cabc04b](https://github.com/TGRHavoc/live_map/commit/cabc04be435899c6d11e4b13781c6d5ff1686876)) 11 | * remove example_client comments in fxmanifest ([7599741](https://github.com/TGRHavoc/live_map/commit/7599741562f99224186c2c3e234a02a08bce7edc)) 12 | 13 | 14 | 15 | ## [3.1.4](https://github.com/TGRHavoc/live_map/compare/v3.1.3...v3.1.4) (2021-08-25) 16 | 17 | 18 | ### Bug Fixes 19 | 20 | * syntax error ([780322b](https://github.com/TGRHavoc/live_map/commit/780322bf785ec2a9f2eb1e88dff4e2b38a407349)) 21 | 22 | 23 | 24 | ## [3.1.3](https://github.com/TGRHavoc/live_map/compare/v3.1.2...v3.1.3) (2021-08-25) 25 | 26 | 27 | ### Bug Fixes 28 | 29 | * License plate not being removed when not in a vehicle ([5b276d8](https://github.com/TGRHavoc/live_map/commit/5b276d8a57f331a08cb40547761eb70cdfa28944)), closes [#68](https://github.com/TGRHavoc/live_map/issues/68) 30 | 31 | 32 | 33 | ## [3.1.2](https://github.com/TGRHavoc/live_map/compare/v3.1.1...v3.1.2) (2021-07-14) 34 | 35 | 36 | 37 | ## [3.1.1](https://github.com/TGRHavoc/live_map/compare/v3.1.0...v3.1.1) (2021-06-17) 38 | 39 | 40 | ### Bug Fixes 41 | 42 | * standard-version commit message ([5a1e6c8](https://github.com/TGRHavoc/live_map/commit/5a1e6c8b5efedf612677f3a8c2f23ec50d066b49)) 43 | 44 | 45 | 46 | # [3.1.0](https://github.com/TGRHavoc/live_map/compare/v3.0.1...v3.1.0) (2021-05-15) 47 | 48 | 49 | ### Features 50 | 51 | * add livemap bundle ([441b8b5](https://github.com/TGRHavoc/live_map/commit/441b8b5d8b12eda1a97e3e035cabe9a8cfe7a895)) 52 | 53 | 54 | 55 | ## [3.0.1](https://github.com/TGRHavoc/live_map/compare/v3.0.0...v3.0.1) (2021-05-15) 56 | 57 | 58 | ### Bug Fixes 59 | 60 | * livemap not starting ([75491f0](https://github.com/TGRHavoc/live_map/commit/75491f0ae6744e6622c76843b6d1ebe0f75de918)) 61 | * livemap not starting with latest fivem ([05e4217](https://github.com/TGRHavoc/live_map/commit/05e4217fe1b1b3337797574b5019642594c8d1bd)) 62 | 63 | 64 | 65 | # [3.0.0](https://github.com/TGRHavoc/live_map/compare/v2.3.4...v3.0.0) (2021-05-05) 66 | 67 | 68 | ### Bug Fixes 69 | 70 | * typo in docs.bat ([172eb10](https://github.com/TGRHavoc/live_map/commit/172eb1016075e006a71b55362e32c941ac4cda88)) 71 | 72 | 73 | ### Features 74 | 75 | * remove old files from server before deploying ([3e9a9ad](https://github.com/TGRHavoc/live_map/commit/3e9a9adbbe65d308d82eac5ebdb1723ab490195b)) 76 | 77 | 78 | 79 | ## [2.3.4](https://github.com/TGRHavoc/live_map/compare/v2.3.2...v2.3.4) (2019-07-11) 80 | 81 | 82 | ### Bug Fixes 83 | 84 | * blip file errors ([6e85c30](https://github.com/TGRHavoc/live_map/commit/6e85c30f5998a86897a69c91859ac673f1cc2c55)) 85 | * directory not being created for blips file ([907c4ea](https://github.com/TGRHavoc/live_map/commit/907c4eae105670c3d9863140010de304d7df5c2c)) 86 | 87 | 88 | 89 | ## [2.3.2](https://github.com/TGRHavoc/live_map/compare/v2.3.1...v2.3.2) (2019-06-11) 90 | 91 | 92 | ### Bug Fixes 93 | 94 | * **sockets:** removeplayer function `paylod` -> `payload` ([0a5de15](https://github.com/TGRHavoc/live_map/commit/0a5de151d8e4d5bb6498924dfd9e911a610e6abb)) 95 | 96 | 97 | 98 | ## [2.3.1](https://github.com/TGRHavoc/live_map/compare/v2.3.0...v2.3.1) (2019-06-10) 99 | 100 | 101 | ### Bug Fixes 102 | 103 | * players not being removed after leaving server ([81811fb](https://github.com/TGRHavoc/live_map/commit/81811fb53e43a93004826cdfa0d54b6be1d214ef)) 104 | * webpack and other dependencies not loading ([e1de1d6](https://github.com/TGRHavoc/live_map/commit/e1de1d6b866ea07a7104ca2faf2f13283a39f4b0)) 105 | 106 | 107 | 108 | # [2.3.0](https://github.com/TGRHavoc/live_map/compare/v2.2.12...v2.3.0) (2019-06-09) 109 | 110 | 111 | ### Bug Fixes 112 | 113 | * **blips:** addblip incorrectly reporting duplicate blips ([b70b345](https://github.com/TGRHavoc/live_map/commit/b70b345d9d2e000dcbf5cc1a9d2687db726105a9)) 114 | * events wrapper not being used ([c3f31ae](https://github.com/TGRHavoc/live_map/commit/c3f31aebc2130923352201fea033b775dc890a51)) 115 | 116 | 117 | ### Features 118 | 119 | * add basic blip controller ([64ff008](https://github.com/TGRHavoc/live_map/commit/64ff0084e0d46e21554242fd189983ae4a24235f)) 120 | * add basic server for node ([7892791](https://github.com/TGRHavoc/live_map/commit/7892791131ffe716efa0e29cd9d270306fe8172a)) 121 | * add basic websocket server ([5bbee05](https://github.com/TGRHavoc/live_map/commit/5bbee05b6714f12a25356d16798bdbcc4b048822)) 122 | * add webpack ([6b0e711](https://github.com/TGRHavoc/live_map/commit/6b0e71126ee308c0b6a90429fac107bd9dce0e8d)) 123 | * fully implement socketcontroller ([9a206ef](https://github.com/TGRHavoc/live_map/commit/9a206effef01ce9aeaeac73dc3952f7a810bec8b)) 124 | * move blip_server to node ([744ac41](https://github.com/TGRHavoc/live_map/commit/744ac4105bacd78a0fbc9c022a334b3cdc14523d)) 125 | * move wrapper to node ([e67776f](https://github.com/TGRHavoc/live_map/commit/e67776f99c01b2e5fd03685891d28cdf8cd443d4)) 126 | 127 | 128 | 129 | ## [2.2.12](https://github.com/TGRHavoc/live_map/compare/v2.2.0...v2.2.12) (2019-05-17) 130 | 131 | 132 | ### Features 133 | 134 | * add location display and more ([cb5be6f](https://github.com/TGRHavoc/live_map/commit/cb5be6fcba75caa4b26d3aaa64840a2581b337c3)) 135 | * add location to player data ([db610a7](https://github.com/TGRHavoc/live_map/commit/db610a73051adf8b0cec3bda43749a69868e6fa1)) 136 | * add plate check to client.lua ([4b783ff](https://github.com/TGRHavoc/live_map/commit/4b783ff4a68cab0a6300f78b0f27de131ef52c17)) 137 | * add reverse_car_hashes ([4774170](https://github.com/TGRHavoc/live_map/commit/4774170e3040085ddaaed566210c3a5a774a67a2)) 138 | 139 | 140 | 141 | # [2.2.0](https://github.com/TGRHavoc/live_map/compare/v2.1.8...v2.2.0) (2019-05-17) 142 | 143 | 144 | ### Bug Fixes 145 | 146 | * add null checks to various API functions ([bbfc23b](https://github.com/TGRHavoc/live_map/commit/bbfc23bae8c7b118fd302a2842ee6d460b3e7847)), closes [#24](https://github.com/TGRHavoc/live_map/issues/24) 147 | * player location not being sent to sockets ([0974a65](https://github.com/TGRHavoc/live_map/commit/0974a651678f4e53f805a9e31c0d30b06b02cc2b)), closes [#21](https://github.com/TGRHavoc/live_map/issues/21) 148 | * too many files open error ([345e266](https://github.com/TGRHavoc/live_map/commit/345e2662707b70537eb5d38b6056ce6396ad7e90)) 149 | * typo in client.lua and SocketHandler ([461e92c](https://github.com/TGRHavoc/live_map/commit/461e92c52472f280831f0c49bba40fe211fa7ef7)) 150 | 151 | 152 | 153 | ## [2.1.8](https://github.com/TGRHavoc/live_map/compare/v2.1.7...v2.1.8) (2019-05-17) 154 | 155 | 156 | ### Bug Fixes 157 | 158 | * async issues ([f51e974](https://github.com/TGRHavoc/live_map/commit/f51e974ac17780c49fc0865de9826bf94af4b6f9)) 159 | * async write errors ([64583fe](https://github.com/TGRHavoc/live_map/commit/64583fe363c0bb25223bff43d9dbf6584efc7d16)) 160 | * Server_OnError error ([265b3b6](https://github.com/TGRHavoc/live_map/commit/265b3b66c8c544c3922dc1b263087bf78358d98e)) 161 | 162 | 163 | ### Features 164 | 165 | * add event handlers for blips ([acc71d4](https://github.com/TGRHavoc/live_map/commit/acc71d443fddd1a9cd6b31daa320761b2f4403f9)) 166 | 167 | 168 | 169 | ## [2.1.7](https://github.com/TGRHavoc/live_map/compare/v2.1.6...v2.1.7) (2019-05-17) 170 | 171 | 172 | ### Bug Fixes 173 | 174 | * race condition and null data ([5a37bfc](https://github.com/TGRHavoc/live_map/commit/5a37bfc44bc80450b35220bf37bb5b5a271441c9)) 175 | 176 | 177 | 178 | ## [2.1.6](https://github.com/TGRHavoc/live_map/compare/v2.1.4...v2.1.6) (2019-05-17) 179 | 180 | 181 | ### Bug Fixes 182 | 183 | * clients crashing when player leaves ([ba7aa6f](https://github.com/TGRHavoc/live_map/commit/ba7aa6f0dcb6249b15a91e085aa30154dc3decf3)) 184 | 185 | 186 | 187 | ## [2.1.4](https://github.com/TGRHavoc/live_map/compare/v2.1.3...v2.1.4) (2019-05-17) 188 | 189 | 190 | ### Bug Fixes 191 | 192 | * sending client data when websocket disconnects ([f12837f](https://github.com/TGRHavoc/live_map/commit/f12837f7b7d69b74a80a35ad1d5f7a660e3e96bf)) 193 | 194 | 195 | ### Features 196 | 197 | * add update_check ([c592948](https://github.com/TGRHavoc/live_map/commit/c592948bdaab0a40218a70c355dadb2ee1400236)) 198 | 199 | 200 | 201 | ## [2.1.3](https://github.com/TGRHavoc/live_map/compare/v2.1.2...v2.1.3) (2019-05-17) 202 | 203 | 204 | ### Bug Fixes 205 | 206 | * listener only listening on loopback address ([2cb24eb](https://github.com/TGRHavoc/live_map/commit/2cb24ebd949b307514118f0c9bd6d4dc2859b03e)) 207 | 208 | 209 | 210 | ## [2.1.2](https://github.com/TGRHavoc/live_map/compare/v2.1.1...v2.1.2) (2019-05-17) 211 | 212 | 213 | 214 | ## [2.1.1](https://github.com/TGRHavoc/live_map/compare/v2.1.0...v2.1.1) (2019-05-17) 215 | 216 | 217 | 218 | # [2.1.0](https://github.com/TGRHavoc/live_map/compare/v2.0.0...v2.1.0) (2019-05-17) 219 | 220 | 221 | ### Bug Fixes 222 | 223 | * events not being registered ([963711b](https://github.com/TGRHavoc/live_map/commit/963711be61c2b04e25ef653cba9a3fba07eb3a1e)) 224 | 225 | 226 | ### Features 227 | 228 | * add ability to remove players and data ([37c03b3](https://github.com/TGRHavoc/live_map/commit/37c03b36ac8c8c2b3a8a6a66ca0756b07f88ba20)) 229 | * add allow-origin header ([b1bb783](https://github.com/TGRHavoc/live_map/commit/b1bb783b33827e181d2215966f336cddfd73051a)) 230 | * add blip generation with command ([afb9996](https://github.com/TGRHavoc/live_map/commit/afb9996d3b801726a4014b6dc46a20bc312d5e58)), closes [#3](https://github.com/TGRHavoc/live_map/issues/3) 231 | * add blip helper ([dde519d](https://github.com/TGRHavoc/live_map/commit/dde519dbe0c1f1f0145287606a9e074c6179a2f5)), closes [#2](https://github.com/TGRHavoc/live_map/issues/2) [#2](https://github.com/TGRHavoc/live_map/issues/2) 232 | * add blips.json file ([d250dda](https://github.com/TGRHavoc/live_map/commit/d250dda378fcd12bed9bcfac59e8af1ca43a0b70)), closes [#5](https://github.com/TGRHavoc/live_map/issues/5) 233 | * add default client file ([8dca6b3](https://github.com/TGRHavoc/live_map/commit/8dca6b32d444263a916b813559003a87afbda40c)) 234 | * add reverse weapon hash file ([58d9bb9](https://github.com/TGRHavoc/live_map/commit/58d9bb9565a369c629f208cae4bbc4d54941667e)) 235 | * add vehicle icons ([69208fb](https://github.com/TGRHavoc/live_map/commit/69208fb372a5ae651a3bfcb57c95efaf8e2bee7b)) 236 | * update various blip mechanics ([5b5a193](https://github.com/TGRHavoc/live_map/commit/5b5a19353bc119d4627668b79d834f93e7043ac5)) 237 | 238 | 239 | 240 | # [2.0.0](https://github.com/TGRHavoc/live_map/compare/v1.0.0...v2.0.0) (2019-05-17) 241 | 242 | 243 | ### Features 244 | 245 | * ability to add custom data to players ([60af4ea](https://github.com/TGRHavoc/live_map/commit/60af4ea2f60195f4b5fe0340e4f09192903e67d2)) 246 | * add blip helper ([0e22f14](https://github.com/TGRHavoc/live_map/commit/0e22f14ba31ec71bb4cf10adee1785a92d6054a4)) 247 | * add gas station blips ([ce6f4eb](https://github.com/TGRHavoc/live_map/commit/ce6f4eb1fd2540632a504becb97b2104810fb7f2)) 248 | * add lua files ([11a5e5f](https://github.com/TGRHavoc/live_map/commit/11a5e5fe54e4ed57583bd1dbdce2c4f3bd65ff74)) 249 | * add utility events ([cfe1843](https://github.com/TGRHavoc/live_map/commit/cfe1843bfeaa207cecac3338577d16b6cc841d4a)) 250 | * add vehicle data to player ([e262ac8](https://github.com/TGRHavoc/live_map/commit/e262ac812a94387fbf94c1f5fb2a5f7ac7de1b3d)) 251 | * fx server compatability ([fee9958](https://github.com/TGRHavoc/live_map/commit/fee9958c017a7dbe7051e4dfa39fea7604c11757)), closes [#4](https://github.com/TGRHavoc/live_map/issues/4) [#1](https://github.com/TGRHavoc/live_map/issues/1) 252 | * ssl support ([4358ec9](https://github.com/TGRHavoc/live_map/commit/4358ec93d0ce91fe07a193ae71c3c9f785ba10b0)) 253 | 254 | 255 | 256 | # [1.0.0](https://github.com/TGRHavoc/live_map/compare/f199f9471e078aa0866f260655bfe24d5d3243cb...v1.0.0) (2019-05-17) 257 | 258 | 259 | ### Features 260 | 261 | * clear jarrays when stopped ([f199f94](https://github.com/TGRHavoc/live_map/commit/f199f9471e078aa0866f260655bfe24d5d3243cb)) 262 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | # LiveMap Resource (for FiveM) 2 | 3 | [![All Contributors](https://img.shields.io/badge/all_contributors-10-orange.svg?style=flat-square)](#contributors-) 4 | 5 | 6 | This is the "backend" code for the live_map addon for FiveM that is ran on the FiveM game server. 7 | It creates a websocket server so that it can communicate to the web interface. 8 | 9 | - [How to install](#how-to-install) 10 | - [Configuration](#configuration) 11 | - [Events](#events) 12 | - [Contributors ✨](#contributors-) 13 | 14 | ## How to install 15 | 16 | Download the ZIP file. And extract the contents into `resources/live_map/`. 17 | 18 | Add the following to your server.cfg file. 19 | 20 | ``` 21 | set socket_port 30121 22 | set livemap_debug "warn" # "[all]" 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'off' 23 | set blip_file "server/blips.json" 24 | set livemap_access_control "*" 25 | set livemap_use_nucleus true # Allow livemap to set up a secure reverseProxy using the Nucleus project 26 | 27 | ensure live_map 28 | ``` 29 | 30 | To get the in-game blips to show on the interface, you will need to generate a "blips" file. 31 | This can be easily done with the in-game command `blips generate` (must have permission, see [the offical documentation](https://docs.fivem.net/docs/server-manual/server-commands/#access-control-commands)). 32 | 33 | ## Configuration 34 | 35 | Please see the [config](config.md) file for the convars used by this resource. 36 | 37 | ## Events 38 | 39 | In an effort to make the addon useful to other developers, I've created a few events that can be used to make changes to the data being sent to the UI. 40 | 41 | Please see the [events page](events.md) for more information. 42 | 43 | ## Contributors ✨ 44 | 45 | Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)): 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 |

Jordan Dalton

💻 🐛 🤔 📖

AciD

🐛

David Wheatley

🐛

KjayCopper

⚠️

jiynn

🐛

mbergwall2222

🐛

Jasen Samuels

🐛

Avery Johnson

💻

Tom

💻

matsn0w

🐛 💻
66 | 67 | 68 | 69 | 70 | 71 | 72 | This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome! 73 | -------------------------------------------------------------------------------- /docs/config.md: -------------------------------------------------------------------------------- 1 | # Configuring the resource 2 | ## Convars 3 | The following convars are available for you to change. 4 | 5 | You should already have them in your server.cfg file and looking like the config below. 6 | 7 | ```config 8 | set socket_port 30121 9 | set livemap_debug "warn" # "[all]" 'trace', 'debug', 'info', 'warn', 'error', 'fatal', 'off' 10 | set blip_file "server/blips.json" 11 | set livemap_access_control "*" 12 | set livemap_use_nucleus true # Allow livemap to set up a secure reverseProxy using the Nucleus project 13 | ``` 14 | 15 | ### socket_port 16 | 17 | - **Type**: `number` 18 | - **Default Value**: `0` 19 | 20 | Sets the port the socket server should listen on 21 | 22 | ### livemap_debug 23 | 24 | - **Type**: `string` 25 | - **Default Value**: `warn` 26 | 27 | Sets how much information gets printed to the console. 28 | - `[all]` - Print _all_ messages. 29 | - `trace` - Pretty much the same as "all". 30 | - `debug` - Show debug and higher messages. 31 | - `info` - Show informational messages and higher (e.g. when blips are saved to file); 32 | - `warn` - Show warning messages and higher. Warnings shouldn't interfere with the resource working but, should be looked at. 33 | - `error` - Not used. 34 | - `fatal` - Not used. 35 | - `off` - Turns off _all_ messages. 36 | 37 | ### blip_file 38 | 39 | - **Type**: `string` 40 | - **Default Value**: `server/blips.json` 41 | 42 | Sets the file that will contain the generated blips that is exposed via HTTP. 43 | 44 | This directory should be **writeable** by the FXServer process (on Linux, the user who is running the FX process). 45 | 46 | ### livemap_access_control 47 | 48 | - **Type**: `string` 49 | - **Default Value**: `*` 50 | 51 | Sets the domain that is allowed to access the blips.json file. 52 | 53 | E.g. "https://example.com" will only allow the UI on http://example.com to get the blips), "*" will allow everyone no matter the domain. 54 | 55 | !!! info "Note" 56 | 57 | Only use "*" if you don't mind _anyone_ being able to access your 58 | player's data and your blip data. 59 | It is recommended that you set this to your own website. 60 | 61 | ### livemap_use_nucleus 62 | 63 | - **Type**: `boolean` 64 | - **Default Value**: `true` 65 | 66 | Sets wether LiveMap should use the nucleus project to set up a secure proxy to the websocket. 67 | It will print out the reverseProxy values you should use in the interface's config file. 68 | 69 | ??? example "Example output" 70 | ``` 71 | ------------------------------------------------------------------- 72 | ------------------------------------------------------------------- 73 | ------------------------------------------------------------------- 74 | Hey! LiveMap was able to use the Nucleus project to automatically set up a secure proxy to the resource. 75 | If you want to use this in your config use the revserProxy settings printed below (https://docs.tgrhavoc.co.uk/livemap-interface/reverse_proxy/) 76 | If you don't want to use Nucleus then put "set livemap_use_nucleus false" in your server.cfg file. 77 | "reverseProxy": {"blips": "https://monitor-somthing.users.cfx.re/blips", "socket": "wss://monitor-somthing.users.cfx.re/"} 78 | ------------------------------------------------------------------- 79 | ------------------------------------------------------------------- 80 | ------------------------------------------------------------------- 81 | ``` 82 | 83 | -------------------------------------------------------------------------------- /docs/events.md: -------------------------------------------------------------------------------- 1 | # Events / API 2 | 3 | - [Client to server](#client-to-server) 4 | - [livemap:AddPlayerData(key, data)](#livemapaddplayerdatakey-data) 5 | - [livemap:UpdatePlayerData(key, data)](#livemapupdateplayerdatakey-data) 6 | - [livemap:RemovePlayerData(key)](#livemapremoveplayerdatakey) 7 | - [livemap:RemovePlayer(void)](#livemapremoveplayervoid) 8 | - [Server Events](#server-events) 9 | - [livemap:internal_AddPlayerData(identifier, key, data)](#livemapinternal_addplayerdataidentifier-key-data) 10 | - [livemap:internal_UpdatePlayerData(identifier, key, data)](#livemapinternal_updateplayerdataidentifier-key-data) 11 | - [livemap:internal_RemovePlayerData(identifier, key)](#livemapinternal_removeplayerdataidentifier-key) 12 | - [livemap:internal_RemovePlayer(identifier)](#livemapinternal_removeplayeridentifier) 13 | 14 | 15 | ## Client to server 16 | 17 | Below you can find some info on the server events that __must__ be triggered by the client. 18 | 19 | > Note: When using `livemap:AddPlayerData` or `livemap:UpdatePlayerData` if the player has been removed using `livemap:RemovePlayer` they will be tracked again. 20 | 21 | ### livemap:AddPlayerData(key, data) 22 | 23 | Adds data to a player that gets sent over the Websocket. 24 | 25 | #### Parameters 26 | 27 | **key** 28 | 29 | - **Type**: `string` 30 | - **Description**: The name of the data to add to the player (e.g. "name"). 31 | 32 | **data** 33 | 34 | - **Type**: `any` 35 | - **Description**: The value of the data being added (e.g. "TGRHavoc") 36 | 37 | #### Examples 38 | 39 | ```lua 40 | -- Set the player's "Name" to "Havoc" 41 | TriggerServerEvent("livemap:AddPlayerData", "Name", "Havoc") 42 | 43 | -- Pseudo code to add the player's age after they set it 44 | RegisterEventHandler("playerSetAgeTo", function(newAge) 45 | TriggerServerEvent("livemap:AddPlayerData", "Age", newAge) 46 | end) 47 | ``` 48 | 49 | ### livemap:UpdatePlayerData(key, data) 50 | 51 | Updates the data that is associated with the player. Uses the same "key" as the above event. 52 | 53 | > Note: If the player doesn't have any data with the given key, it will be added. 54 | 55 | #### Parameters 56 | 57 | **key** 58 | 59 | - **Type**: `string` 60 | - **Description**: The name of the data to update on the player (e.g. "name"). 61 | 62 | **data** 63 | 64 | - **Type**: `any` 65 | - **Description**: The value of the data being updated (e.g. "Some Other Name") 66 | 67 | #### Examples 68 | 69 | ```lua 70 | -- Update the player's name to "John Doe" 71 | TriggerServerEvent("livemap:UpdatePlayerData", "Name", "John Doe") 72 | 73 | -- Pseudo code to update the player's name when they change it 74 | if PlayerChangesName(PlayerId()) then 75 | TriggerServerEvent("livemap:UpdatePlayerData", "Name", GetPlayerName(PlayerId())) 76 | end 77 | ``` 78 | 79 | ### livemap:RemovePlayerData(key) 80 | 81 | Removed data associated with the player. Uses the same "key" as the above events. 82 | 83 | !!! warning 84 | If at _any_ point after this, you call the AddPlayerData or UpdatePlayerData events 85 | the data will be added back to the player. 86 | 87 | #### Parameters 88 | 89 | **key** 90 | 91 | - **Type**: `string` 92 | - **Description**: The name of the data to remove from the player (e.g. "name"). 93 | 94 | #### Examples 95 | 96 | ```lua 97 | -- Remove "Name" from the player (stops displaying it in the UI) 98 | TriggerServerEvent("livemap:RemovePlayerData", "Name") 99 | 100 | -- Pseudo code to remove player's who age is less then 18 101 | if GetPlayerAge(PlayerId()) < 18 then 102 | TriggerServerEvent("livemap:RemovePlayerData", "Age") 103 | end 104 | ``` 105 | 106 | ### livemap:RemovePlayer(void) 107 | 108 | Stops sending the player's data over websockets. 109 | 110 | !!! warning 111 | If at _any_ point after this, you call the AddPlayerData or UpdatePlayerData events 112 | the data added will be sent. 113 | 114 | This event should only be used if you know for 100% sure that no more data should be sent to the interface 115 | (e.g. if the player leaves the server). 116 | 117 | #### Parameters 118 | 119 | This events requires no parameters to be set. 120 | 121 | #### Examples 122 | 123 | ```lua 124 | -- Pseudo code to remove a player if they leave 125 | if NetworkIsPlayerActive(PlayerId()) then 126 | -- DO stuff to update the player data 127 | else 128 | TriggerServerEvent("livemap:RemovePlayer") 129 | end 130 | ``` 131 | 132 | ## Server Events 133 | 134 | Below you can find information on some server-only events. 135 | These can only be called on the server. 136 | 137 | ### livemap:internal_AddPlayerData(identifier, key, data) 138 | 139 | Adds data with the key that gets sent over Websockets for the player with the specified identifier. 140 | 141 | #### Parameters 142 | 143 | **identifier** 144 | 145 | - **Type**: `string` 146 | - **Description**: The identifier of the player (e.g. "steam:00000000000"). Usually gotten by the [GetPlayerIdentifier](https://docs.fivem.net/natives/?_0x7302DBCF) native. 147 | 148 | **key** 149 | 150 | - **Type**: `string` 151 | - **Description**: The name of the data to add to the player (e.g. "name"). 152 | 153 | **data** 154 | 155 | - **Type**: `any` 156 | - **Description**: The value of the data being added (e.g. "TGRHavoc") 157 | 158 | #### Examples 159 | 160 | ```lua 161 | -- Pseudo code to add player data when player spawns 162 | AddEventHandler("playerSpawned", function() 163 | -- Get the player's identifier 164 | identifier = GetPlayerIdentifier(source, 0) 165 | -- Set the player's "Name" to their name 166 | TriggerEvent("livemap:internal_AddPlayerData", identifier, "Name", GetPlayerName(source)) 167 | end) 168 | ``` 169 | 170 | ### livemap:internal_UpdatePlayerData(identifier, key, data) 171 | 172 | Updated the data that is associated with the player with the identifier. 173 | 174 | #### Parameters 175 | **identifier** 176 | 177 | - **Type**: `string` 178 | - **Description**: The identifier of the player (e.g. "steam:00000000000"). Usually gotten by the [GetPlayerIdentifier](https://docs.fivem.net/natives/?_0x7302DBCF) native. 179 | 180 | **key** 181 | 182 | - **Type**: `string` 183 | - **Description**: The name of the data to update on the player (e.g. "name"). 184 | 185 | **data** 186 | 187 | - **Type**: `any` 188 | - **Description**: The value that the data should be updated to (e.g. "Havoc's Real Name") 189 | 190 | #### Examples 191 | 192 | ```lua 193 | -- Pseudo code to change players name when they change it 194 | AddEventHandler("playerHasChangedNameByDead", function() 195 | -- Get the player's identifier 196 | identifier = GetPlayerIdentifier(source, 0) 197 | -- Set the player's "Name" to their name 198 | TriggerEvent("livemap:internal_UpdatePlayerData", identifier, "Name", GetPlayerName(source)) 199 | end) 200 | ``` 201 | 202 | ### livemap:internal_RemovePlayerData(identifier, key) 203 | 204 | Removed the data that is associated with the player with the identifier. 205 | 206 | #### Parameters 207 | **identifier** 208 | 209 | - **Type**: `string` 210 | - **Description**: The identifier of the player (e.g. "steam:00000000000"). Usually gotten by the [GetPlayerIdentifier](https://docs.fivem.net/natives/?_0x7302DBCF) native. 211 | 212 | **key** 213 | 214 | - **Type**: `string` 215 | - **Description**: The name of the data to update on the player (e.g. "name"). 216 | 217 | #### Examples 218 | 219 | ```lua 220 | -- Pseudo code to remove player's age if they're under 18 221 | AddEventHandler("playerHasAged", function(newAge) 222 | -- Get the player's identifier 223 | identifier = GetPlayerIdentifier(source, 0) 224 | 225 | if newAge < 18 then 226 | TriggerEvent("livemap:internal_RemovePlayerData", identifier, "Age") 227 | end 228 | end) 229 | ``` 230 | ### livemap:internal_RemovePlayer(identifier) 231 | 232 | Removes a player from the websocket data array (stops tracking the player) 233 | 234 | #### Parameters 235 | 236 | **identifier** 237 | 238 | - **Type**: `string` 239 | - **Description**: The identifier of the player (e.g. "steam:00000000000"). Usually gotten by the [GetPlayerIdentifier](https://docs.fivem.net/natives/?_0x7302DBCF) native. 240 | 241 | #### Examples 242 | 243 | ```lua 244 | -- Pseudo code to remove a player when they leave the server 245 | AddEventHandler("playerLeft", function() 246 | -- Get the player's identifier 247 | identifier = GetPlayerIdentifier(source, 0) 248 | TriggerEvent("livemap:internal_RemovePlayer", identifier) 249 | end) 250 | ``` 251 | -------------------------------------------------------------------------------- /docs/license.md: -------------------------------------------------------------------------------- 1 | GNU General Public License 2 | ========================== 3 | 4 | _Version 3, 29 June 2007_ 5 | _Copyright © 2007 Free Software Foundation, Inc. <>_ 6 | 7 | Everyone is permitted to copy and distribute verbatim copies of this license 8 | document, but changing it is not allowed. 9 | 10 | ## Preamble 11 | 12 | The GNU General Public License is a free, copyleft license for software and other 13 | kinds of works. 14 | 15 | The licenses for most software and other practical works are designed to take away 16 | your freedom to share and change the works. By contrast, the GNU General Public 17 | License is intended to guarantee your freedom to share and change all versions of a 18 | program--to make sure it remains free software for all its users. We, the Free 19 | Software Foundation, use the GNU General Public License for most of our software; it 20 | applies also to any other work released this way by its authors. You can apply it to 21 | your programs, too. 22 | 23 | When we speak of free software, we are referring to freedom, not price. Our General 24 | Public Licenses are designed to make sure that you have the freedom to distribute 25 | copies of free software (and charge for them if you wish), that you receive source 26 | code or can get it if you want it, that you can change the software or use pieces of 27 | it in new free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you these rights or 30 | asking you to surrender the rights. Therefore, you have certain responsibilities if 31 | you distribute copies of the software, or if you modify it: responsibilities to 32 | respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether gratis or for a fee, 35 | you must pass on to the recipients the same freedoms that you received. You must make 36 | sure that they, too, receive or can get the source code. And you must show them these 37 | terms so they know their rights. 38 | 39 | Developers that use the GNU GPL protect your rights with two steps: **(1)** assert 40 | copyright on the software, and **(2)** offer you this License giving you legal permission 41 | to copy, distribute and/or modify it. 42 | 43 | For the developers' and authors' protection, the GPL clearly explains that there is 44 | no warranty for this free software. For both users' and authors' sake, the GPL 45 | requires that modified versions be marked as changed, so that their problems will not 46 | be attributed erroneously to authors of previous versions. 47 | 48 | Some devices are designed to deny users access to install or run modified versions of 49 | the software inside them, although the manufacturer can do so. This is fundamentally 50 | incompatible with the aim of protecting users' freedom to change the software. The 51 | systematic pattern of such abuse occurs in the area of products for individuals to 52 | use, which is precisely where it is most unacceptable. Therefore, we have designed 53 | this version of the GPL to prohibit the practice for those products. If such problems 54 | arise substantially in other domains, we stand ready to extend this provision to 55 | those domains in future versions of the GPL, as needed to protect the freedom of 56 | users. 57 | 58 | Finally, every program is threatened constantly by software patents. States should 59 | not allow patents to restrict development and use of software on general-purpose 60 | computers, but in those that do, we wish to avoid the special danger that patents 61 | applied to a free program could make it effectively proprietary. To prevent this, the 62 | GPL assures that patents cannot be used to render the program non-free. 63 | 64 | The precise terms and conditions for copying, distribution and modification follow. 65 | 66 | ## TERMS AND CONDITIONS 67 | 68 | ### 0. Definitions 69 | 70 | “This License” refers to version 3 of the GNU General Public License. 71 | 72 | “Copyright” also means copyright-like laws that apply to other kinds of 73 | works, such as semiconductor masks. 74 | 75 | “The Program” refers to any copyrightable work licensed under this 76 | License. Each licensee is addressed as “you”. “Licensees” and 77 | “recipients” may be individuals or organizations. 78 | 79 | To “modify” a work means to copy from or adapt all or part of the work in 80 | a fashion requiring copyright permission, other than the making of an exact copy. The 81 | resulting work is called a “modified version” of the earlier work or a 82 | work “based on” the earlier work. 83 | 84 | A “covered work” means either the unmodified Program or a work based on 85 | the Program. 86 | 87 | To “propagate” a work means to do anything with it that, without 88 | permission, would make you directly or secondarily liable for infringement under 89 | applicable copyright law, except executing it on a computer or modifying a private 90 | copy. Propagation includes copying, distribution (with or without modification), 91 | making available to the public, and in some countries other activities as well. 92 | 93 | To “convey” a work means any kind of propagation that enables other 94 | parties to make or receive copies. Mere interaction with a user through a computer 95 | network, with no transfer of a copy, is not conveying. 96 | 97 | An interactive user interface displays “Appropriate Legal Notices” to the 98 | extent that it includes a convenient and prominently visible feature that **(1)** 99 | displays an appropriate copyright notice, and **(2)** tells the user that there is no 100 | warranty for the work (except to the extent that warranties are provided), that 101 | licensees may convey the work under this License, and how to view a copy of this 102 | License. If the interface presents a list of user commands or options, such as a 103 | menu, a prominent item in the list meets this criterion. 104 | 105 | ### 1. Source Code 106 | 107 | The “source code” for a work means the preferred form of the work for 108 | making modifications to it. “Object code” means any non-source form of a 109 | work. 110 | 111 | A “Standard Interface” means an interface that either is an official 112 | standard defined by a recognized standards body, or, in the case of interfaces 113 | specified for a particular programming language, one that is widely used among 114 | developers working in that language. 115 | 116 | The “System Libraries” of an executable work include anything, other than 117 | the work as a whole, that **(a)** is included in the normal form of packaging a Major 118 | Component, but which is not part of that Major Component, and **(b)** serves only to 119 | enable use of the work with that Major Component, or to implement a Standard 120 | Interface for which an implementation is available to the public in source code form. 121 | A “Major Component”, in this context, means a major essential component 122 | (kernel, window system, and so on) of the specific operating system (if any) on which 123 | the executable work runs, or a compiler used to produce the work, or an object code 124 | interpreter used to run it. 125 | 126 | The “Corresponding Source” for a work in object code form means all the 127 | source code needed to generate, install, and (for an executable work) run the object 128 | code and to modify the work, including scripts to control those activities. However, 129 | it does not include the work's System Libraries, or general-purpose tools or 130 | generally available free programs which are used unmodified in performing those 131 | activities but which are not part of the work. For example, Corresponding Source 132 | includes interface definition files associated with source files for the work, and 133 | the source code for shared libraries and dynamically linked subprograms that the work 134 | is specifically designed to require, such as by intimate data communication or 135 | control flow between those subprograms and other parts of the work. 136 | 137 | The Corresponding Source need not include anything that users can regenerate 138 | automatically from other parts of the Corresponding Source. 139 | 140 | The Corresponding Source for a work in source code form is that same work. 141 | 142 | ### 2. Basic Permissions 143 | 144 | All rights granted under this License are granted for the term of copyright on the 145 | Program, and are irrevocable provided the stated conditions are met. This License 146 | explicitly affirms your unlimited permission to run the unmodified Program. The 147 | output from running a covered work is covered by this License only if the output, 148 | given its content, constitutes a covered work. This License acknowledges your rights 149 | of fair use or other equivalent, as provided by copyright law. 150 | 151 | You may make, run and propagate covered works that you do not convey, without 152 | conditions so long as your license otherwise remains in force. You may convey covered 153 | works to others for the sole purpose of having them make modifications exclusively 154 | for you, or provide you with facilities for running those works, provided that you 155 | comply with the terms of this License in conveying all material for which you do not 156 | control copyright. Those thus making or running the covered works for you must do so 157 | exclusively on your behalf, under your direction and control, on terms that prohibit 158 | them from making any copies of your copyrighted material outside their relationship 159 | with you. 160 | 161 | Conveying under any other circumstances is permitted solely under the conditions 162 | stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 163 | 164 | ### 3. Protecting Users' Legal Rights From Anti-Circumvention Law 165 | 166 | No covered work shall be deemed part of an effective technological measure under any 167 | applicable law fulfilling obligations under article 11 of the WIPO copyright treaty 168 | adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention 169 | of such measures. 170 | 171 | When you convey a covered work, you waive any legal power to forbid circumvention of 172 | technological measures to the extent such circumvention is effected by exercising 173 | rights under this License with respect to the covered work, and you disclaim any 174 | intention to limit operation or modification of the work as a means of enforcing, 175 | against the work's users, your or third parties' legal rights to forbid circumvention 176 | of technological measures. 177 | 178 | ### 4. Conveying Verbatim Copies 179 | 180 | You may convey verbatim copies of the Program's source code as you receive it, in any 181 | medium, provided that you conspicuously and appropriately publish on each copy an 182 | appropriate copyright notice; keep intact all notices stating that this License and 183 | any non-permissive terms added in accord with section 7 apply to the code; keep 184 | intact all notices of the absence of any warranty; and give all recipients a copy of 185 | this License along with the Program. 186 | 187 | You may charge any price or no price for each copy that you convey, and you may offer 188 | support or warranty protection for a fee. 189 | 190 | ### 5. Conveying Modified Source Versions 191 | 192 | You may convey a work based on the Program, or the modifications to produce it from 193 | the Program, in the form of source code under the terms of section 4, provided that 194 | you also meet all of these conditions: 195 | 196 | * **a)** The work must carry prominent notices stating that you modified it, and giving a 197 | relevant date. 198 | * **b)** The work must carry prominent notices stating that it is released under this 199 | License and any conditions added under section 7. This requirement modifies the 200 | requirement in section 4 to “keep intact all notices”. 201 | * **c)** You must license the entire work, as a whole, under this License to anyone who 202 | comes into possession of a copy. This License will therefore apply, along with any 203 | applicable section 7 additional terms, to the whole of the work, and all its parts, 204 | regardless of how they are packaged. This License gives no permission to license the 205 | work in any other way, but it does not invalidate such permission if you have 206 | separately received it. 207 | * **d)** If the work has interactive user interfaces, each must display Appropriate Legal 208 | Notices; however, if the Program has interactive interfaces that do not display 209 | Appropriate Legal Notices, your work need not make them do so. 210 | 211 | A compilation of a covered work with other separate and independent works, which are 212 | not by their nature extensions of the covered work, and which are not combined with 213 | it such as to form a larger program, in or on a volume of a storage or distribution 214 | medium, is called an “aggregate” if the compilation and its resulting 215 | copyright are not used to limit the access or legal rights of the compilation's users 216 | beyond what the individual works permit. Inclusion of a covered work in an aggregate 217 | does not cause this License to apply to the other parts of the aggregate. 218 | 219 | ### 6. Conveying Non-Source Forms 220 | 221 | You may convey a covered work in object code form under the terms of sections 4 and 222 | 5, provided that you also convey the machine-readable Corresponding Source under the 223 | terms of this License, in one of these ways: 224 | 225 | * **a)** Convey the object code in, or embodied in, a physical product (including a 226 | physical distribution medium), accompanied by the Corresponding Source fixed on a 227 | durable physical medium customarily used for software interchange. 228 | * **b)** Convey the object code in, or embodied in, a physical product (including a 229 | physical distribution medium), accompanied by a written offer, valid for at least 230 | three years and valid for as long as you offer spare parts or customer support for 231 | that product model, to give anyone who possesses the object code either **(1)** a copy of 232 | the Corresponding Source for all the software in the product that is covered by this 233 | License, on a durable physical medium customarily used for software interchange, for 234 | a price no more than your reasonable cost of physically performing this conveying of 235 | source, or **(2)** access to copy the Corresponding Source from a network server at no 236 | charge. 237 | * **c)** Convey individual copies of the object code with a copy of the written offer to 238 | provide the Corresponding Source. This alternative is allowed only occasionally and 239 | noncommercially, and only if you received the object code with such an offer, in 240 | accord with subsection 6b. 241 | * **d)** Convey the object code by offering access from a designated place (gratis or for 242 | a charge), and offer equivalent access to the Corresponding Source in the same way 243 | through the same place at no further charge. You need not require recipients to copy 244 | the Corresponding Source along with the object code. If the place to copy the object 245 | code is a network server, the Corresponding Source may be on a different server 246 | (operated by you or a third party) that supports equivalent copying facilities, 247 | provided you maintain clear directions next to the object code saying where to find 248 | the Corresponding Source. Regardless of what server hosts the Corresponding Source, 249 | you remain obligated to ensure that it is available for as long as needed to satisfy 250 | these requirements. 251 | * **e)** Convey the object code using peer-to-peer transmission, provided you inform 252 | other peers where the object code and Corresponding Source of the work are being 253 | offered to the general public at no charge under subsection 6d. 254 | 255 | A separable portion of the object code, whose source code is excluded from the 256 | Corresponding Source as a System Library, need not be included in conveying the 257 | object code work. 258 | 259 | A “User Product” is either **(1)** a “consumer product”, which 260 | means any tangible personal property which is normally used for personal, family, or 261 | household purposes, or **(2)** anything designed or sold for incorporation into a 262 | dwelling. In determining whether a product is a consumer product, doubtful cases 263 | shall be resolved in favor of coverage. For a particular product received by a 264 | particular user, “normally used” refers to a typical or common use of 265 | that class of product, regardless of the status of the particular user or of the way 266 | in which the particular user actually uses, or expects or is expected to use, the 267 | product. A product is a consumer product regardless of whether the product has 268 | substantial commercial, industrial or non-consumer uses, unless such uses represent 269 | the only significant mode of use of the product. 270 | 271 | “Installation Information” for a User Product means any methods, 272 | procedures, authorization keys, or other information required to install and execute 273 | modified versions of a covered work in that User Product from a modified version of 274 | its Corresponding Source. The information must suffice to ensure that the continued 275 | functioning of the modified object code is in no case prevented or interfered with 276 | solely because modification has been made. 277 | 278 | If you convey an object code work under this section in, or with, or specifically for 279 | use in, a User Product, and the conveying occurs as part of a transaction in which 280 | the right of possession and use of the User Product is transferred to the recipient 281 | in perpetuity or for a fixed term (regardless of how the transaction is 282 | characterized), the Corresponding Source conveyed under this section must be 283 | accompanied by the Installation Information. But this requirement does not apply if 284 | neither you nor any third party retains the ability to install modified object code 285 | on the User Product (for example, the work has been installed in ROM). 286 | 287 | The requirement to provide Installation Information does not include a requirement to 288 | continue to provide support service, warranty, or updates for a work that has been 289 | modified or installed by the recipient, or for the User Product in which it has been 290 | modified or installed. Access to a network may be denied when the modification itself 291 | materially and adversely affects the operation of the network or violates the rules 292 | and protocols for communication across the network. 293 | 294 | Corresponding Source conveyed, and Installation Information provided, in accord with 295 | this section must be in a format that is publicly documented (and with an 296 | implementation available to the public in source code form), and must require no 297 | special password or key for unpacking, reading or copying. 298 | 299 | ### 7. Additional Terms 300 | 301 | “Additional permissions” are terms that supplement the terms of this 302 | License by making exceptions from one or more of its conditions. Additional 303 | permissions that are applicable to the entire Program shall be treated as though they 304 | were included in this License, to the extent that they are valid under applicable 305 | law. If additional permissions apply only to part of the Program, that part may be 306 | used separately under those permissions, but the entire Program remains governed by 307 | this License without regard to the additional permissions. 308 | 309 | When you convey a copy of a covered work, you may at your option remove any 310 | additional permissions from that copy, or from any part of it. (Additional 311 | permissions may be written to require their own removal in certain cases when you 312 | modify the work.) You may place additional permissions on material, added by you to a 313 | covered work, for which you have or can give appropriate copyright permission. 314 | 315 | Notwithstanding any other provision of this License, for material you add to a 316 | covered work, you may (if authorized by the copyright holders of that material) 317 | supplement the terms of this License with terms: 318 | 319 | * **a)** Disclaiming warranty or limiting liability differently from the terms of 320 | sections 15 and 16 of this License; or 321 | * **b)** Requiring preservation of specified reasonable legal notices or author 322 | attributions in that material or in the Appropriate Legal Notices displayed by works 323 | containing it; or 324 | * **c)** Prohibiting misrepresentation of the origin of that material, or requiring that 325 | modified versions of such material be marked in reasonable ways as different from the 326 | original version; or 327 | * **d)** Limiting the use for publicity purposes of names of licensors or authors of the 328 | material; or 329 | * **e)** Declining to grant rights under trademark law for use of some trade names, 330 | trademarks, or service marks; or 331 | * **f)** Requiring indemnification of licensors and authors of that material by anyone 332 | who conveys the material (or modified versions of it) with contractual assumptions of 333 | liability to the recipient, for any liability that these contractual assumptions 334 | directly impose on those licensors and authors. 335 | 336 | All other non-permissive additional terms are considered “further 337 | restrictions” within the meaning of section 10. If the Program as you received 338 | it, or any part of it, contains a notice stating that it is governed by this License 339 | along with a term that is a further restriction, you may remove that term. If a 340 | license document contains a further restriction but permits relicensing or conveying 341 | under this License, you may add to a covered work material governed by the terms of 342 | that license document, provided that the further restriction does not survive such 343 | relicensing or conveying. 344 | 345 | If you add terms to a covered work in accord with this section, you must place, in 346 | the relevant source files, a statement of the additional terms that apply to those 347 | files, or a notice indicating where to find the applicable terms. 348 | 349 | Additional terms, permissive or non-permissive, may be stated in the form of a 350 | separately written license, or stated as exceptions; the above requirements apply 351 | either way. 352 | 353 | ### 8. Termination 354 | 355 | You may not propagate or modify a covered work except as expressly provided under 356 | this License. Any attempt otherwise to propagate or modify it is void, and will 357 | automatically terminate your rights under this License (including any patent licenses 358 | granted under the third paragraph of section 11). 359 | 360 | However, if you cease all violation of this License, then your license from a 361 | particular copyright holder is reinstated **(a)** provisionally, unless and until the 362 | copyright holder explicitly and finally terminates your license, and **(b)** permanently, 363 | if the copyright holder fails to notify you of the violation by some reasonable means 364 | prior to 60 days after the cessation. 365 | 366 | Moreover, your license from a particular copyright holder is reinstated permanently 367 | if the copyright holder notifies you of the violation by some reasonable means, this 368 | is the first time you have received notice of violation of this License (for any 369 | work) from that copyright holder, and you cure the violation prior to 30 days after 370 | your receipt of the notice. 371 | 372 | Termination of your rights under this section does not terminate the licenses of 373 | parties who have received copies or rights from you under this License. If your 374 | rights have been terminated and not permanently reinstated, you do not qualify to 375 | receive new licenses for the same material under section 10. 376 | 377 | ### 9. Acceptance Not Required for Having Copies 378 | 379 | You are not required to accept this License in order to receive or run a copy of the 380 | Program. Ancillary propagation of a covered work occurring solely as a consequence of 381 | using peer-to-peer transmission to receive a copy likewise does not require 382 | acceptance. However, nothing other than this License grants you permission to 383 | propagate or modify any covered work. These actions infringe copyright if you do not 384 | accept this License. Therefore, by modifying or propagating a covered work, you 385 | indicate your acceptance of this License to do so. 386 | 387 | ### 10. Automatic Licensing of Downstream Recipients 388 | 389 | Each time you convey a covered work, the recipient automatically receives a license 390 | from the original licensors, to run, modify and propagate that work, subject to this 391 | License. You are not responsible for enforcing compliance by third parties with this 392 | License. 393 | 394 | An “entity transaction” is a transaction transferring control of an 395 | organization, or substantially all assets of one, or subdividing an organization, or 396 | merging organizations. If propagation of a covered work results from an entity 397 | transaction, each party to that transaction who receives a copy of the work also 398 | receives whatever licenses to the work the party's predecessor in interest had or 399 | could give under the previous paragraph, plus a right to possession of the 400 | Corresponding Source of the work from the predecessor in interest, if the predecessor 401 | has it or can get it with reasonable efforts. 402 | 403 | You may not impose any further restrictions on the exercise of the rights granted or 404 | affirmed under this License. For example, you may not impose a license fee, royalty, 405 | or other charge for exercise of rights granted under this License, and you may not 406 | initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging 407 | that any patent claim is infringed by making, using, selling, offering for sale, or 408 | importing the Program or any portion of it. 409 | 410 | ### 11. Patents 411 | 412 | A “contributor” is a copyright holder who authorizes use under this 413 | License of the Program or a work on which the Program is based. The work thus 414 | licensed is called the contributor's “contributor version”. 415 | 416 | A contributor's “essential patent claims” are all patent claims owned or 417 | controlled by the contributor, whether already acquired or hereafter acquired, that 418 | would be infringed by some manner, permitted by this License, of making, using, or 419 | selling its contributor version, but do not include claims that would be infringed 420 | only as a consequence of further modification of the contributor version. For 421 | purposes of this definition, “control” includes the right to grant patent 422 | sublicenses in a manner consistent with the requirements of this License. 423 | 424 | Each contributor grants you a non-exclusive, worldwide, royalty-free patent license 425 | under the contributor's essential patent claims, to make, use, sell, offer for sale, 426 | import and otherwise run, modify and propagate the contents of its contributor 427 | version. 428 | 429 | In the following three paragraphs, a “patent license” is any express 430 | agreement or commitment, however denominated, not to enforce a patent (such as an 431 | express permission to practice a patent or covenant not to sue for patent 432 | infringement). To “grant” such a patent license to a party means to make 433 | such an agreement or commitment not to enforce a patent against the party. 434 | 435 | If you convey a covered work, knowingly relying on a patent license, and the 436 | Corresponding Source of the work is not available for anyone to copy, free of charge 437 | and under the terms of this License, through a publicly available network server or 438 | other readily accessible means, then you must either **(1)** cause the Corresponding 439 | Source to be so available, or **(2)** arrange to deprive yourself of the benefit of the 440 | patent license for this particular work, or **(3)** arrange, in a manner consistent with 441 | the requirements of this License, to extend the patent license to downstream 442 | recipients. “Knowingly relying” means you have actual knowledge that, but 443 | for the patent license, your conveying the covered work in a country, or your 444 | recipient's use of the covered work in a country, would infringe one or more 445 | identifiable patents in that country that you have reason to believe are valid. 446 | 447 | If, pursuant to or in connection with a single transaction or arrangement, you 448 | convey, or propagate by procuring conveyance of, a covered work, and grant a patent 449 | license to some of the parties receiving the covered work authorizing them to use, 450 | propagate, modify or convey a specific copy of the covered work, then the patent 451 | license you grant is automatically extended to all recipients of the covered work and 452 | works based on it. 453 | 454 | A patent license is “discriminatory” if it does not include within the 455 | scope of its coverage, prohibits the exercise of, or is conditioned on the 456 | non-exercise of one or more of the rights that are specifically granted under this 457 | License. You may not convey a covered work if you are a party to an arrangement with 458 | a third party that is in the business of distributing software, under which you make 459 | payment to the third party based on the extent of your activity of conveying the 460 | work, and under which the third party grants, to any of the parties who would receive 461 | the covered work from you, a discriminatory patent license **(a)** in connection with 462 | copies of the covered work conveyed by you (or copies made from those copies), or **(b)** 463 | primarily for and in connection with specific products or compilations that contain 464 | the covered work, unless you entered into that arrangement, or that patent license 465 | was granted, prior to 28 March 2007. 466 | 467 | Nothing in this License shall be construed as excluding or limiting any implied 468 | license or other defenses to infringement that may otherwise be available to you 469 | under applicable patent law. 470 | 471 | ### 12. No Surrender of Others' Freedom 472 | 473 | If conditions are imposed on you (whether by court order, agreement or otherwise) 474 | that contradict the conditions of this License, they do not excuse you from the 475 | conditions of this License. If you cannot convey a covered work so as to satisfy 476 | simultaneously your obligations under this License and any other pertinent 477 | obligations, then as a consequence you may not convey it at all. For example, if you 478 | agree to terms that obligate you to collect a royalty for further conveying from 479 | those to whom you convey the Program, the only way you could satisfy both those terms 480 | and this License would be to refrain entirely from conveying the Program. 481 | 482 | ### 13. Use with the GNU Affero General Public License 483 | 484 | Notwithstanding any other provision of this License, you have permission to link or 485 | combine any covered work with a work licensed under version 3 of the GNU Affero 486 | General Public License into a single combined work, and to convey the resulting work. 487 | The terms of this License will continue to apply to the part which is the covered 488 | work, but the special requirements of the GNU Affero General Public License, section 489 | 13, concerning interaction through a network will apply to the combination as such. 490 | 491 | ### 14. Revised Versions of this License 492 | 493 | The Free Software Foundation may publish revised and/or new versions of the GNU 494 | General Public License from time to time. Such new versions will be similar in spirit 495 | to the present version, but may differ in detail to address new problems or concerns. 496 | 497 | Each version is given a distinguishing version number. If the Program specifies that 498 | a certain numbered version of the GNU General Public License “or any later 499 | version” applies to it, you have the option of following the terms and 500 | conditions either of that numbered version or of any later version published by the 501 | Free Software Foundation. If the Program does not specify a version number of the GNU 502 | General Public License, you may choose any version ever published by the Free 503 | Software Foundation. 504 | 505 | If the Program specifies that a proxy can decide which future versions of the GNU 506 | General Public License can be used, that proxy's public statement of acceptance of a 507 | version permanently authorizes you to choose that version for the Program. 508 | 509 | Later license versions may give you additional or different permissions. However, no 510 | additional obligations are imposed on any author or copyright holder as a result of 511 | your choosing to follow a later version. 512 | 513 | ### 15. Disclaimer of Warranty 514 | 515 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 516 | EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 517 | PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER 518 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 519 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 520 | QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE 521 | DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 522 | 523 | ### 16. Limitation of Liability 524 | 525 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY 526 | COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS 527 | PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 528 | INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 529 | PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE 530 | OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE 531 | WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 532 | POSSIBILITY OF SUCH DAMAGES. 533 | 534 | ### 17. Interpretation of Sections 15 and 16 535 | 536 | If the disclaimer of warranty and limitation of liability provided above cannot be 537 | given local legal effect according to their terms, reviewing courts shall apply local 538 | law that most closely approximates an absolute waiver of all civil liability in 539 | connection with the Program, unless a warranty or assumption of liability accompanies 540 | a copy of the Program in return for a fee. 541 | 542 | _END OF TERMS AND CONDITIONS_ 543 | 544 | ## How to Apply These Terms to Your New Programs 545 | 546 | If you develop a new program, and you want it to be of the greatest possible use to 547 | the public, the best way to achieve this is to make it free software which everyone 548 | can redistribute and change under these terms. 549 | 550 | To do so, attach the following notices to the program. It is safest to attach them 551 | to the start of each source file to most effectively state the exclusion of warranty; 552 | and each file should have at least the “copyright” line and a pointer to 553 | where the full notice is found. 554 | 555 | 556 | Copyright (C) 557 | 558 | This program is free software: you can redistribute it and/or modify 559 | it under the terms of the GNU General Public License as published by 560 | the Free Software Foundation, either version 3 of the License, or 561 | (at your option) any later version. 562 | 563 | This program is distributed in the hope that it will be useful, 564 | but WITHOUT ANY WARRANTY; without even the implied warranty of 565 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 566 | GNU General Public License for more details. 567 | 568 | You should have received a copy of the GNU General Public License 569 | along with this program. If not, see . 570 | 571 | Also add information on how to contact you by electronic and paper mail. 572 | 573 | If the program does terminal interaction, make it output a short notice like this 574 | when it starts in an interactive mode: 575 | 576 | Copyright (C) 577 | This program comes with ABSOLUTELY NO WARRANTY; for details type 'show w'. 578 | This is free software, and you are welcome to redistribute it 579 | under certain conditions; type 'show c' for details. 580 | 581 | The hypothetical commands `show w` and `show c` should show the appropriate parts of 582 | the General Public License. Of course, your program's commands might be different; 583 | for a GUI interface, you would use an “about box”. 584 | 585 | You should also get your employer (if you work as a programmer) or school, if any, to 586 | sign a “copyright disclaimer” for the program, if necessary. For more 587 | information on this, and how to apply and follow the GNU GPL, see 588 | <>. 589 | 590 | The GNU General Public License does not permit incorporating your program into 591 | proprietary programs. If your program is a subroutine library, you may consider it 592 | more useful to permit linking proprietary applications with the library. If this is 593 | what you want to do, use the GNU Lesser General Public License instead of this 594 | License. But first, please read 595 | <>. -------------------------------------------------------------------------------- /example_client/blip_helper.lua: -------------------------------------------------------------------------------- 1 | local blip_types = { 2 | Standard = 1, 3 | Jet = 16, 4 | Lift = 36, 5 | RaceFinish = 38, 6 | Safehouse = 40, 7 | PoliceHelicopter = 43, 8 | ChatBubble = 47, 9 | Garage2 = 50, 10 | Drugs = 51, 11 | Store = 52, 12 | PoliceCar = 56, 13 | PoliceStation = 60, 14 | Hospital = 61, 15 | Helicopter = 64, 16 | StrangersAndFreaks = 65, 17 | ArmoredTruck = 66, 18 | TowTruck = 68, 19 | Barber = 71, 20 | LosSantosCustoms = 72, 21 | Clothes = 73, 22 | TattooParlor = 75, 23 | Simeon = 76, 24 | Lester = 77, 25 | Michael = 78, 26 | Trevor = 79, 27 | Rampage = 84, 28 | VinewoodTours = 85, 29 | Lamar = 86, 30 | Franklin = 88, 31 | Chinese = 89, 32 | Airport = 90, 33 | Bar = 93, 34 | BaseJump = 94, 35 | CarWash = 100, 36 | ComedyClub = 102, 37 | Dart = 103, 38 | FIB = 106, 39 | DollarSign = 108, 40 | Golf = 109, 41 | AmmuNation = 110, 42 | Exile = 112, 43 | ShootingRange = 119, 44 | Solomon = 120, 45 | StripClub = 121, 46 | Tennis = 122, 47 | Triathlon = 126, 48 | OffRoadRaceFinish = 128, 49 | Key = 134, 50 | MovieTheater = 135, 51 | Music = 136, 52 | Marijuana = 140, 53 | Hunting = 137, 54 | ArmsTraffickingGround = 147, 55 | Nigel = 149, 56 | AssaultRifle = 150, 57 | Bat = 151, 58 | Grenade = 152, 59 | Health = 153, 60 | Knife = 154, 61 | Molotov = 155, 62 | Pistol = 156, 63 | RPG = 157, 64 | Shotgun = 158, 65 | SMG = 159, 66 | Sniper = 160, 67 | PointOfInterest = 162, 68 | GTAOPassive = 163, 69 | GTAOUsingMenu = 164, 70 | Minigun = 173, 71 | GrenadeLauncher = 174, 72 | Armor = 175, 73 | Castle = 176, 74 | Camera = 184, 75 | Handcuffs = 188, 76 | Yoga = 197, 77 | Cab = 198, 78 | Shrink = 205, 79 | Epsilon = 206, 80 | PersonalVehicleCar = 225, 81 | PersonalVehicleBike = 226, 82 | Custody = 237, 83 | ArmsTraffickingAir = 251, 84 | Fairground = 266, 85 | PropertyManagement = 267, 86 | Altruist = 269, 87 | Chop = 273, 88 | Hooker = 279, 89 | Friend = 280, 90 | GTAOMission = 304, 91 | GTAOSurvival = 305, 92 | CrateDrop =306, 93 | PlaneDrop =307, 94 | Sub = 308, 95 | Race = 309, 96 | Deathmatch = 310, 97 | ArmWrestling = 311, 98 | AmmuNationShootingRange = 313, 99 | RaceAir = 314, 100 | RaceCar = 315, 101 | RaceSea = 316, 102 | GarbageTruck = 318, 103 | SafehouseForSale = 350, 104 | Package = 351, 105 | MartinMadrazo = 352, 106 | Boost = 354, 107 | Devin = 355, 108 | Marina = 356, 109 | Garage = 357, 110 | GolfFlag = 358, 111 | Hangar = 359, 112 | Helipad = 360, 113 | JerryCan = 361, 114 | Masks = 362, 115 | HeistSetup = 364, 116 | PickupSpawn = 365, 117 | BoilerSuit = 366, 118 | Completed = 367, 119 | Rockets = 368, 120 | GarageForSale = 369, 121 | 122 | HelipadForSale = 370, 123 | MarinaForSale = 371, 124 | HangarForSale = 372, 125 | Business = 374, 126 | BusinessForSale = 375, 127 | RaceBike = 376, 128 | Parachute = 377, 129 | TeamDeathmatch = 378, 130 | RaceFoot = 379, 131 | VehicleDeathmatch = 380, 132 | Barry = 381, 133 | Dom = 382, 134 | MaryAnn = 383, 135 | Cletus = 384, 136 | Josh = 385, 137 | Minute = 386, 138 | Omega = 387, 139 | Tonya = 388, 140 | Paparazzo = 389, 141 | Abigail = 400, 142 | Blimp = 401, 143 | Repair = 402, 144 | Testosterone = 403, 145 | Dinghy = 404, 146 | Fanatic = 405, 147 | CaptureBriefcase = 408, 148 | LastTeamStanding = 409, 149 | Boat = 410, 150 | CaptureHouse = 411, 151 | JerryCan2 = 415, 152 | CaptureAmericanFlag = 419, 153 | 154 | CaptureFlag = 420, 155 | Tank = 421, 156 | GunCar = 426, 157 | Speedboat = 427, 158 | Heist = 428, 159 | Stopwatch = 430, 160 | DollarSignCircled = 431, 161 | Crosshair2 = 432, 162 | DollarSignSquared = 434, 163 | FlameIcon = 436, 164 | 165 | DiamondCasino = 679, 166 | LSCarMeet = 777, 167 | LSCarMeetGarage = 779 168 | } 169 | -------------------------------------------------------------------------------- /example_client/blips_client.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | A utility event that is triggered from the server to generate the blips. 3 | This will get all the blips that are shown on the map. 4 | ]] 5 | RegisterNetEvent("livemap:getBlipsFromClient") 6 | 7 | local blip_types = { 8 | 1,16,36,38,40,43,47,50,51,52, 9 | 56,60,61,64,65,66,68,71,72,73,75,76,77,78,79,84,85,86,88,89,90,93,94, 10 | 100,102,103,106,108,109,110,112,119,120,121,122,126,128,134,135,136,140,137, 11 | 147,149,150,151,152,153,154,155,156,157,158,159,160,162,163,164,173,174,175,176,184,188,197,198, 12 | 205,206,225,226,237,251,266,267,269,273,279,280, 13 | 304,305,306,307,308,309,310,311,313,314,315,316,318,350,351,352,354,355,356, 14 | 357,358,359,360,361,362,364,365,366,367,368,369,370,371,372,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389, 15 | 400,401,402,403,404,405,408,409,410,411,415,419,420,421,426,427,428,430,431,432,434,436, 16 | 679, 777, 779 17 | } 18 | 19 | AddEventHandler("livemap:getBlipsFromClient", function() 20 | Citizen.Trace("Generating blip table.. This may take a while for a large amount of blips") 21 | local blipTable = {} 22 | 23 | -- Loop through ALL the fucking blips 24 | for _,spriteId in pairs(blip_types) do 25 | local blip = GetFirstBlipInfoId(spriteId) 26 | 27 | if DoesBlipExist(blip) then -- If the first blip exists, we're going to need an entry 28 | blipTable[spriteId] = {} 29 | end 30 | while (DoesBlipExist(blip)) do 31 | 32 | local x,y,z = table.unpack(GetBlipCoords(blip)) 33 | 34 | -- Damn! There's no way to get the fucking display text for the blip :( 35 | table.insert(blipTable[spriteId], { 36 | x = tonumber(string.format("%.2f", x)), -- Round them to 2dp 37 | y = tonumber(string.format("%.2f", y)), 38 | z = tonumber(string.format("%.2f", z)) 39 | }) 40 | 41 | blip = GetNextBlipInfoId(spriteId) 42 | end 43 | end 44 | 45 | Citizen.Trace("Generated the blips!") 46 | TriggerServerEvent("livemap:blipsGenerated", blipTable) 47 | end) 48 | 49 | RegisterCommand("blip", function(source, args, raw) 50 | 51 | for i=1, #args do 52 | print(i .. " = " .. args[i] .. " " .. type(args[i])) 53 | end 54 | 55 | if(args[1] == "add") then 56 | local pos = GetEntityCoords( PlayerPedId(), not IsPlayerDead(PlayerId()) ) 57 | local spriteId = tonumber(args[2]) 58 | 59 | if spriteId == nil then 60 | print("Sorry, spriteId must be a number") 61 | return 62 | end 63 | local name, description = "", "" 64 | if args[3] then 65 | name = args[3] 66 | end 67 | if args[4] then 68 | description = args[4] 69 | end 70 | 71 | print(spriteId .. " " .. name .. " " .. description .. " " .. pos.x .. " " .. pos.y .. " " .. pos.z) 72 | 73 | local blip = { 74 | sprite = spriteId, 75 | pos = { 76 | x = pos.x, 77 | y = pos.y, 78 | z = pos.z 79 | }, 80 | name = name, 81 | description = description 82 | } 83 | 84 | TriggerServerEvent("livemap:AddBlip", blip) 85 | 86 | elseif(args[1] == "remove") then 87 | local pos = GetEntityCoords(PlayerPedId(), not IsPlayerDead(PlayerId())) 88 | 89 | TriggerServerEvent("livemap:RemoveClosestBlip", {x = pos.x, y = pos.y, z = pos.z}) 90 | 91 | elseif(args[1] == "update") then 92 | 93 | else 94 | print("Sorry, the available blip arguments are as follows:") 95 | print("add [name] [descriptionn] -- Adds a blip at your current position") 96 | print("remove [radius] -- Removed the closes blip within the radius") 97 | print("update -- Updates the closes blip with this data") 98 | end 99 | end, true) 100 | -------------------------------------------------------------------------------- /example_client/client_icon.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is respoinsible for updating the player's icon. 3 | If they're dead, show the "dead" icon. 4 | If they're in a vehicle, show the vehicle icon etc, etc, etc. 5 | ]] 6 | local currentIcon = 6 7 | local temp = {} 8 | 9 | function doIconUpdate() 10 | local ped = PlayerPedId() 11 | local newSprite = 6 -- Default to the player one 12 | 13 | if IsEntityDead(ped) then 14 | newSprite = 163 -- Using GtaOPassive since I don't have a "death" icon :( 15 | else 16 | if IsPedSittingInAnyVehicle(ped) then 17 | -- Change icon to vehicle 18 | -- our temp table should still have the latest vehicle 19 | local vehicle = temp["vehicle"] 20 | local vehicleModel = GetEntityModel(vehicle) 21 | local h = GetHashKey 22 | 23 | if vehicleModel == h("rhino") then 24 | newSprite = 421 25 | elseif (vehicleModel == h("lazer") or vehicleModel == h("besra") or vehicleModel == h("hydra")) then 26 | newSprite = 16 -- Jet 27 | elseif IsThisModelAPlane(vehicleModel) then 28 | newSprite = 90 -- Airport (plane icon) 29 | elseif IsThisModelAHeli(vehicleModel) then 30 | newSprite = 64 -- Helicopter 31 | elseif (vehicleModel == h("technical") or vehicleModel == h("insurgent") or vehicleModel == h("insurgent2") or vehicleModel == h("limo2")) then 32 | newSprite = 426 -- GunCar 33 | elseif (vehicleModel == h("dinghy") or vehicleModel == h("dinghy2") or vehicleModel == h("dinghy3")) then 34 | newSprite = 404 -- Dinghy 35 | elseif (vehicleModel == h("submersible") or vehicleModel == h("submersible2")) then 36 | newSprite = 308 -- Sub 37 | elseif IsThisModelABoat(vehicleModel) then 38 | newSprite = 410 39 | elseif (IsThisModelABike(vehicleModel) or IsThisModelABicycle(vehicleModel)) then 40 | newSprite = 226 41 | elseif (vehicleModel == h("policeold2") or vehicleModel == h("policeold1") or vehicleModel == h("policet") or vehicleModel == h("police") or vehicleModel == h("police2") or vehicleModel == h("police3") or vehicleModel == h("policeb") or vehicleModel == h("riot") or vehicleModel == h("sheriff") or vehicleModel == h("sheriff2") or vehicleModel == h("pranger")) then 42 | newSprite = 56 -- PoliceCar 43 | elseif vehicleModel == h("taxi") then 44 | newSprite = 198 45 | elseif (vehicleModel == h("brickade") or vehicleModel == h("stockade") or vehicleModel == h("stockade2")) then 46 | newSprite = 66 -- ArmoredTruck 47 | elseif (vehicleModel == h("towtruck") or vehicleModel == h("towtruck")) then 48 | newSprite = 68 49 | elseif (vehicleModel == h("trash") or vehicleModel == h("trash2")) then 50 | newSprite = 318 51 | else 52 | newSprite = 225 -- PersonalVehicleCar 53 | end 54 | end 55 | end 56 | 57 | if currentIcon ~= newSprite then 58 | currentIcon = newSprite 59 | TriggerServerEvent("livemap:UpdatePlayerData", "icon", newSprite) 60 | end 61 | end 62 | 63 | 64 | Citizen.CreateThread(function() 65 | TriggerServerEvent("livemap:UpdatePlayerData", "icon", 6) 66 | while true do 67 | Wait(10) 68 | 69 | if NetworkIsPlayerActive(PlayerId()) then 70 | doIconUpdate() 71 | end 72 | 73 | end 74 | end) 75 | -------------------------------------------------------------------------------- /example_client/client_position.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is responsible for updating the player's position and location string 3 | ]] 4 | -- Our player's actual location co-ordinates and location string 5 | local lastKnownPosition = { 6 | ["pos"] = { 7 | x = 0, 8 | y = 0, 9 | z = 0 10 | }, 11 | ["Location"] = "Unknown" 12 | } 13 | 14 | -- What data have we updated? Used to only send the updated values to the socket 15 | local updatedData = {} 16 | 17 | -- Temporary data store for the location string. Since it's composed of three parts, we want to check to see if any of them have changed in order to update the string 18 | local temp = {} 19 | 20 | -- Pop what we updated into the array and update it's value. 21 | function updateData(name, value) 22 | table.insert(updatedData, name) 23 | lastKnownPosition[name] = value 24 | end 25 | 26 | 27 | Citizen.CreateThread(function() 28 | while true do 29 | Wait(10) 30 | 31 | if NetworkIsPlayerActive(PlayerId()) then 32 | 33 | -- Update position, if it has changed 34 | local x,y,z = table.unpack(GetEntityCoords(PlayerPedId())) 35 | local x1,y1,z1 = lastKnownPosition["pos"].x, lastKnownPosition["pos"].y, lastKnownPosition["pos"].z 36 | 37 | local dist = Vdist(x, y, z, x1, y1, z1) 38 | 39 | if (dist >= 5) then 40 | -- Update every 5 meters.. Let's reduce the amount of spam 41 | -- TODO: Maybe make this into a convar (e.g. accuracy_distance) 42 | updateData("pos", {x = x, y=y, z=z}) 43 | 44 | -- Reverse the street, area and zone of the current location 45 | local streetname = exports[GetCurrentResourceName()]:reverseStreetHash(GetStreetNameAtCoord(x,y,z)) 46 | local zone = exports[GetCurrentResourceName()]:reverseZoneHash(GetHashKey(GetNameOfZone(x, y, z))) 47 | local area = exports[GetCurrentResourceName()]:reverseAreaHash(GetHashOfMapAreaAtCoords(x, y, z)) 48 | 49 | if (temp["streetname"] ~= streetname) or (temp["zone"] ~= zone) or (temp["area"] ~= area) then 50 | local locationString = string.format("%s, %s (%s)", streetname, zone, area) 51 | 52 | updateData("Location", locationString) 53 | temp["streetname"] = streetname 54 | temp["zone"] = zone 55 | temp["area"] = area 56 | end 57 | 58 | end 59 | 60 | -- Make sure the updated data is up-to-date on socket server as well 61 | for i,k in pairs(updatedData) do 62 | --Citizen.Trace("Updating " .. k) 63 | TriggerServerEvent("livemap:UpdatePlayerData", k, lastKnownPosition[k]) 64 | table.remove(updatedData, i) 65 | end 66 | 67 | end 68 | end 69 | end) 70 | -------------------------------------------------------------------------------- /example_client/client_spanwed.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is responsible for making sure that the client's identifiers exist on the websocket server. 3 | If this doesn't run then the interface will just be sent the player's position with no way to associate it with a player. 4 | Then, it won't show the player. And you'll complain. 5 | So... 6 | ]] 7 | local firstSpawn = true 8 | 9 | --[[ 10 | When the player spawns, make sure we set their ID in the data that is going 11 | to be sent via sockets. 12 | ]] 13 | AddEventHandler("playerSpawned", function(spawn) 14 | if firstSpawn then 15 | TriggerServerEvent("livemap:playerSpawned") -- Set's the ID in "playerData" so it will get sent va sockets 16 | firstSpawn = false 17 | end 18 | end) -------------------------------------------------------------------------------- /example_client/client_vehicle_info.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is responsible for updating the player's vehicle information. 3 | What type and license plate 4 | ]] 5 | local data = { 6 | ["Vehicle"] = "", 7 | ["License Plate"] = "" 8 | } 9 | 10 | local temp = {} 11 | 12 | 13 | function doVehicleUpdate() 14 | local vehicle = GetVehiclePedIsIn(PlayerPedId(), 0) 15 | 16 | if temp["vehicle"] ~= vehicle and vehicle ~= 0 then 17 | -- Update it 18 | local vehicleClass = GetVehicleClass(vehicle) 19 | 20 | -- Added reverseWeaponHash to the vehicle display name to convert the vehicle name to a nicer version. 21 | -- To change, modify the "reverse_car_hashes.lua" file 22 | local vehNameHash = GetHashKey(GetDisplayNameFromVehicleModel(GetEntityModel(vehicle))) 23 | local reversedVehicleName = exports[GetCurrentResourceName()]:reverseVehicleHash(vehNameHash) 24 | 25 | data["Vehicle"] = reversedVehicleName 26 | TriggerServerEvent("livemap:UpdatePlayerData", "Vehicle", reversedVehicleName) 27 | 28 | temp["vehicle"] = vehicle 29 | end 30 | 31 | local plate = GetVehicleNumberPlateText(vehicle) 32 | plate = plate:gsub("^%s*(.-)%s*$", "%1") -- Remove whitespace at the start and end of the plate (for plate check) 33 | 34 | if plate == "FIVE M" then 35 | plate = plate .. " (Spawned In)" 36 | end 37 | 38 | if data["License Plate"] ~= plate then 39 | data["License Plate"] = plate 40 | TriggerServerEvent("livemap:UpdatePlayerData", "License Plate", plate) 41 | end 42 | end 43 | 44 | Citizen.CreateThread(function() 45 | while true do 46 | Wait(10) 47 | 48 | if NetworkIsPlayerActive(PlayerId()) then 49 | 50 | -- Update Vehicle (and icon) 51 | if IsPedInAnyVehicle(PlayerPedId()) then 52 | doVehicleUpdate() 53 | 54 | elseif data["License Plate"] ~= nil or data["Vehicle"] ~= nil then 55 | -- No longer in a vehicle, remove "License Plate" if present 56 | data["License Plate"] = nil 57 | data["Vehicle"] = nil 58 | temp["vehicle"] = nil 59 | 60 | -- Remove it from socket communication 61 | TriggerServerEvent("livemap:RemovePlayerData", "License Plate") 62 | TriggerServerEvent("livemap:RemovePlayerData", "Vehicle") 63 | end 64 | end 65 | end 66 | end) 67 | -------------------------------------------------------------------------------- /example_client/client_weapons.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | If the player has a weapon, set what it is and send it to the interface 3 | ]] 4 | local temp = {} 5 | 6 | Citizen.CreateThread(function() 7 | while true do 8 | Wait(10) 9 | 10 | if NetworkIsPlayerActive(PlayerId()) then 11 | 12 | -- Update weapons 13 | local found,weapon = GetCurrentPedWeapon(PlayerPedId(), true) 14 | if found and temp["weapon"] ~= weapon then 15 | local weaponName = exports[GetCurrentResourceName()]:reverseWeaponHash(weapon) 16 | TriggerServerEvent("livemap:UpdatePlayerData", "Weapon", weaponName) 17 | 18 | -- To make sure we don't call this more than we need to 19 | temp["weapon"] = weapon 20 | end 21 | 22 | end 23 | 24 | end 25 | end) 26 | -------------------------------------------------------------------------------- /example_client/readme.md: -------------------------------------------------------------------------------- 1 | # This is an example client-side resource! 2 | 3 | This shows you how you can create your own resources to utilise LiveMap. 4 | 5 | If you want to use LiveMap, I suggest you do it in your own client resource. 6 | 7 | This will allow you to update LiveMap without any conflicts. 8 | 9 | If you wanted to use this version of the client, and keep the data how it is, I suggest you copy these files into their own folder. 10 | 11 | # How to enable 12 | 13 | Uncomment the client_files bit in the manifest file! -------------------------------------------------------------------------------- /example_client/reverse_car_hashes.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LiveMap - A LiveMap for FiveM servers 3 | Copyright (C) 2017 Jordan Dalton 4 | 5 | You should have received a copy of the GNU General Public License 6 | along with this program in the file "LICENSE". If not, see . 7 | ]] 8 | local VEHICLE_HASHES = { 9 | [tostring(GetHashKey("adder"))] = "Adder", 10 | [tostring(GetHashKey("airbus"))] = "Airport Bus", 11 | [tostring(GetHashKey("airtug"))] = "Airtug", 12 | [tostring(GetHashKey("akuma"))] = "Akuma", 13 | [tostring(GetHashKey("alpha"))] = "Alpha", 14 | [tostring(GetHashKey("ambulance"))] = "Ambulance", 15 | [tostring(GetHashKey("annihilator"))] = "Annihilator", 16 | [tostring(GetHashKey("armytanker"))] = "Army Trailer", 17 | [tostring(GetHashKey("armytrailer"))] = "Army Trailer", 18 | [tostring(GetHashKey("armytrailer2"))] = "Army Trailer", 19 | [tostring(GetHashKey("asea"))] = "Asea", 20 | [tostring(GetHashKey("asea2"))] = "Asea", 21 | [tostring(GetHashKey("asterope"))] = "Asterope", 22 | [tostring(GetHashKey("bagger"))] = "Bagger", 23 | [tostring(GetHashKey("baletrailer"))] = "Baletrailer", 24 | [tostring(GetHashKey("baller"))] = "Baller", 25 | [tostring(GetHashKey("baller2"))] = "Baller", 26 | [tostring(GetHashKey("baller3"))] = "Baller LE", 27 | [tostring(GetHashKey("baller4"))] = "Baller LE LWB", 28 | [tostring(GetHashKey("baller5"))] = "Baller LE (Armored)", 29 | [tostring(GetHashKey("baller6"))] = "Baller LE LWB (Armored)", 30 | [tostring(GetHashKey("banshee"))] = "Banshee", 31 | [tostring(GetHashKey("banshee2"))] = "Banshee 900R", 32 | [tostring(GetHashKey("barracks"))] = "Barracks", 33 | [tostring(GetHashKey("barracks2"))] = "Barracks Semi", 34 | [tostring(GetHashKey("barracks3"))] = "Barracks", 35 | [tostring(GetHashKey("bati"))] = "Bati 801", 36 | [tostring(GetHashKey("bati2"))] = "Bati 801RR", 37 | [tostring(GetHashKey("benson"))] = "Benson", 38 | [tostring(GetHashKey("besra"))] = "Besra", 39 | [tostring(GetHashKey("bestiagts"))] = "Bestia GTS", 40 | [tostring(GetHashKey("bf400"))] = "BF400", 41 | [tostring(GetHashKey("bfinjection"))] = "Injection", 42 | [tostring(GetHashKey("biff"))] = "Biff", 43 | [tostring(GetHashKey("bifta"))] = "Bifta", 44 | [tostring(GetHashKey("bison"))] = "Bison", 45 | [tostring(GetHashKey("bison2"))] = "Bison", 46 | [tostring(GetHashKey("bison3"))] = "Bison", 47 | [tostring(GetHashKey("bjxl"))] = "BeeJay XL", 48 | [tostring(GetHashKey("blade"))] = "Blade", 49 | [tostring(GetHashKey("blazer"))] = "Blazer", 50 | [tostring(GetHashKey("blazer2"))] = "Blazer Lifeguard", 51 | [tostring(GetHashKey("blazer3"))] = "Hot Rod Blazer", 52 | [tostring(GetHashKey("blimp"))] = "Atomic Blimp", 53 | [tostring(GetHashKey("blimp2"))] = "Xero Blimp", 54 | [tostring(GetHashKey("blista"))] = "Blista", 55 | [tostring(GetHashKey("blista2"))] = "Blista Compact", 56 | [tostring(GetHashKey("blista3"))] = "Go Go Monkey Blista", 57 | [tostring(GetHashKey("bmx"))] = "BMX", 58 | [tostring(GetHashKey("boattrailer"))] = "Boat Trailer", 59 | [tostring(GetHashKey("bobcatxl"))] = "Bobcat XL", 60 | [tostring(GetHashKey("bodhi2"))] = "Bodhi", 61 | [tostring(GetHashKey("boxville"))] = "Boxville", 62 | [tostring(GetHashKey("boxville2"))] = "Boxville", 63 | [tostring(GetHashKey("boxville3"))] = "Boxville", 64 | [tostring(GetHashKey("boxville4"))] = "Boxville", 65 | [tostring(GetHashKey("brawler"))] = "Brawler", 66 | [tostring(GetHashKey("brickade"))] = "Brickade", 67 | [tostring(GetHashKey("brioso"))] = "Brioso R/A", 68 | [tostring(GetHashKey("btype"))] = "Roosevelt", 69 | [tostring(GetHashKey("btype2"))] = "Fränken Stange", 70 | [tostring(GetHashKey("btype3"))] = "Roosevelt Valor", 71 | [tostring(GetHashKey("buccaneer"))] = "Buccaneer", 72 | [tostring(GetHashKey("buccaneer2"))] = "Buccaneer Custom", 73 | [tostring(GetHashKey("buffalo"))] = "Buffalo", 74 | [tostring(GetHashKey("buffalo2"))] = "Buffalo S", 75 | [tostring(GetHashKey("buffalo3"))] = "Sprunk Buffalo", 76 | [tostring(GetHashKey("bulldozer"))] = "Dozer", 77 | [tostring(GetHashKey("bullet"))] = "Bullet", 78 | [tostring(GetHashKey("burrito"))] = "Burrito", 79 | [tostring(GetHashKey("burrito2"))] = "Burrito", 80 | [tostring(GetHashKey("burrito3"))] = "Burrito", 81 | [tostring(GetHashKey("burrito4"))] = "Burrito", 82 | [tostring(GetHashKey("burrito5"))] = "Burrito", 83 | [tostring(GetHashKey("bus"))] = "Bus", 84 | [tostring(GetHashKey("buzzard"))] = "Buzzard Attack Chopper", 85 | [tostring(GetHashKey("buzzard2"))] = "Buzzard", 86 | [tostring(GetHashKey("cablecar"))] = "Cable Car", 87 | [tostring(GetHashKey("caddy"))] = "Caddy", 88 | [tostring(GetHashKey("caddy2"))] = "Caddy", 89 | [tostring(GetHashKey("camper"))] = "Camper", 90 | [tostring(GetHashKey("carbonizzare"))] = "Carbonizzare", 91 | [tostring(GetHashKey("carbonrs"))] = "Carbon RS", 92 | [tostring(GetHashKey("cargobob"))] = "Cargobob", 93 | [tostring(GetHashKey("cargobob2"))] = "Cargobob", 94 | [tostring(GetHashKey("cargobob3"))] = "Cargobob", 95 | [tostring(GetHashKey("cargobob4"))] = "Cargobob", 96 | [tostring(GetHashKey("cargoplane"))] = "Cargo Plane", 97 | [tostring(GetHashKey("casco"))] = "Casco", 98 | [tostring(GetHashKey("cavalcade"))] = "Cavalcade", 99 | [tostring(GetHashKey("cavalcade2"))] = "Cavalcade", 100 | [tostring(GetHashKey("cheetah"))] = "Cheetah", 101 | [tostring(GetHashKey("chino"))] = "Chino", 102 | [tostring(GetHashKey("chino2"))] = "Chino Custom", 103 | [tostring(GetHashKey("cliffhanger"))] = "Cliffhanger", 104 | [tostring(GetHashKey("coach"))] = "Dashound", 105 | [tostring(GetHashKey("cog55"))] = "Cognoscenti 55", 106 | [tostring(GetHashKey("cog552"))] = "Cognoscenti 55 (Armored)", 107 | [tostring(GetHashKey("cogcabrio"))] = "Cognoscenti Cabrio", 108 | [tostring(GetHashKey("cognoscenti"))] = "Cognoscenti", 109 | [tostring(GetHashKey("cognoscenti2"))] = "Cognoscenti (Armored)", 110 | [tostring(GetHashKey("comet2"))] = "Comet", 111 | [tostring(GetHashKey("contender"))] = "Contender", 112 | [tostring(GetHashKey("coquette"))] = "Coquette", 113 | [tostring(GetHashKey("coquette2"))] = "Coquette Classic", 114 | [tostring(GetHashKey("coquette3"))] = "Coquette BlackFin", 115 | [tostring(GetHashKey("cruiser"))] = "Cruiser", 116 | [tostring(GetHashKey("crusader"))] = "Crusader", 117 | [tostring(GetHashKey("cuban800"))] = "Cuban 800", 118 | [tostring(GetHashKey("cutter"))] = "Cutter", 119 | [tostring(GetHashKey("daemon"))] = "Daemon", 120 | [tostring(GetHashKey("dilettante"))] = "Dilettante", 121 | [tostring(GetHashKey("dilettante2"))] = "Dilettante", 122 | [tostring(GetHashKey("dinghy"))] = "Dinghy", 123 | [tostring(GetHashKey("dinghy2"))] = "Dinghy", 124 | [tostring(GetHashKey("dinghy3"))] = "Dinghy", 125 | [tostring(GetHashKey("dinghy4"))] = "Dinghy", 126 | [tostring(GetHashKey("dloader"))] = "Duneloader", 127 | [tostring(GetHashKey("docktrailer"))] = "NULL", 128 | [tostring(GetHashKey("docktug"))] = "Docktug", 129 | [tostring(GetHashKey("dodo"))] = "Dodo", 130 | [tostring(GetHashKey("dominator"))] = "Dominator", 131 | [tostring(GetHashKey("dominator2"))] = "Pisswasser Dominator", 132 | [tostring(GetHashKey("double"))] = "Double-T", 133 | [tostring(GetHashKey("dubsta"))] = "Dubsta", 134 | [tostring(GetHashKey("dubsta2"))] = "Dubsta", 135 | [tostring(GetHashKey("dubsta3"))] = "Dubsta 6x6", 136 | [tostring(GetHashKey("dukes"))] = "Dukes", 137 | [tostring(GetHashKey("dukes2"))] = "Duke O'Death", 138 | [tostring(GetHashKey("dump"))] = "Dump", 139 | [tostring(GetHashKey("dune"))] = "Dune Buggy", 140 | [tostring(GetHashKey("dune2"))] = "Space Docker", 141 | [tostring(GetHashKey("duster"))] = "Duster", 142 | [tostring(GetHashKey("elegy2"))] = "Elegy RH8", 143 | [tostring(GetHashKey("emperor"))] = "Emperor", 144 | [tostring(GetHashKey("emperor2"))] = "Emperor", 145 | [tostring(GetHashKey("emperor3"))] = "Emperor", 146 | [tostring(GetHashKey("enduro"))] = "Enduro", 147 | [tostring(GetHashKey("entityxf"))] = "Entity XF", 148 | [tostring(GetHashKey("exemplar"))] = "Exemplar", 149 | [tostring(GetHashKey("f620"))] = "F620", 150 | [tostring(GetHashKey("faction"))] = "Faction", 151 | [tostring(GetHashKey("faction2"))] = "Faction Custom", 152 | [tostring(GetHashKey("faction3"))] = "Faction Custom Donk", 153 | [tostring(GetHashKey("faggio2"))] = "Faggio", 154 | [tostring(GetHashKey("fbi"))] = "FIB", 155 | [tostring(GetHashKey("fbi2"))] = "FIB", 156 | [tostring(GetHashKey("felon"))] = "Felon", 157 | [tostring(GetHashKey("felon2"))] = "Felon GT", 158 | [tostring(GetHashKey("feltzer2"))] = "Feltzer", 159 | [tostring(GetHashKey("feltzer3"))] = "Stirling GT", 160 | [tostring(GetHashKey("firetruk"))] = "Fire Truck", 161 | [tostring(GetHashKey("fixter"))] = "Fixter", 162 | [tostring(GetHashKey("flatbed"))] = "Flatbed", 163 | [tostring(GetHashKey("fmj"))] = "FMJ", 164 | [tostring(GetHashKey("forklift"))] = "Forklift", 165 | [tostring(GetHashKey("fq2"))] = "FQ 2", 166 | [tostring(GetHashKey("freight"))] = "Freight Train", 167 | [tostring(GetHashKey("freightcar"))] = "Freight Train", 168 | [tostring(GetHashKey("freightcont1"))] = "Freight Train", 169 | [tostring(GetHashKey("freightcont2"))] = "Freight Train", 170 | [tostring(GetHashKey("freightgrain"))] = "Freight Train", 171 | [tostring(GetHashKey("freighttrailer"))] = "NULL", 172 | [tostring(GetHashKey("frogger"))] = "Frogger", 173 | [tostring(GetHashKey("frogger2"))] = "Frogger", 174 | [tostring(GetHashKey("fugitive"))] = "Fugitive", 175 | [tostring(GetHashKey("furoregt"))] = "Furore GT", 176 | [tostring(GetHashKey("fusilade"))] = "Fusilade", 177 | [tostring(GetHashKey("futo"))] = "Futo", 178 | [tostring(GetHashKey("gargoyle"))] = "Gargoyle", 179 | [tostring(GetHashKey("gauntlet"))] = "Gauntlet", 180 | [tostring(GetHashKey("gauntlet2"))] = "Redwood Gauntlet", 181 | [tostring(GetHashKey("gburrito"))] = "Gang Burrito", 182 | [tostring(GetHashKey("gburrito2"))] = "Gang Burrito", 183 | [tostring(GetHashKey("glendale"))] = "Glendale", 184 | [tostring(GetHashKey("graintrailer"))] = "NULL", 185 | [tostring(GetHashKey("granger"))] = "Granger", 186 | [tostring(GetHashKey("gresley"))] = "Gresley", 187 | [tostring(GetHashKey("guardian"))] = "Guardian", 188 | [tostring(GetHashKey("habanero"))] = "Habanero", 189 | [tostring(GetHashKey("hakuchou"))] = "Hakuchou", 190 | [tostring(GetHashKey("handler"))] = "Dock Handler", 191 | [tostring(GetHashKey("hauler"))] = "Hauler", 192 | [tostring(GetHashKey("hexer"))] = "Hexer", 193 | [tostring(GetHashKey("hotknife"))] = "Hotknife", 194 | [tostring(GetHashKey("huntley"))] = "Huntley S", 195 | [tostring(GetHashKey("hydra"))] = "Hydra", 196 | [tostring(GetHashKey("infernus"))] = "Infernus", 197 | [tostring(GetHashKey("ingot"))] = "Ingot", 198 | [tostring(GetHashKey("innovation"))] = "Innovation", 199 | [tostring(GetHashKey("insurgent"))] = "Insurgent Pick-Up", 200 | [tostring(GetHashKey("insurgent2"))] = "Insurgent", 201 | [tostring(GetHashKey("intruder"))] = "Intruder", 202 | [tostring(GetHashKey("issi2"))] = "Issi", 203 | [tostring(GetHashKey("jackal"))] = "Jackal", 204 | [tostring(GetHashKey("jb700"))] = "JB 700", 205 | [tostring(GetHashKey("jester"))] = "Jester", 206 | [tostring(GetHashKey("jester2"))] = "Jester (Racecar)", 207 | [tostring(GetHashKey("jet"))] = "Jet", 208 | [tostring(GetHashKey("jetmax"))] = "Jetmax", 209 | [tostring(GetHashKey("journey"))] = "Journey", 210 | [tostring(GetHashKey("kalahari"))] = "Kalahari", 211 | [tostring(GetHashKey("khamelion"))] = "Khamelion", 212 | [tostring(GetHashKey("kuruma"))] = "Kuruma", 213 | [tostring(GetHashKey("kuruma2"))] = "Kuruma (Armored)", 214 | [tostring(GetHashKey("landstalker"))] = "Landstalker", 215 | [tostring(GetHashKey("lazer"))] = "P-996 LAZER", 216 | [tostring(GetHashKey("le7b"))] = "RE-7B", 217 | [tostring(GetHashKey("lectro"))] = "Lectro", 218 | [tostring(GetHashKey("lguard"))] = "Lifeguard", 219 | [tostring(GetHashKey("limo2"))] = "Turreted Limo", 220 | [tostring(GetHashKey("lurcher"))] = "Lurcher", 221 | [tostring(GetHashKey("luxor"))] = "Luxor", 222 | [tostring(GetHashKey("luxor2"))] = "Luxor Deluxe", 223 | [tostring(GetHashKey("lynx"))] = "Lynx", 224 | [tostring(GetHashKey("mamba"))] = "Mamba", 225 | [tostring(GetHashKey("mammatus"))] = "Mammatus", 226 | [tostring(GetHashKey("manana"))] = "Manana", 227 | [tostring(GetHashKey("marquis"))] = "Marquis", 228 | [tostring(GetHashKey("marshall"))] = "Marshall", 229 | [tostring(GetHashKey("massacro"))] = "Massacro", 230 | [tostring(GetHashKey("massacro2"))] = "Massacro (Racecar)", 231 | [tostring(GetHashKey("maverick"))] = "Maverick", 232 | [tostring(GetHashKey("mesa"))] = "Mesa", 233 | [tostring(GetHashKey("mesa2"))] = "Mesa", 234 | [tostring(GetHashKey("mesa3"))] = "Mesa", 235 | [tostring(GetHashKey("metrotrain"))] = "Freight Train", 236 | [tostring(GetHashKey("miljet"))] = "Miljet", 237 | [tostring(GetHashKey("minivan"))] = "Minivan", 238 | [tostring(GetHashKey("minivan2"))] = "Minivan Custom", 239 | [tostring(GetHashKey("mixer"))] = "Mixer", 240 | [tostring(GetHashKey("mixer2"))] = "Mixer", 241 | [tostring(GetHashKey("monroe"))] = "Monroe", 242 | [tostring(GetHashKey("monster"))] = "Liberator", 243 | [tostring(GetHashKey("moonbeam"))] = "Moonbeam", 244 | [tostring(GetHashKey("moonbeam2"))] = "Moonbeam Custom", 245 | [tostring(GetHashKey("mower"))] = "Lawn Mower", 246 | [tostring(GetHashKey("mule"))] = "Mule", 247 | [tostring(GetHashKey("mule2"))] = "Mule", 248 | [tostring(GetHashKey("mule3"))] = "Mule", 249 | [tostring(GetHashKey("nemesis"))] = "Nemesis", 250 | [tostring(GetHashKey("nightshade"))] = "Nightshade", 251 | [tostring(GetHashKey("nimbus"))] = "Nimbus", 252 | [tostring(GetHashKey("ninef"))] = "9F", 253 | [tostring(GetHashKey("ninef2"))] = "9F Cabrio", 254 | [tostring(GetHashKey("omnis"))] = "Omnis", 255 | [tostring(GetHashKey("oracle"))] = "Oracle XS", 256 | [tostring(GetHashKey("oracle2"))] = "Oracle", 257 | [tostring(GetHashKey("osiris"))] = "Osiris", 258 | [tostring(GetHashKey("packer"))] = "Packer", 259 | [tostring(GetHashKey("panto"))] = "Panto", 260 | [tostring(GetHashKey("paradise"))] = "Paradise", 261 | [tostring(GetHashKey("patriot"))] = "Patriot", 262 | [tostring(GetHashKey("pbus"))] = "Prison Bus", 263 | [tostring(GetHashKey("pcj"))] = "PCJ 600", 264 | [tostring(GetHashKey("penumbra"))] = "Penumbra", 265 | [tostring(GetHashKey("peyote"))] = "Peyote", 266 | [tostring(GetHashKey("pfister811"))] = "811", 267 | [tostring(GetHashKey("phantom"))] = "Phantom", 268 | [tostring(GetHashKey("phoenix"))] = "Phoenix", 269 | [tostring(GetHashKey("picador"))] = "Picador", 270 | [tostring(GetHashKey("pigalle"))] = "Pigalle", 271 | [tostring(GetHashKey("police"))] = "Police Cruiser", 272 | [tostring(GetHashKey("police2"))] = "Police Cruiser", 273 | [tostring(GetHashKey("police3"))] = "Police Cruiser", 274 | [tostring(GetHashKey("police4"))] = "Unmarked Cruiser", 275 | [tostring(GetHashKey("policeb"))] = "Police Bike", 276 | [tostring(GetHashKey("policeold1"))] = "Police Rancher", 277 | [tostring(GetHashKey("policeold2"))] = "Police Roadcruiser", 278 | [tostring(GetHashKey("policet"))] = "Police Transporter", 279 | [tostring(GetHashKey("polmav"))] = "Police Maverick", 280 | [tostring(GetHashKey("pony"))] = "Pony", 281 | [tostring(GetHashKey("pony2"))] = "Pony", 282 | [tostring(GetHashKey("pounder"))] = "Pounder", 283 | [tostring(GetHashKey("prairie"))] = "Prairie", 284 | [tostring(GetHashKey("pranger"))] = "Park Ranger", 285 | [tostring(GetHashKey("predator"))] = "Police Predator", 286 | [tostring(GetHashKey("premier"))] = "Premier", 287 | [tostring(GetHashKey("primo"))] = "Primo", 288 | [tostring(GetHashKey("primo2"))] = "Primo Custom", 289 | [tostring(GetHashKey("proptrailer"))] = "NULL", 290 | [tostring(GetHashKey("prototipo"))] = "X80 Proto", 291 | [tostring(GetHashKey("radi"))] = "Radius", 292 | [tostring(GetHashKey("raketrailer"))] = "Trailer", 293 | [tostring(GetHashKey("rallytruck"))] = "Dune", 294 | [tostring(GetHashKey("rancherxl"))] = "Rancher XL", 295 | [tostring(GetHashKey("rancherxl2"))] = "Rancher XL", 296 | [tostring(GetHashKey("rapidgt"))] = "Rapid GT", 297 | [tostring(GetHashKey("rapidgt2"))] = "Rapid GT", 298 | [tostring(GetHashKey("ratloader"))] = "Rat-Loader", 299 | [tostring(GetHashKey("ratloader2"))] = "Rat-Truck", 300 | [tostring(GetHashKey("reaper"))] = "Reaper", 301 | [tostring(GetHashKey("rebel"))] = "Rusty Rebel", 302 | [tostring(GetHashKey("rebel2"))] = "Rebel", 303 | [tostring(GetHashKey("regina"))] = "Regina", 304 | [tostring(GetHashKey("rentalbus"))] = "Rental Shuttle Bus", 305 | [tostring(GetHashKey("rhapsody"))] = "Rhapsody", 306 | [tostring(GetHashKey("rhino"))] = "Rhino Tank", 307 | [tostring(GetHashKey("riot"))] = "Police Riot", 308 | [tostring(GetHashKey("ripley"))] = "Ripley", 309 | [tostring(GetHashKey("rocoto"))] = "Rocoto", 310 | [tostring(GetHashKey("romero"))] = "Romero Hearse", 311 | [tostring(GetHashKey("rubble"))] = "Rubble", 312 | [tostring(GetHashKey("ruffian"))] = "Ruffian", 313 | [tostring(GetHashKey("ruiner"))] = "Ruiner", 314 | [tostring(GetHashKey("rumpo"))] = "Rumpo", 315 | [tostring(GetHashKey("rumpo2"))] = "Rumpo", 316 | [tostring(GetHashKey("rumpo3"))] = "Rumpo Custom", 317 | [tostring(GetHashKey("sabregt"))] = "Sabre Turbo", 318 | [tostring(GetHashKey("sabregt2"))] = "Sabre Turbo Custom", 319 | [tostring(GetHashKey("sadler"))] = "Sadler", 320 | [tostring(GetHashKey("sadler2"))] = "Sadler", 321 | [tostring(GetHashKey("sanchez"))] = "Sanchez (livery)", 322 | [tostring(GetHashKey("sanchez2"))] = "Sanchez", 323 | [tostring(GetHashKey("sandking"))] = "Sandking XL", 324 | [tostring(GetHashKey("sandking2"))] = "Sandking SWB", 325 | [tostring(GetHashKey("savage"))] = "Savage", 326 | [tostring(GetHashKey("schafter2"))] = "Schafter", 327 | [tostring(GetHashKey("schafter3"))] = "Schafter V12", 328 | [tostring(GetHashKey("schafter4"))] = "Schafter LWB", 329 | [tostring(GetHashKey("schafter5"))] = "Schafter V12 (Armored)", 330 | [tostring(GetHashKey("schafter6"))] = "Schafter LWB (Armored)", 331 | [tostring(GetHashKey("schwarzer"))] = "Schwartzer", 332 | [tostring(GetHashKey("schwarze"))] = "Schwartzer", 333 | [tostring(GetHashKey("scorcher"))] = "Scorcher", 334 | [tostring(GetHashKey("scrap"))] = "Scrap Truck", 335 | [tostring(GetHashKey("seashark"))] = "Seashark", 336 | [tostring(GetHashKey("seashark2"))] = "Seashark", 337 | [tostring(GetHashKey("seashark3"))] = "Seashark", 338 | [tostring(GetHashKey("seminole"))] = "Seminole", 339 | [tostring(GetHashKey("sentinel"))] = "Sentinel XS", 340 | [tostring(GetHashKey("sentinel2"))] = "Sentinel", 341 | [tostring(GetHashKey("serrano"))] = "Serrano", 342 | [tostring(GetHashKey("seven70"))] = "Seven-70", 343 | [tostring(GetHashKey("shamal"))] = "Shamal", 344 | [tostring(GetHashKey("sheava"))] = "ETR1", 345 | [tostring(GetHashKey("sheriff"))] = "Sheriff Cruiser", 346 | [tostring(GetHashKey("sheriff2"))] = "Sheriff SUV", 347 | [tostring(GetHashKey("skylift"))] = "Skylift", 348 | [tostring(GetHashKey("slamvan"))] = "Slamvan", 349 | [tostring(GetHashKey("slamvan2"))] = "Lost Slamvan", 350 | [tostring(GetHashKey("slamvan3"))] = "Slamvan Custom", 351 | [tostring(GetHashKey("sovereign"))] = "Sovereign", 352 | [tostring(GetHashKey("speeder"))] = "Speeder", 353 | [tostring(GetHashKey("speeder2"))] = "Speeder", 354 | [tostring(GetHashKey("speedo"))] = "Speedo", 355 | [tostring(GetHashKey("speedo2"))] = "Clown Van", 356 | [tostring(GetHashKey("squalo"))] = "Squalo", 357 | [tostring(GetHashKey("stalion"))] = "Stallion", 358 | [tostring(GetHashKey("stalion2"))] = "Burger Shot Stallion", 359 | [tostring(GetHashKey("stanier"))] = "Stanier", 360 | [tostring(GetHashKey("stinger"))] = "Stinger", 361 | [tostring(GetHashKey("stingergt"))] = "Stinger GT", 362 | [tostring(GetHashKey("stockade"))] = "Stockade", 363 | [tostring(GetHashKey("stockade3"))] = "Stockade", 364 | [tostring(GetHashKey("stratum"))] = "Stratum", 365 | [tostring(GetHashKey("stretch"))] = "Stretch", 366 | [tostring(GetHashKey("stunt"))] = "Mallard", 367 | [tostring(GetHashKey("submersible"))] = "Submersible", 368 | [tostring(GetHashKey("submersible2"))] = "Kraken", 369 | [tostring(GetHashKey("sultan"))] = "Sultan", 370 | [tostring(GetHashKey("sultanrs"))] = "Sultan RS", 371 | [tostring(GetHashKey("suntrap"))] = "Suntrap", 372 | [tostring(GetHashKey("superd"))] = "Super Diamond", 373 | [tostring(GetHashKey("supervolito"))] = "SuperVolito", 374 | [tostring(GetHashKey("supervolito2"))] = "SuperVolito Carbon", 375 | [tostring(GetHashKey("surano"))] = "Surano", 376 | [tostring(GetHashKey("surfer"))] = "Surfer", 377 | [tostring(GetHashKey("surfer2"))] = "Surfer", 378 | [tostring(GetHashKey("surge"))] = "Surge", 379 | [tostring(GetHashKey("swift"))] = "Swift", 380 | [tostring(GetHashKey("swift2"))] = "Swift Deluxe", 381 | [tostring(GetHashKey("t20"))] = "T20", 382 | [tostring(GetHashKey("taco"))] = "Taco Van", 383 | [tostring(GetHashKey("tailgater"))] = "Tailgater", 384 | [tostring(GetHashKey("tampa"))] = "Tampa", 385 | [tostring(GetHashKey("tampa2"))] = "Drift Tampa", 386 | [tostring(GetHashKey("tanker"))] = "Trailer", 387 | [tostring(GetHashKey("tanker2"))] = "NULL", 388 | [tostring(GetHashKey("tankercar"))] = "Freight Train", 389 | [tostring(GetHashKey("taxi"))] = "Taxi", 390 | [tostring(GetHashKey("technical"))] = "Technical", 391 | [tostring(GetHashKey("thrust"))] = "Thrust", 392 | [tostring(GetHashKey("tiptruck"))] = "Tipper", 393 | [tostring(GetHashKey("tiptruck2"))] = "Tipper", 394 | [tostring(GetHashKey("titan"))] = "Titan", 395 | [tostring(GetHashKey("tornado"))] = "Tornado", 396 | [tostring(GetHashKey("tornado2"))] = "Tornado", 397 | [tostring(GetHashKey("tornado3"))] = "Tornado", 398 | [tostring(GetHashKey("tornado4"))] = "Tornado", 399 | [tostring(GetHashKey("tornado5"))] = "Tornado Custom", 400 | [tostring(GetHashKey("toro"))] = "Toro", 401 | [tostring(GetHashKey("toro2"))] = "Toro", 402 | [tostring(GetHashKey("tourbus"))] = "Tourbus", 403 | [tostring(GetHashKey("towtruck"))] = "Towtruck", 404 | [tostring(GetHashKey("towtruck2"))] = "Towtruck", 405 | [tostring(GetHashKey("tr2"))] = "Trailer", 406 | [tostring(GetHashKey("tr3"))] = "Trailer", 407 | [tostring(GetHashKey("tr4"))] = "Trailer", 408 | [tostring(GetHashKey("tractor"))] = "Tractor", 409 | [tostring(GetHashKey("tractor2"))] = "Fieldmaster", 410 | [tostring(GetHashKey("tractor3"))] = "Fieldmaster", 411 | [tostring(GetHashKey("trailerlogs"))] = "Trailer", 412 | [tostring(GetHashKey("trailers"))] = "Trailer", 413 | [tostring(GetHashKey("trailers2"))] = "Trailer", 414 | [tostring(GetHashKey("trailers3"))] = "Trailer", 415 | [tostring(GetHashKey("trailersmall"))] = "Trailer", 416 | [tostring(GetHashKey("trash"))] = "Trashmaster", 417 | [tostring(GetHashKey("trash2"))] = "Trashmaster", 418 | [tostring(GetHashKey("trflat"))] = "Trailer", 419 | [tostring(GetHashKey("tribike"))] = "Whippet Race Bike", 420 | [tostring(GetHashKey("tribike2"))] = "Endurex Race Bike", 421 | [tostring(GetHashKey("tribike3"))] = "Tri-Cycles Race Bike", 422 | [tostring(GetHashKey("trophytruck"))] = "Trophy Truck", 423 | [tostring(GetHashKey("trophytruck2"))] = "Desert Raid", 424 | [tostring(GetHashKey("tropic"))] = "Tropic", 425 | [tostring(GetHashKey("tropic2"))] = "Tropic", 426 | [tostring(GetHashKey("tropos"))] = "Tropos Rallye", 427 | [tostring(GetHashKey("tug"))] = "Tug", 428 | [tostring(GetHashKey("turismor"))] = "Turismo R", 429 | [tostring(GetHashKey("tvtrailer"))] = "Trailer", 430 | [tostring(GetHashKey("tyrus"))] = "Tyrus", 431 | [tostring(GetHashKey("utillitruck"))] = "Utility Truck", 432 | [tostring(GetHashKey("utillitruck2"))] = "Utility Truck", 433 | [tostring(GetHashKey("utillitruck3"))] = "Utility Truck", 434 | [tostring(GetHashKey("vacca"))] = "Vacca", 435 | [tostring(GetHashKey("vader"))] = "Vader", 436 | [tostring(GetHashKey("valkyrie"))] = "Valkyrie", 437 | [tostring(GetHashKey("valkyrie2"))] = "Valkyrie MOD.0", 438 | [tostring(GetHashKey("velum"))] = "Velum", 439 | [tostring(GetHashKey("velum2"))] = "Velum 5-Seater", 440 | [tostring(GetHashKey("verlierer2"))] = "Verlierer", 441 | [tostring(GetHashKey("vestra"))] = "Vestra", 442 | [tostring(GetHashKey("vigero"))] = "Vigero", 443 | [tostring(GetHashKey("vindicator"))] = "Vindicator", 444 | [tostring(GetHashKey("virgo"))] = "Virgo", 445 | [tostring(GetHashKey("virgo2"))] = "Virgo Classic Custom", 446 | [tostring(GetHashKey("virgo3"))] = "Virgo Classic", 447 | [tostring(GetHashKey("volatus"))] = "Volatus", 448 | [tostring(GetHashKey("voltic"))] = "Voltic", 449 | [tostring(GetHashKey("voodoo"))] = "Voodoo Custom", 450 | [tostring(GetHashKey("voodoo2"))] = "Voodoo", 451 | [tostring(GetHashKey("warrener"))] = "Warrener", 452 | [tostring(GetHashKey("washington"))] = "Washington", 453 | [tostring(GetHashKey("windsor"))] = "Windsor", 454 | [tostring(GetHashKey("windsor2"))] = "Windsor Drop", 455 | [tostring(GetHashKey("xls"))] = "XLS", 456 | [tostring(GetHashKey("xls2"))] = "XLS (Armored)", 457 | [tostring(GetHashKey("youga"))] = "Youga", 458 | [tostring(GetHashKey("zentorno"))] = "Zentorno", 459 | [tostring(GetHashKey("zion"))] = "Zion", 460 | [tostring(GetHashKey("zion2"))] = "Zion Cabrio", 461 | [tostring(GetHashKey("ztype"))] = "Z-Type" 462 | } 463 | 464 | function reverseVehicleHash(hash) 465 | if type(hash) ~= "string" then 466 | hash = tostring(hash) 467 | end 468 | 469 | local name = VEHICLE_HASHES[hash] 470 | if name ~= nil then 471 | return name 472 | end 473 | 474 | Citizen.Trace("Error reversing vehicle hash \"" .. hash .. "\". Maybe it's not been added yet?") 475 | return "Unknown Vehicle" 476 | end 477 | -------------------------------------------------------------------------------- /example_client/reverse_location_hashes.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LiveMap - A LiveMap for FiveM servers 3 | Copyright (C) 2017 Jordan Dalton 4 | 5 | You should have received a copy of the GNU General Public License 6 | along with this program in the file "LICENSE". If not, see . 7 | ]] 8 | 9 | local AREA_HASHES = { 10 | [tostring("2072609373")] = "Blaine County", 11 | [tostring("-289320599")] = "Los Santos" 12 | } 13 | 14 | local ZONE_HASHES = { 15 | [tostring(GetHashKey("AIRP"))] = "Los Santos International Airport", 16 | [tostring(GetHashKey("ALAMO"))] = "Alamo Sea", 17 | [tostring(GetHashKey("ALTA"))] = "Alta", 18 | [tostring(GetHashKey("ARMYB"))] = "Fort Zancudo", 19 | [tostring(GetHashKey("BANHAMC"))] = "Banham Canyon Dr", 20 | [tostring(GetHashKey("BANNING"))] = "Banning", 21 | [tostring(GetHashKey("BEACH"))] = "Vespucci Beach", 22 | [tostring(GetHashKey("BHAMCA"))] = "Banham Canyon", 23 | [tostring(GetHashKey("BRADP"))] = "Braddock Pass", 24 | [tostring(GetHashKey("BRADT"))] = "Braddock Tunnel", 25 | [tostring(GetHashKey("BURTON"))] = "Burton", 26 | [tostring(GetHashKey("CALAFB"))] = "Calafia Bridge", 27 | [tostring(GetHashKey("CANNY"))] = "Raton Canyon", 28 | [tostring(GetHashKey("CCREAK"))] = "Cassidy Creek", 29 | [tostring(GetHashKey("CHAMH"))] = "Chamberlain Hills", 30 | [tostring(GetHashKey("CHIL"))] = "Vinewood Hills", 31 | [tostring(GetHashKey("CHU"))] = "Chumash", 32 | [tostring(GetHashKey("CMSW"))] = "Chiliad Mountain State Wilderness", 33 | [tostring(GetHashKey("CYPRE"))] = "Cypress Flats", 34 | [tostring(GetHashKey("DAVIS"))] = "Davis", 35 | [tostring(GetHashKey("DELBE"))] = "Del Perro Beach", 36 | [tostring(GetHashKey("DELPE"))] = "Del Perro", 37 | [tostring(GetHashKey("DELSOL"))] = "La Puerta", 38 | [tostring(GetHashKey("DESRT"))] = "Grand Senora Desert", 39 | [tostring(GetHashKey("DOWNT"))] = "Downtown", 40 | [tostring(GetHashKey("DTVINE"))] = "Downtown Vinewood", 41 | [tostring(GetHashKey("EAST_V"))] = "East Vinewood", 42 | [tostring(GetHashKey("EBURO"))] = "El Burro Heights", 43 | [tostring(GetHashKey("ELGORL"))] = "El Gordo Lighthouse", 44 | [tostring(GetHashKey("ELYSIAN"))] = "Elysian Island", 45 | [tostring(GetHashKey("GALFISH"))] = "Galilee", 46 | [tostring(GetHashKey("GOLF"))] = "GWC and Golfing Society", 47 | [tostring(GetHashKey("GRAPES"))] = "Grapeseed", 48 | [tostring(GetHashKey("GREATC"))] = "Great Chaparral", 49 | [tostring(GetHashKey("HARMO"))] = "Harmony", 50 | [tostring(GetHashKey("HAWICK"))] = "Hawick", 51 | [tostring(GetHashKey("HORS"))] = "Vinewood Racetrack", 52 | [tostring(GetHashKey("HUMLAB"))] = "Humane Labs and Research", 53 | [tostring(GetHashKey("JAIL"))] = "Bolingbroke Penitentiary", 54 | [tostring(GetHashKey("KOREAT"))] = "Little Seoul", 55 | [tostring(GetHashKey("LACT"))] = "Land Act Reservoir", 56 | [tostring(GetHashKey("LAGO"))] = "Lago Zancudo", 57 | [tostring(GetHashKey("LDAM"))] = "Land Act Dam", 58 | [tostring(GetHashKey("LEGSQU"))] = "Legion Square", 59 | [tostring(GetHashKey("LMESA"))] = "La Mesa", 60 | [tostring(GetHashKey("LOSPUER"))] = "La Puerta", 61 | [tostring(GetHashKey("MIRR"))] = "Mirror Park", 62 | [tostring(GetHashKey("MORN"))] = "Morningwood", 63 | [tostring(GetHashKey("MOVIE"))] = "Richards Majestic", 64 | [tostring(GetHashKey("MTCHIL"))] = "Mount Chiliad", 65 | [tostring(GetHashKey("MTGORDO"))] = "Mount Gordo", 66 | [tostring(GetHashKey("MTJOSE"))] = "Mount Josiah", 67 | [tostring(GetHashKey("MURRI"))] = "Murrieta Heights", 68 | [tostring(GetHashKey("NCHU"))] = "North Chumash", 69 | [tostring(GetHashKey("NOOSE"))] = "N.O.O.S.E", 70 | [tostring(GetHashKey("OCEANA"))] = "Pacific Ocean", 71 | [tostring(GetHashKey("PALCOV"))] = "Paleto Cove", 72 | [tostring(GetHashKey("PALETO"))] = "Paleto Bay", 73 | [tostring(GetHashKey("PALFOR"))] = "Paleto Forest", 74 | [tostring(GetHashKey("PALHIGH"))] = "Palomino Highlands", 75 | [tostring(GetHashKey("PALMPOW"))] = "Palmer-Taylor Power Station", 76 | [tostring(GetHashKey("PBLUFF"))] = "Pacific Bluffs", 77 | [tostring(GetHashKey("PBOX"))] = "Pillbox Hill", 78 | [tostring(GetHashKey("PROCOB"))] = "Procopio Beach", 79 | [tostring(GetHashKey("RANCHO"))] = "Rancho", 80 | [tostring(GetHashKey("RGLEN"))] = "Richman Glen", 81 | [tostring(GetHashKey("RICHM"))] = "Richman", 82 | [tostring(GetHashKey("ROCKF"))] = "Rockford Hills", 83 | [tostring(GetHashKey("RTRAK"))] = "Redwood Lights Track", 84 | [tostring(GetHashKey("SANAND"))] = "San Andreas", 85 | [tostring(GetHashKey("SANCHIA"))] = "San Chianski Mountain Range", 86 | [tostring(GetHashKey("SANDY"))] = "Sandy Shores", 87 | [tostring(GetHashKey("SKID"))] = "Mission Row", 88 | [tostring(GetHashKey("SLAB"))] = "Stab City", 89 | [tostring(GetHashKey("STAD"))] = "Maze Bank Arena", 90 | [tostring(GetHashKey("STRAW"))] = "Strawberry", 91 | [tostring(GetHashKey("TATAMO"))] = "Tataviam Mountains", 92 | [tostring(GetHashKey("TERMINA"))] = "Terminal", 93 | [tostring(GetHashKey("TEXTI"))] = "Textile City", 94 | [tostring(GetHashKey("TONGVAH"))] = "Tongva Hills", 95 | [tostring(GetHashKey("TONGVAV"))] = "Tongva Valley", 96 | [tostring(GetHashKey("VCANA"))] = "Vespucci Canals", 97 | [tostring(GetHashKey("VESP"))] = "Vespucci", 98 | [tostring(GetHashKey("VINE"))] = "Vinewood", 99 | [tostring(GetHashKey("WINDF"))] = "Ron Alternates Wind Farm", 100 | [tostring(GetHashKey("WVINE"))] = "West Vinewood", 101 | [tostring(GetHashKey("ZANCUDO"))] = "Zancudo River", 102 | [tostring(GetHashKey("ZP_ORT"))] = "Port of South Los Santos", 103 | [tostring(GetHashKey("ZQ_UAR"))] = "Davis Quartz" 104 | } 105 | -- Street names and hashes from http://gtaforums.com/topic/897078-street-names-alphabetised-plain-text-file/ 106 | local STREET_BACKUP = { 107 | [tostring(0x8CD2E019)] = "Abattoir Ave", 108 | [tostring(0xDDCBDC74)] = "Abe Milton Pkwy", 109 | [tostring(0x4B7B2734)] = "Ace Jones Dr", 110 | [tostring(0x40D0731C)] = "Adam's Apple Blvd", 111 | [tostring(0x8CCFEA79)] = "Aguja St", 112 | [tostring(0x7EC39AE2)] = "Algonquin Blvd", 113 | [tostring(0x92E1C090)] = "Alhambra Dr", 114 | [tostring(0xB38D48D1)] = "Alta Pl", 115 | [tostring(0x08B9CC73)] = "Alta St", 116 | [tostring(0x1EA69437)] = "Amarillo Vista", 117 | [tostring(0x29E328A9)] = "Amarillo Way", 118 | [tostring(0x705018B4)] = "Americano Way", 119 | [tostring(0x97805066)] = "Applan Way", 120 | [tostring(0xD39FE932)] = "Armadillo Ave", 121 | [tostring(0x34627A5F)] = "Atlee St", 122 | [tostring(0x96B2B85F)] = "Autopia Pkwy", 123 | [tostring(0x62261708)] = "Backlot Blvd", 124 | [tostring(0x78905544)] = "Bait St", 125 | [tostring(0x15E466FD)] = "Banham Canyon Dr", 126 | [tostring(0x26944B16)] = "Barbareno Rd", 127 | [tostring(0x6F927644)] = "Bay City Ave", 128 | [tostring(0xEDC3B8F4)] = "Bay City Incline", 129 | [tostring(0xF5EFE777)] = "Baytree Canyon Rd", 130 | [tostring(0xE332AD5D)] = "Bear St", 131 | [tostring(0x012074FF)] = "Blvd Del Perro", 132 | [tostring(0x22198C67)] = "Bridge St", 133 | [tostring(0x5F27252E)] = "Brouge Ave", 134 | [tostring(0xBCD75B2A)] = "Buccaneer Way", 135 | [tostring(0x80323559)] = "Buen Vino Rd", 136 | [tostring(0xB76E170F)] = "Calafia Rd", 137 | [tostring(0xEF6AF2C1)] = "Calafia Way", 138 | [tostring(0x46EC8CF6)] = "Calais Ave", 139 | [tostring(0x131DF79C)] = "Capital Blvd", 140 | [tostring(0x40468D03)] = "Carcer Way", 141 | [tostring(0x56F28308)] = "Carson Ave", 142 | [tostring(0x261C80DB)] = "Cascabel Ave", 143 | [tostring(0xEA41FBE8)] = "Cat-Claw Ave", 144 | [tostring(0x73F16A64)] = "Cavalry Blvd", 145 | [tostring(0x4900EAFD)] = "Chianski Passage", 146 | [tostring(0xF5196793)] = "Cholla Rd", 147 | [tostring(0x36A6BE4B)] = "Cholla Springs Ave", 148 | [tostring(0x29DDB334)] = "Chum St", 149 | [tostring(0x3A82547D)] = "Chupacabra St", 150 | [tostring(0xE657DF40)] = "Clinton Ave", 151 | [tostring(0x9ACC3D68)] = "Cockingend Dr", 152 | [tostring(0x7E8446DD)] = "Conquistador St", 153 | [tostring(0x09A04736)] = "Cortes St", 154 | [tostring(0x186A32D2)] = "Cougar Ave", 155 | [tostring(0xBEA2B02D)] = "Covenant Ave", 156 | [tostring(0x7BD54361)] = "Cox Way", 157 | [tostring(0xE10C41BE)] = "Crusade Rd", 158 | [tostring(0xE105D935)] = "Darien Ave", 159 | [tostring(0x45B1CA3D)] = "Davis Ave", 160 | [tostring(0x072580D7)] = "Decker St", 161 | [tostring(0xC8690C80)] = "Del Perro Fwy", 162 | [tostring(0xF7EA09F7)] = "Didion Dr", 163 | [tostring(0x6D5EEFEC)] = "Dorset Dr", 164 | [tostring(0x6705124C)] = "Dorset Pl", 165 | [tostring(0x75E5EA92)] = "Dry Dock St", 166 | [tostring(0x8A00A702)] = "Duluoz Ave", 167 | [tostring(0xCABEF9A8)] = "Dunstable Dr", 168 | [tostring(0xE0D4A5CB)] = "Dunstable Ln", 169 | [tostring(0x6635C142)] = "Dutch London St", 170 | [tostring(0xEDEB73E4)] = "East Galileo Ave", 171 | [tostring(0x6CC8B86E)] = "East Mirror Dr", 172 | [tostring(0x410A49CD)] = "Eastbourne Way", 173 | [tostring(0x6418F6FE)] = "Eclipse Blvd", 174 | [tostring(0xD0B11243)] = "Edwood Way", 175 | [tostring(0xB44C8E74)] = "El Burro Blvd", 176 | [tostring(0xCB000216)] = "El Gordo Dr", 177 | [tostring(0x7FADF1B2)] = "El Rancho Blvd", 178 | [tostring(0x7BCF327F)] = "Electric Ave", 179 | [tostring(0x0798837A)] = "Elgin Ave", 180 | [tostring(0x2E49B265)] = "Elysian Fields Fwy", 181 | [tostring(0x2C72B469)] = "Equality Way", 182 | [tostring(0x452F38AC)] = "Ewing St", 183 | [tostring(0x4D8D8A38)] = "Exceptionalists Way", 184 | [tostring(0x90963D6A)] = "Fantastic Pl", 185 | [tostring(0xF3B2BE94)] = "Fenwell Pl", 186 | [tostring(0xF641831C)] = "Fort Zancudo Approach Rd", 187 | [tostring(0xE94A6DDC)] = "Forum Dr", 188 | [tostring(0xD0B818E4)] = "Four Way", 189 | [tostring(0xD9B72921)] = "Fudge Ln", 190 | [tostring(0x85F5588B)] = "Galileo Rd", 191 | [tostring(0xD5A607F8)] = "Gentry Lane", 192 | [tostring(0x534D8027)] = "Ginger St", 193 | [tostring(0xC431BCEE)] = "Glory Way", 194 | [tostring(0x7F84CC28)] = "Goma St", 195 | [tostring(0x4DCE72D8)] = "Grapeseed Ave", 196 | [tostring(0x3132B9A5)] = "Grapeseed Main St", 197 | [tostring(0x4C9260C4)] = "Greenwich Pkwy", 198 | [tostring(0xCC6E9206)] = "Greenwich Pl", 199 | [tostring(0xD72068C5)] = "Greenwich Way", 200 | [tostring(0x00CC5CA0)] = "Grove St", 201 | [tostring(0x897BB935)] = "Hanger Way", 202 | [tostring(0xCC9893E2)] = "Hangman Ave", 203 | [tostring(0x5E315A37)] = "Hardy Way", 204 | [tostring(0x605D416C)] = "Hawick Ave", 205 | [tostring(0xDB0C8D26)] = "Heritage Way", 206 | [tostring(0x764B0E0F)] = "High Spanish Ave", 207 | [tostring(0x65BCFFA3)] = "Hillcrest Ave", 208 | [tostring(0xA1F822A2)] = "Hillcrest Ridge Access Rd", 209 | [tostring(0xBC825FE3)] = "Imagination Ct", 210 | [tostring(0x78B17CF6)] = "Imperial Blvd", 211 | [tostring(0x4B5B59A7)] = "Innocence Blvd", 212 | [tostring(0x434CC15C)] = "Integrity Way", 213 | [tostring(0x8DFDF903)] = "Invention Ct", 214 | [tostring(0x661AA779)] = "Jamestown St", 215 | [tostring(0x8F9D12E7)] = "Joad Ln", 216 | [tostring(0x0A5BFF42)] = "Joshua Rd", 217 | [tostring(0xFB90B746)] = "Kimble Hill Dr", 218 | [tostring(0xCC628804)] = "Kortz Dr", 219 | [tostring(GetHashKey("LOSPFY"))] = "La Puerta Fwy", 220 | [tostring(0x98295423)] = "Labor Pl", 221 | [tostring(0x0973B8B6)] = "Laguna Pl", 222 | [tostring(0x5E4F2EE7)] = "Lake Vinewood Dr", 223 | [tostring(0xF0089E63)] = "Las Lagunas Blvd", 224 | [tostring(0x00A55D60)] = "Lemoyne St", 225 | [tostring(0xDE37DA0C)] = "Lesbos Ln", 226 | [tostring(0x2F26BBD7)] = "Liberty St", 227 | [tostring(0x0BF1AD8D)] = "Lindsay Circus", 228 | [tostring(0x9DB39520)] = "Little Bighorn Ave", 229 | [tostring(0x5C483E1D)] = "Lolita Ave", 230 | [tostring(0xEC99478C)] = "Low Power St", 231 | [tostring(0x64306156)] = "Macdonald St", 232 | [tostring(0xD9C1EACE)] = "Mad Wayne Thunder Dr", 233 | [tostring(0xCF1A660B)] = "Magellan Ave", 234 | [tostring(0xE7073C86)] = "Marathon Ave", 235 | [tostring(0x32D92D45)] = "Marina Dr", 236 | [tostring(0x4A3712C2)] = "Marlowe Dr", 237 | [tostring(0x7EFD9AFE)] = "Melanoma St", 238 | [tostring(0x594944F9)] = "Meringue Ln", 239 | [tostring(0x639007F6)] = "Meteor St", 240 | [tostring(0xC99154C3)] = "Middle Rd", 241 | [tostring(GetHashKey("MILTON"))] = "Milton Rd", 242 | [tostring(0x1FA2C931)] = "Mirror Park Blvd", 243 | [tostring(0x0CC8AAE6)] = "Mirror Pl", 244 | [tostring(0xC122D85F)] = "Morningwood Blvd", 245 | [tostring(0x906B3D92)] = "Mountain View Dr", 246 | [tostring(0x9117E6AD)] = "Movie Star Way", 247 | [tostring(0xD3CD9C6E)] = "Mt Haan Dr", 248 | [tostring(0x946FDCC9)] = "Mt Haan Rd", 249 | [tostring(0x5EBC827B)] = "Mt Vinewood Dr", 250 | [tostring(0x5C033D11)] = "Mutiny Rd", 251 | [tostring(0xA841625E)] = "New Empire Way", 252 | [tostring(0x07AB9391)] = "Nikola Ave", 253 | [tostring(0x7D92FF5A)] = "Nikola Pl", 254 | [tostring(0x63F44C25)] = "Niland Ave", 255 | [tostring(0x995C30AA)] = "Normandy Dr", 256 | [tostring(0xDE65DFA8)] = "North Archer Ave", 257 | [tostring(0x269FDEE5)] = "North Calafia Way", 258 | [tostring(0xA2F6CA31)] = "North Conker Ave", 259 | [tostring(0xE9D7AF42)] = "North El Rancho Blvd", 260 | [tostring(0x59920DAD)] = "North Rockford Dr", 261 | [tostring(0xB74C0D46)] = "North Sheldon Ave", 262 | [tostring(0xE34603F3)] = "North Western Ave", 263 | [tostring(0x245499BF)] = "Nowhere Rd", 264 | [tostring(0x20101F69)] = "Occupation Ave", 265 | [tostring(0x192E8516)] = "Olympic Fwy", 266 | [tostring(GetHashKey("ONEIL"))] = "O'Neil Way", 267 | [tostring(0xB87FAA60)] = "Orchardville Ave", 268 | [tostring(0x56563954)] = "Paleto Blvd", 269 | [tostring(0x520BFB49)] = "Palomino Ave", 270 | [tostring(0xF5DE6511)] = "Palomino Fwy", 271 | [tostring(0x155FBE2B)] = "Panorama Dr", 272 | [tostring(0xA5883BDE)] = "Peaceful St", 273 | [tostring(0x909B5591)] = "Perth St", 274 | [tostring(0x7C7282C1)] = "Plaice Pl", 275 | [tostring(0x66006A97)] = "Playa Vista", 276 | [tostring(0xCCD0D983)] = "Popular St", 277 | [tostring(0x7D75C728)] = "Portola Dr", 278 | [tostring(0xF959D26E)] = "Power St", 279 | [tostring(0x9A95814F)] = "Procopio Dr", 280 | [tostring(0x0D5F14E6)] = "Prosperity St", 281 | [tostring(0xED13B4BC)] = "Pyrite Ave", 282 | [tostring(0x05EFF99A)] = "Red Desert Ave", 283 | [tostring(0x284CD97B)] = "Richman St", 284 | [tostring(0x159B0DF9)] = "Rockford Dr", 285 | [tostring(0x62E6DB9D)] = "Rodeo Dr", 286 | [tostring(0xA2854172)] = "Roy Lowenstein Blvd", 287 | [tostring(0x9735407C)] = "Rub St", 288 | [tostring(0xB4A79707)] = "Sam Austin Dr", 289 | [tostring(0xF2C73716)] = "San Andreas Ave", 290 | [tostring(0xDA9DCCFB)] = "San Vitus Blvd", 291 | [tostring(0x0502503F)] = "Sandcastle Way", 292 | [tostring(0x38E0429C)] = "Seaview Rd", 293 | [tostring(0x0797DC34)] = "Selma Ave", 294 | [tostring(GetHashKey("SENORA"))] = "Senora Fwy", 295 | [tostring(0x003F6701)] = "Senora Rd", 296 | [tostring(0x7FCABBAD)] = "Senora Way", 297 | [tostring(0xD529ED93)] = "Shank St", 298 | [tostring(0x7727141A)] = "Signal St", 299 | [tostring(0x5C3E7D79)] = "Sinner St", 300 | [tostring(0x8D6FDC93)] = "Sinners Passage", 301 | [tostring(0x097D1470)] = "Sky Way", 302 | [tostring(0x538A9910)] = "Smoke Tree Rd", 303 | [tostring(0x80CBFBCF)] = "South Arsenal St", 304 | [tostring(0x73F8ADE1)] = "South Boulevard Del Perro", 305 | [tostring(0xCDF48F9E)] = "South Mo Milton Dr", 306 | [tostring(0x01D80573)] = "South Rockford Dr", 307 | [tostring(0x7699AA76)] = "South Shambles St", 308 | [tostring(0x917FD2AB)] = "Spanish Ave", 309 | [tostring(0x9DA37EE7)] = "Steele Way", 310 | [tostring(0x3FD7E083)] = "Strangeways Dr", 311 | [tostring(0x63AB52DE)] = "Strawberry Ave", 312 | [tostring(0x101C10C8)] = "Supply St", 313 | [tostring(0xA6761DA3)] = "Sustancia Rd", 314 | [tostring(0x4F69F80D)] = "Swiss St", 315 | [tostring(0x24349A67)] = "Tackle St", 316 | [tostring(0x3D7A8076)] = "Tangerine St", 317 | [tostring(0x09503B1F)] = "Tesla Ave", 318 | [tostring(0x372FD01C)] = "The Third Way", 319 | [tostring(0x1EBDEABC)] = "Tongva Dr", 320 | [tostring(GetHashKey("TOWER"))] = "Tower Way", 321 | [tostring(0x332A2A65)] = "Tug St", 322 | [tostring(0x98F59B29)] = "Union Rd", 323 | [tostring(GetHashKey("UTOPIAG"))] = "Utopia Gardens", 324 | [tostring(0x84B5FCB9)] = "Vespucci Blvd", 325 | [tostring(0xC527457D)] = "Vinewood Blvd", 326 | [tostring(0xD513F002)] = "Vinewood Park Dr", 327 | [tostring(0x43CE38FF)] = "Vitus St", 328 | [tostring(0x983A7D65)] = "West Eclipse Blvd", 329 | [tostring(0x84D115AD)] = "West Galileo Ave", 330 | [tostring(0xFFFC76B4)] = "Whispymound Dr", 331 | [tostring(0xB4BB47B3)] = "Wild Oats Dr", 332 | [tostring(0xCE9D4092)] = "York St", 333 | [tostring(0x21CFAEFC)] = "Zancudo Ave", 334 | [tostring(0x96B41893)] = "Zancudo Rd" 335 | } 336 | 337 | local STREET_HASHES = { 338 | [tostring(GetHashKey("ABBATAVE"))] = "Abattoir Ave", 339 | [tostring(GetHashKey("ABEMIL"))] = "Abe Milton Pkwy", 340 | [tostring(GetHashKey("ACEJONES"))] = "Ace Jones Dr", 341 | [tostring(GetHashKey("ADAMSA"))] = "Adam's Apple Blvd", 342 | [tostring(GetHashKey("AGUJA"))] = "Aguja St", 343 | [tostring(GetHashKey("ALGONQUIN"))] = "Algonquin Blvd", 344 | [tostring(GetHashKey("ALHAMBRA"))] = "Alhambra Dr", 345 | [tostring(GetHashKey("ALTAPL"))] = "Alta Pl", 346 | [tostring(GetHashKey("ALT_ST"))] = "Alta St", 347 | [tostring(GetHashKey("AMARIL"))] = "Amarillo Vista", 348 | [tostring(GetHashKey("AMARILLOW"))] = "Amarillo Way", 349 | [tostring(GetHashKey("AMERICANO"))] = "Americano Way", 350 | [tostring(GetHashKey("ANTWERP"))] = "Jamestown St", 351 | [tostring(GetHashKey("ARMADILLO"))] = "Armadillo Ave", 352 | [tostring(GetHashKey("AUTOPI"))] = "Autopia Pkwy", 353 | [tostring(GetHashKey("BACKLOTF"))] = "Olympic Fwy", 354 | [tostring(GetHashKey("BANHAMC"))] = "Banham Canyon Dr", 355 | [tostring(GetHashKey("BARBAREN"))] = "Barbareno Rd", 356 | [tostring(GetHashKey("BAYCAVE"))] = "Bay City Ave", 357 | [tostring(GetHashKey("BAYCI"))] = "Bay City Incline", 358 | [tostring(GetHashKey("BAYTREECAN"))] = "Baytree Canyon Rd", 359 | [tostring(GetHashKey("BOULDELP"))] = "Boulevard Del Perro", 360 | [tostring(GetHashKey("BRIDGES"))] = "Bridge St", 361 | [tostring(GetHashKey("BUCCA"))] = "Buccaneer Way", 362 | [tostring(GetHashKey("BUENVIN"))] = "Buen Vino Rd", 363 | [tostring(GetHashKey("CAEP"))] = "Caesars Place", 364 | [tostring(GetHashKey("CALAF"))] = "Calafia Rd", 365 | [tostring(GetHashKey("CALFN"))] = "North Calafia Way", 366 | [tostring(GetHashKey("CAPITALB"))] = "Capital Blvd", 367 | [tostring(GetHashKey("CARCER"))] = "Carcer Way", 368 | [tostring(GetHashKey("CARSONA"))] = "Carson Ave", 369 | [tostring(GetHashKey("CASCABEL"))] = "Cascabel Ave", 370 | [tostring(GetHashKey("CASSITRA"))] = "Cassidy Trail", 371 | [tostring(GetHashKey("CATCL"))] = "Cat-Claw Ave", 372 | [tostring(GetHashKey("CATVIEW"))] = "Catfish View", 373 | [tostring(GetHashKey("CAVAL"))] = "Cavalry Blvd", 374 | [tostring(GetHashKey("CHAR_ST"))] = "San Andreas Ave", 375 | [tostring(GetHashKey("CHIPASS"))] = "Chianski Passage", 376 | [tostring(GetHashKey("CHOLLA"))] = "Cholla Springs Ave", 377 | [tostring(GetHashKey("CHOLLAR"))] = "Cholla Rd", 378 | [tostring(GetHashKey("CHUM"))] = "Chum St", 379 | [tostring(GetHashKey("CHUP"))] = "Chupacabra St", 380 | [tostring(GetHashKey("CLINTONA"))] = "Clinton Ave", 381 | [tostring(GetHashKey("COCKING"))] = "Cockingend Dr", 382 | [tostring(GetHashKey("CONQUIS"))] = "Conquistador St", 383 | [tostring(GetHashKey("CORTES"))] = "Cortes St", 384 | [tostring(GetHashKey("COUGARA"))] = "Cougar Ave", 385 | [tostring(GetHashKey("COXW"))] = "Cox Way", 386 | [tostring(GetHashKey("CRUSADE"))] = "Crusade Rd", 387 | [tostring(GetHashKey("DAVISA"))] = "Davis Ave", 388 | [tostring(GetHashKey("DECKERS"))] = "Decker St", 389 | [tostring(GetHashKey("DELPFWY"))] = "Del Perro Fwy", 390 | [tostring(GetHashKey("DENKER"))] = "Brouge Ave", 391 | [tostring(GetHashKey("DIDIO"))] = "Didion Dr", 392 | [tostring(GetHashKey("DORSE"))] = "Dorset Dr", 393 | [tostring(GetHashKey("DORSEP"))] = "Dorset Pl", 394 | [tostring(GetHashKey("DRYDOCK"))] = "Dry Dock St", 395 | [tostring(GetHashKey("DULUOZ"))] = "Duluoz Ave", 396 | [tostring(GetHashKey("DUND"))] = "Dunstable Dr", 397 | [tostring(GetHashKey("DUNL"))] = "Dunstable Ln", 398 | [tostring(GetHashKey("DUTCHTO"))] = "Dutch London St", 399 | [tostring(GetHashKey("EASTBOR"))] = "Eastbourne Way", 400 | [tostring(GetHashKey("ECLIPBLV"))] = "Eclipse Blvd", 401 | [tostring(GetHashKey("EDWOOD"))] = "Edwood Way", 402 | [tostring(GetHashKey("EGAL"))] = "East Galileo Ave", 403 | [tostring(GetHashKey("ELBURROB"))] = "El Burro Blvd", 404 | [tostring(GetHashKey("ELGIN"))] = "Elgin Ave", 405 | [tostring(GetHashKey("ELRANC"))] = "El Rancho Blvd", 406 | [tostring(GetHashKey("ELYFIFWY"))] = "Elysian Fields Fwy", 407 | [tostring(GetHashKey("EMIRROR"))] = "East Mirror Dr", 408 | [tostring(GetHashKey("EQUALITYW"))] = "Equality Way", 409 | [tostring(GetHashKey("EXCEPTI"))] = "Exceptionalists Way", 410 | [tostring(GetHashKey("FANTASPL"))] = "Fantastic Pl", 411 | [tostring(GetHashKey("FENWELL"))] = "Fenwell Pl", 412 | [tostring(GetHashKey("FLO_ST"))] = "Power St", 413 | [tostring(GetHashKey("FORTZAN"))] = "Fort Zancudo Approach Rd", 414 | [tostring(GetHashKey("FORUMD"))] = "Forum Dr", 415 | [tostring(GetHashKey("FUDGEL"))] = "Fudge Ln", 416 | [tostring(GetHashKey("GALIR"))] = "Galileo Rd", 417 | [tostring(GetHashKey("GALLI"))] = "Galileo Park", 418 | [tostring(GetHashKey("GENTRYL"))] = "Gentry Lane", 419 | [tostring(GetHashKey("GINGERS"))] = "Ginger St", 420 | [tostring(GetHashKey("GLORYW"))] = "Glory Way", 421 | [tostring(GetHashKey("GOHIGH"))] = "Great Ocean Hwy", 422 | [tostring(GetHashKey("GOMA"))] = "Goma St", 423 | [tostring(GetHashKey("GRAPSEEDA"))] = "Grapeseed Ave", 424 | [tostring(GetHashKey("GRAPSEEDM"))] = "Grapeseed Main St", 425 | [tostring(GetHashKey("GREENWICHP"))] = "Greenwich Pl", 426 | [tostring(GetHashKey("GREENWP"))] = "Greenwich Pkwy", 427 | [tostring(GetHashKey("GREEWICHW"))] = "Greenwich Way", 428 | [tostring(GetHashKey("GROVE"))] = "Grove St", 429 | [tostring(GetHashKey("HANGER"))] = "Hanger Way", 430 | [tostring(GetHashKey("HANGMAN"))] = "Hangman Ave", 431 | [tostring(GetHashKey("HANWELL"))] = "Hillcrest Ave", 432 | [tostring(GetHashKey("HARBORFWY"))] = "Olympic Fwy", 433 | [tostring(GetHashKey("HARDY"))] = "Hardy Way", 434 | [tostring(GetHashKey("HAWIK"))] = "Hawick Ave", 435 | [tostring(GetHashKey("HERITAGE"))] = "Heritage Way", 436 | [tostring(GetHashKey("HILLCA"))] = "Hillcrest Ridge Access Rd", 437 | [tostring(GetHashKey("HOOPR"))] = "Covenant Ave", 438 | [tostring(GetHashKey("IMAGIN"))] = "Imagination Ct", 439 | [tostring(GetHashKey("INESE"))] = "Ineseno Road", 440 | [tostring(GetHashKey("INNNOC"))] = "Innocence Blvd", 441 | [tostring(GetHashKey("INTEG"))] = "Integrity Way", 442 | [tostring(GetHashKey("INVEN"))] = "Invention Ct", 443 | [tostring(GetHashKey("JOAD"))] = "Joad Ln", 444 | [tostring(GetHashKey("JOSHE"))] = "East Joshua Road", 445 | [tostring(GetHashKey("JOSHR"))] = "Joshua Rd", 446 | [tostring(GetHashKey("KIMBLE"))] = "Kimble Hill Dr", 447 | [tostring(GetHashKey("KORTZ"))] = "Kortz Dr", 448 | [tostring(GetHashKey("LABORP"))] = "Labor Pl", 449 | [tostring(GetHashKey("LAGUNP"))] = "Laguna Pl", 450 | [tostring(GetHashKey("LAKEVINDR"))] = "Lake Vinewood Dr", 451 | [tostring(GetHashKey("LAKEVINES"))] = "Lake Vinewood Est", 452 | [tostring(GetHashKey("LASLAGB"))] = "Las Lagunas Blvd", 453 | [tostring(GetHashKey("LBHORN"))] = "Little Bighorn Ave", 454 | [tostring(GetHashKey("LESBOSL"))] = "Lesbos Ln", 455 | [tostring(GetHashKey("LIBERTYST"))] = "Liberty St", 456 | [tostring(GetHashKey("LINDSAYC"))] = "Lindsay Circus", 457 | [tostring(GetHashKey("LOLITA"))] = "Lolita Ave", 458 | [tostring(GetHashKey("LOSPFY"))] = "La Puerta Fwy", 459 | [tostring(GetHashKey("LOSSF"))] = "Los Santos Freeway", 460 | [tostring(GetHashKey("LOWPOW"))] = "Low Power St", 461 | [tostring(GetHashKey("MACDST"))] = "Macdonald St", 462 | [tostring(GetHashKey("MAGELAN"))] = "Magellan Ave", 463 | [tostring(GetHashKey("MARATHON"))] = "Marathon Ave", 464 | [tostring(GetHashKey("MARINAD"))] = "Marina Dr", 465 | [tostring(GetHashKey("MARL"))] = "Marlowe Dr", 466 | [tostring(GetHashKey("MELAN"))] = "Melanoma St", 467 | [tostring(GetHashKey("MERINGUE"))] = "Meringue Ln", 468 | [tostring(GetHashKey("METEOR"))] = "Meteor St", 469 | [tostring(GetHashKey("MILTON"))] = "Milton Rd", 470 | [tostring(GetHashKey("MIRIAMT"))] = "Miriam Turner Overpass", 471 | [tostring(GetHashKey("MIRRORP"))] = "Mirror Pl", 472 | [tostring(GetHashKey("MIRRPB"))] = "Mirror Park Blvd", 473 | [tostring(GetHashKey("MORNWOOD"))] = "Morningwood Blvd", 474 | [tostring(GetHashKey("MOUNTAV"))] = "Mountain View Dr", 475 | [tostring(GetHashKey("MTHAAN"))] = "Mt Haan Rd", 476 | [tostring(GetHashKey("MTHAANDR"))] = "Mt Haan Dr", 477 | [tostring(GetHashKey("MTVINEWOD"))] = "Mt Vinewood Dr", 478 | [tostring(GetHashKey("MUTIN"))] = "Mutiny Rd", 479 | [tostring(GetHashKey("MVSTARS"))] = "Movie Star Way", 480 | [tostring(GetHashKey("NARCH"))] = "North Archer Ave", 481 | [tostring(GetHashKey("NCONKER"))] = "North Conker Ave", 482 | [tostring(GetHashKey("NEWEMPIRE"))] = "New Empire Way", 483 | [tostring(GetHashKey("NIKOLAA"))] = "Nikola Ave", 484 | [tostring(GetHashKey("NIKOLAP"))] = "Nikola Pl", 485 | [tostring(GetHashKey("NILAND"))] = "Niland Ave", 486 | [tostring(GetHashKey("NMADJOE"))] = "Mad Wayne Thunder Dr", 487 | [tostring(GetHashKey("NORMAND"))] = "Normandy Dr", 488 | [tostring(GetHashKey("NOWHE"))] = "Nowhere Rd", 489 | [tostring(GetHashKey("NPOP"))] = "Popular St", 490 | [tostring(GetHashKey("NROCK"))] = "North Rockford Dr", 491 | [tostring(GetHashKey("NSHELDON"))] = "North Sheldon Ave", 492 | [tostring(GetHashKey("N_BOULDP"))] = "Boulevard Del Perro", 493 | [tostring(GetHashKey("OCCUPA"))] = "Occupation Ave", 494 | [tostring(GetHashKey("ONEIL"))] = "O'Neil Way", 495 | [tostring(GetHashKey("ORCHARDV"))] = "Orchardville Ave", 496 | [tostring(GetHashKey("PALETOB"))] = "Paleto Blvd", 497 | [tostring(GetHashKey("PALOMFREE"))] = "Palomino Fwy", 498 | [tostring(GetHashKey("PALOMINO"))] = "Palomino Ave", 499 | [tostring(GetHashKey("PANORAMA"))] = "Panorama Dr", 500 | [tostring(GetHashKey("PEACEF"))] = "Peaceful St", 501 | [tostring(GetHashKey("PERTHA"))] = "Perth St", 502 | [tostring(GetHashKey("PLAICE"))] = "Plaice Pl", 503 | [tostring(GetHashKey("PLAYAVI"))] = "Playa Vista", 504 | [tostring(GetHashKey("PORTOLA"))] = "Portola Dr", 505 | [tostring(GetHashKey("PPWAY"))] = "Picture Perfect Drive", 506 | [tostring(GetHashKey("PROCO"))] = "Procopio Dr", 507 | [tostring(GetHashKey("PROCOP"))] = "Procopio Promenade", 508 | [tostring(GetHashKey("PRODUST"))] = "Supply St", 509 | [tostring(GetHashKey("PROSPERI"))] = "Prosperity St", 510 | [tostring(GetHashKey("PYRITE"))] = "Pyrite Ave", 511 | [tostring(GetHashKey("REDDES"))] = "Red Desert Ave", 512 | [tostring(GetHashKey("RICHMST"))] = "Richman St", 513 | [tostring(GetHashKey("ROCKD"))] = "Rockford Dr", 514 | [tostring(GetHashKey("ROYLO"))] = "Roy Lowenstein Blvd", 515 | [tostring(GetHashKey("RT68"))] = "Route 68", 516 | [tostring(GetHashKey("RT68APP"))] = "Route 68 Approach", 517 | [tostring(GetHashKey("RUBST"))] = "Rub St", 518 | [tostring(GetHashKey("RUNWAY1"))] = "Runway1", 519 | [tostring(GetHashKey("SAMAUS"))] = "Sam Austin Dr", 520 | [tostring(GetHashKey("SANDYC"))] = "Sandcastle Way", 521 | [tostring(GetHashKey("SEAV"))] = "Seaview Rd", 522 | [tostring(GetHashKey("SENORA"))] = "Senora Fwy", 523 | [tostring(GetHashKey("SENORARD"))] = "Senora Rd", 524 | [tostring(GetHashKey("SENORWAY"))] = "Senora Way", 525 | [tostring(GetHashKey("SHANK"))] = "Shank St", 526 | [tostring(GetHashKey("SIGNALST"))] = "Signal St", 527 | [tostring(GetHashKey("SINPA"))] = "Sinners Passage", 528 | [tostring(GetHashKey("SINST"))] = "Sinner St", 529 | [tostring(GetHashKey("SMADJOE"))] = "Mad Wayne Thunder Dr", 530 | [tostring(GetHashKey("SMOKET"))] = "Smoke Tree Rd", 531 | [tostring(GetHashKey("SMOMIL"))] = "South Mo Milton Dr", 532 | [tostring(GetHashKey("SNORMAV"))] = "Calais Ave", 533 | [tostring(GetHashKey("SPANAV"))] = "Spanish Ave", 534 | [tostring(GetHashKey("SROCK"))] = "South Rockford Dr", 535 | [tostring(GetHashKey("SSHAM"))] = "South Shambles St", 536 | [tostring(GetHashKey("STEELE"))] = "Steele Way", 537 | [tostring(GetHashKey("STRANGEW"))] = "Strangeways Dr", 538 | [tostring(GetHashKey("SUNSTAN"))] = "Sustancia Rd", 539 | [tostring(GetHashKey("SVITUS"))] = "San Vitus Blvd", 540 | [tostring(GetHashKey("SWISSS"))] = "Swiss St", 541 | [tostring(GetHashKey("S_ARSE"))] = "South Arsenal St", 542 | [tostring(GetHashKey("S_BOULDP"))] = "South Boulevard Del Perro", 543 | [tostring(GetHashKey("S_BROAD"))] = "Strawberry Ave", 544 | [tostring(GetHashKey("TACKLE"))] = "Tackle St", 545 | [tostring(GetHashKey("TANGER"))] = "Tangerine St", 546 | [tostring(GetHashKey("TONGVA"))] = "Tongva Dr", 547 | [tostring(GetHashKey("TOWER"))] = "Tower Way", 548 | [tostring(GetHashKey("TUGST"))] = "Tug St", 549 | [tostring(GetHashKey("UNIONR"))] = "Union Rd", 550 | [tostring(GetHashKey("UTOPIAG"))] = "Utopia Gardens", 551 | [tostring(GetHashKey("VESPBD"))] = "Vespucci Blvd", 552 | [tostring(GetHashKey("VINEPARKD"))] = "Vinewood Park Dr", 553 | [tostring(GetHashKey("VINEWB"))] = "Vinewood Blvd", 554 | [tostring(GetHashKey("VITUS"))] = "Vitus St", 555 | [tostring(GetHashKey("VOOD"))] = "Voodoo Place", 556 | [tostring(GetHashKey("WARMWFWY"))] = "Del Perro Fwy", 557 | [tostring(GetHashKey("WECLIP"))] = "West Eclipse Blvd", 558 | [tostring(GetHashKey("WGAL"))] = "West Galileo Ave", 559 | [tostring(GetHashKey("WHISP"))] = "Whispymound Dr", 560 | [tostring(GetHashKey("WILDO"))] = "Wild Oats Dr", 561 | [tostring(GetHashKey("WINSTON"))] = "Atlee St", 562 | [tostring(GetHashKey("WMIRROR"))] = "West Mirror Drive", 563 | [tostring(GetHashKey("YORKS"))] = "York St", 564 | [tostring(GetHashKey("ZANCUDOA"))] = "Zancudo Ave", 565 | [tostring(GetHashKey("ZANCUDOB"))] = "Zancudo Barranca", 566 | [tostring(GetHashKey("ZANCUDOG"))] = "Zancudo Grande Valley", 567 | [tostring(GetHashKey("ZANCUDOR"))] = "Zancudo Rd" 568 | } 569 | 570 | function reverseZoneHash(hash) 571 | if type(hash) ~= "string" then 572 | hash = tostring(hash) 573 | end 574 | 575 | local name = ZONE_HASHES[hash] 576 | if name ~= nil then 577 | return name 578 | end 579 | 580 | Citizen.Trace("Error reversing zone hash \"" .. hash .. "\". Maybe it's not been added yet?") 581 | return "Unknown Zone" 582 | end 583 | 584 | function reverseStreetHash(hash) 585 | if type(hash) ~= "string" then 586 | hash = tostring(hash) 587 | end 588 | 589 | local name = STREET_HASHES[hash] 590 | if name ~= nil then 591 | return name 592 | end 593 | 594 | local backup = STREET_BACKUP[hash] 595 | if backup ~= nil then 596 | return backup 597 | end 598 | 599 | Citizen.Trace("Error reversing street hash \"" .. hash .. "\". Maybe it's not been added yet?") 600 | return "Unknown Street" 601 | end 602 | 603 | function reverseAreaHash(hash) 604 | if type(hash) ~= "string" then 605 | hash = tostring(hash) 606 | end 607 | 608 | local name = AREA_HASHES[hash] 609 | if name ~= nil then 610 | return name 611 | end 612 | 613 | Citizen.Trace("Error reversing area hash \"" .. hash .. "\". Maybe it's not been added yet?") 614 | return "Unknown Area" 615 | end 616 | -------------------------------------------------------------------------------- /example_client/reverse_weapon_hashes.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LiveMap - A LiveMap for FiveM servers 3 | Copyright (C) 2017 Jordan Dalton 4 | 5 | You should have received a copy of the GNU General Public License 6 | along with this program in the file "LICENSE". If not, see . 7 | ]] 8 | local WEAPON_HASHES = { 9 | ["2578778090"] = "Knife", 10 | ["1737195953"] = "Nightstick", 11 | ["1317494643"] = "Hammer", 12 | ["2508868239"] = "Bat", 13 | ["1141786504"] = "Golf Club", 14 | ["2227010557"] = "Crowbar", 15 | ["4192643659"] = "Bottle", 16 | ["3756226112"] = "Switch Blade", 17 | ["453432689"] = "Pistol", 18 | ["1593441988"] = "Combat Pistol", 19 | ["584646201"] = "AP Pistol", 20 | ["2578377531"] = "Pistol 50", 21 | ["1198879012"] = "Flare Gun", 22 | ["3696079510"] = "Marksman Pistol", 23 | ["3249783761"] = "Revolver", 24 | ["324215364"] = "Micro SMG", 25 | ["736523883"] = "SMG", 26 | ["4024951519"] = "Assault SMG", 27 | ["171789620"] = "Combat PDW", 28 | ["3220176749"] = "Assault Rifle", 29 | ["2210333304"] = "Carbine Rifle", 30 | ["2937143193"] = "Advanced Rifle", 31 | ["1649403952"] = "Compact Rifle", 32 | ["2634544996"] = "MG", 33 | ["2144741730"] = "Combat MG", 34 | ["487013001"] = "Pump Shotgun", 35 | ["2017895192"] = "Sawn Off Shotgun", 36 | ["3800352039"] = "Assault Shotgun", 37 | ["2640438543"] = "Bullpup Shotgun", 38 | ["4019527611"] = "Double Barrel Shotgun", 39 | ["911657153"] = "Stun Gun", 40 | ["100416529"] = "Sniper Rifle", 41 | ["205991906"] = "Heavy Sniper", 42 | ["2726580491"] = "Grenade Launcher", 43 | ["1305664598"] = "Grenade Launcher Smoke", 44 | ["2982836145"] = "RPG", 45 | ["1119849093"] = "Minigun", 46 | ["2481070269"] = "Grenade", 47 | ["741814745"] = "Sticky Bomb", 48 | ["4256991824"] = "Smoke Grenade", 49 | ["2694266206"] = "BZ Gas", 50 | ["615608432"] = "Molotov", 51 | ["101631238"] = "Fire Extinguisher", 52 | ["883325847"] = "Petrol Can", 53 | ["3218215474"] = "SNS Pistol", 54 | ["3231910285"] = "Special Carbine", 55 | ["3523564046"] = "Heavy Pistol", 56 | ["2132975508"] = "Bullpup Rifle", 57 | ["1672152130"] = "Homing Launcher", 58 | ["2874559379"] = "Proximity Mine", 59 | ["126349499"] = "Snowball", 60 | ["137902532"] = "Vintage Pistol", 61 | ["2460120199"] = "Dagger", 62 | ["2138347493"] = "Firework", 63 | ["2828843422"] = "Musket", 64 | ["3342088282"] = "Marksman Rifle", 65 | ["984333226"] = "Heavy Shotgun", 66 | ["1627465347"] = "Gusenberg", 67 | ["4191993645"] = "Hatchet", 68 | ["1834241177"] = "Railgun", 69 | ["2725352035"] = "Unarmed", 70 | ["3638508604"] = "Knuckle Duster", 71 | ["3713923289"] = "Machete", 72 | ["3675956304"] = "Machine Pistol", 73 | ["2343591895"] = "Flashlight", 74 | ["600439132"] = "Ball", 75 | ["1233104067"] = "Flare", 76 | ["2803906140"] = "Night Vision", 77 | ["4222310262"] = "Parachute", 78 | ["317205821"] = "Sweeper Shotgun", 79 | ["3441901897"] = "Battle Axe", 80 | ["125959754"] = "Compact Grenade Launcher", 81 | ["3173288789"] = "Mini SMG", 82 | ["3125143736"] = "Pipe Bomb", 83 | ["2484171525"] = "Pool Cue", 84 | ["419712736"] = "Wrench" 85 | } 86 | 87 | function reverseWeaponHash(hash) 88 | if type(hash) ~= "string" then 89 | hash = tostring(hash) 90 | end 91 | 92 | local name = WEAPON_HASHES[hash] 93 | if name ~= nil then 94 | return name 95 | end 96 | 97 | Citizen.Trace("Error reversing weapon hash \"" .. hash .. "\". Maybe it's not been added yet?") 98 | return "Unarmed" 99 | end 100 | -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version "bodacious" 2 | game "gta5" 3 | 4 | author "TGR_Havoc" 5 | description "" 6 | version "3.2.1" 7 | 8 | client_script "example_client/*.lua" 9 | exports { 10 | "reverseWeaponHash", "reverseVehicleHash", "reverseStreetHash", 11 | "reverseZoneHash", "reverseAreaHash" 12 | } 13 | 14 | -- Don't remove. Blips_client is needed for the `blips generate` command to work. 15 | client_script "example_client/blips_client.lua" 16 | 17 | server_scripts { 18 | "server/update_check.lua", 19 | "server/setup_nucleus.lua", 20 | "dist/livemap.js" 21 | } 22 | -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: livemap_resource 2 | 3 | nav: 4 | - 'README.md' 5 | - Configuration: "config.md" 6 | - Events: "events.md" 7 | - Changelog: 'CHANGELOG.md' 8 | - License: "license.md" 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "fivem-live_map", 3 | "version": "3.2.1", 4 | "description": "The FiveM resource to get Havoc's LiveMap working#", 5 | "main": "index.js", 6 | "scripts": { 7 | "lint": "eslint ./src/**/*", 8 | "release": "standard-version && git push --follow-tags origin master && conventional-github-releaser", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/TGRHavoc/live_map.git" 14 | }, 15 | "author": "Havoc", 16 | "license": "GPL-3.0", 17 | "bugs": { 18 | "url": "https://github.com/TGRHavoc/live_map/issues" 19 | }, 20 | "homepage": "https://github.com/TGRHavoc/live_map#readme", 21 | "dependencies": { 22 | "koa": "^2.7.0", 23 | "koa-body": "^4.1.0", 24 | "koa-router": "^10.0.0", 25 | "simple-console-logger": "^2.0.2", 26 | "socket.io": "^3.0.4", 27 | "webpack": "^5.37.0", 28 | "ws": "^7.4.6" 29 | }, 30 | "devDependencies": { 31 | "all-contributors-cli": "^6.20.0", 32 | "conventional-changelog-conventionalcommits": "^4.6.2", 33 | "conventional-github-releaser": "^3.1.5", 34 | "eslint": "^7.16.0", 35 | "standard-version": "^9.3.0", 36 | "webpack-cli": "^4.7.0", 37 | "webpack-node-externals": "^3.0.0" 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /server/blips_server.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is deprecated. 3 | This is the original implementation of the "blip server", only kept for my amusement and educational purposes. 4 | ]] --[[ 5 | When the client has generated the blips, this is called to save them. 6 | @param blipTable A array that contains all the blips to save 7 | ]] RegisterServerEvent("livemap:blipsGenerated") 8 | 9 | --[[ 10 | Adds a blip to the blips that the UI can see (will be saved) 11 | @param blip A table that represents a blip. 12 | Only the host of the session can use this event. 13 | 14 | A blip follows the format: 15 | { 16 | sprite = Number (required) 17 | 18 | pos = Table (required){ 19 | x = Float (required) 20 | y = Float (required) 21 | z = Float (required) 22 | } 23 | 24 | name = String (optional) 25 | description = String (optional) 26 | } 27 | 28 | sprite is the "spriteId" used when creating a blip. 29 | x,y,z represents the position of the blip (rounded to 2dp) and is stored inside "pos" 30 | name is the name of the blip shown on the UI 31 | desscription is a description of what the blip does, shown on UI 32 | ]] 33 | RegisterServerEvent("livemap:AddBlip") 34 | 35 | --[[ 36 | Updates the information that is associated with a blip. 37 | Only the host of the session can use this event. 38 | 39 | @param blip A table that represents a blip (see the above format) 40 | 41 | Note: You cannot change the "sprite", "x", "y", "z" properties of the blip 42 | ]] 43 | RegisterServerEvent("livemap:UpdateBlip") 44 | 45 | RegisterServerEvent("livemap:RemoveClosestBlip") 46 | RegisterServerEvent("livemap:RemoveBlip") 47 | 48 | -- An array of blips that we have. This is encoded into JSON and sent over HTTP (when requested) 49 | local blips = {} 50 | 51 | -- Set this to the player who did the "blips generate" command. Should stop 52 | -- randomers triggering the event :) 53 | local playerWhoGeneratedBlips = nil 54 | 55 | --[[ 56 | =================================== 57 | = Functions = 58 | =================================== 59 | ]] 60 | 61 | --[[ 62 | Checks to see if the "blips" array is empty. 63 | 64 | @returns boolean True if the array is empty, False otherwise 65 | ]] 66 | function blipsIsEmpty() 67 | for _, _ in pairs(blips) do return false end 68 | return true 69 | end 70 | 71 | --[[ 72 | Checks if the "blips" array contains a certain blip. 73 | 74 | @param id The sprite ID of the blip 75 | @param x The x coordinate of the blip (rounded to 2dp) 76 | @param y The y coordinate of the blip (rounded to 2dp) 77 | @param z The z coordinate of the blip (rounded to 2dp) 78 | 79 | @return int The index that the blip is found at, -1 if not found. 80 | ]] 81 | function blipsContainsBlip(id, x, y, z) 82 | if blips[id] == nil then return -1 end 83 | 84 | for k, v in ipairs(blips[id]) do 85 | if v.pos.x == x and v.pos.y == y and v.pos.z == z then return k end 86 | end 87 | 88 | return -1 89 | end 90 | 91 | --[[ 92 | Sends the encoded "blips" array to the client requesting it 93 | If no blips, an error is sent instead 94 | 95 | @param res The result object that can be sent data 96 | ]] 97 | function sendBlips(res) 98 | if not blipsIsEmpty() then 99 | res.send(json.encode(blips)) 100 | else 101 | res.send(json.encode({error = "blip cache is empty"})) 102 | end 103 | end 104 | 105 | --[[ 106 | Saves the "blips" array to a file on the server. 107 | The filename is set in the server.cfg file with the convar `blip_file` 108 | ]] 109 | function saveBlips() 110 | if blipsIsEmpty() then 111 | print("Blips are empty... No need to save") 112 | return 113 | end 114 | 115 | local blipFile = GetConvar("blip_file", "server/blips.json") 116 | local saved = SaveResourceFile(GetCurrentResourceName(), blipFile, 117 | json.encode(blips, {indent = true}), -1) 118 | 119 | if not saved then 120 | print( 121 | "LiveMap couldn't save the blips to file.. Maybe the directory isn't writable?") 122 | end 123 | 124 | end 125 | 126 | --[[ 127 | =================================== 128 | = Events = 129 | =================================== 130 | ]] 131 | 132 | AddEventHandler("livemap:AddBlip", function(blip) 133 | 134 | if not blip["sprite"] or blip["sprite"] == nil then 135 | -- We don't have a sprite id... we can't save it :( 136 | print( 137 | "LiveMap Error: AddBlip cannot run because no sprite wasn't supplied.") 138 | return 139 | end 140 | 141 | if not blip["pos"] or blip["pos"] == nil then 142 | print( 143 | "LiveMap Error:: AddBlip cannot run because the pos wasn't supplied.") 144 | return 145 | end 146 | 147 | local id = tostring(blip["sprite"]) 148 | 149 | blip["sprite"] = nil 150 | 151 | -- Conveert coordinates to 2dp 152 | blip["pos"].x = tonumber(string.format("%.2f", blip["pos"].x)) 153 | blip["pos"].y = tonumber(string.format("%.2f", blip["pos"].y)) 154 | blip["pos"].z = tonumber(string.format("%.2f", blip["pos"].z)) 155 | 156 | if blipsContainsBlip(id, blip.pos.x, blip.pos.y, blip.pos.z) == -1 then 157 | if blips[id] == nil then blips[id] = {} end 158 | 159 | table.insert(blips[id], blip) 160 | TriggerEvent("livemap:internal_AddBlip", id, blip) 161 | print("Sending addBlip for " .. id) 162 | 163 | else 164 | print("Blip already exists at " .. blip.pos.x .. "," .. blip.pos.y .. 165 | "," .. blip.pos.z) 166 | end 167 | end) 168 | 169 | AddEventHandler("livemap:UpdateBlip", function(blip) 170 | 171 | if not blip["sprite"] or blip["sprite"] == nil then 172 | -- We don't have a sprite id... we can't save it :( 173 | print( 174 | "LiveMap Error: UpdateBlip cannot run because no sprite wasn't supplied.") 175 | return 176 | end 177 | 178 | if not blip["pos"] or blip["pos"] == nil then 179 | print( 180 | "LiveMap Error:: UpdateBlip cannot run because the pos wasn't supplied.") 181 | return 182 | end 183 | 184 | local id = tostring(blip["sprite"]) 185 | 186 | blip["sprite"] = nil 187 | 188 | blip["pos"].x = tonumber(string.format("%.2f", blip["pos"].x)) 189 | blip["pos"].y = tonumber(string.format("%.2f", blip["pos"].y)) 190 | blip["pos"].y = tonumber(string.format("%.2f", blip["pos"].y)) 191 | 192 | local index = blipsContainsBlip(id, blip.pos.x, blip.pos.y, blip.pos.z) 193 | 194 | if index ~= -1 then 195 | blips[id][index] = blip 196 | 197 | TriggerEvent("livemap:internal_UpdateBlip", id, blip) 198 | 199 | else 200 | -- Blip doesn't exist, add it? 201 | if blips[id] == nil then blips[id] = {} end 202 | 203 | table.insert(blips[id], blip) 204 | 205 | TriggerEvent("livemap:internal_AddBlip", id, blip) 206 | 207 | end 208 | end) 209 | 210 | AddEventHandler("livemap:RemoveBlip", function(blip) 211 | 212 | if not blip["sprite"] or blip["sprite"] == nil then 213 | -- We don't have a sprite id... we can't save it :( 214 | print( 215 | "LiveMap Error: RemoveBlip cannot run because no sprite wasn't supplied.") 216 | return 217 | end 218 | 219 | if not blip["pos"] or blip["pos"] == nil then 220 | print( 221 | "LiveMap Error:: RemoveBlip cannot run because the pos wasn't supplied.") 222 | return 223 | end 224 | 225 | local id = tostring(blip["sprite"]) 226 | 227 | blip["sprite"] = nil 228 | 229 | blip["pos"].x = tonumber(string.format("%.2f", blip["pos"].x)) 230 | blip["pos"].y = tonumber(string.format("%.2f", blip["pos"].y)) 231 | blip["pos"].y = tonumber(string.format("%.2f", blip["pos"].y)) 232 | 233 | local index = blipsContainsBlip(id, blip.pos.x, blip.pos.y, blip.pos.z) 234 | 235 | if index == -1 then 236 | print("LiveMap Error: Cannot remove blip as it isn't in the table") 237 | else 238 | blips[id][index] = nil 239 | TriggerEvent("livemap:RemoveBlip", id, blip) 240 | end 241 | end) 242 | 243 | function getDistanceBetween(p1, p2) 244 | -- Apparently math.pow doesn't exist (nil value) 245 | local x = (p2.x - p1.x) * (p2.x - p1.x) 246 | local y = (p2.y - p1.y) * (p2.y - p1.y) 247 | local z = (p2.z - p1.z) * (p2.z - p1.z) 248 | 249 | -- sqrt works though! 250 | return math.sqrt(x + y + z) 251 | end 252 | 253 | AddEventHandler("livemap:RemoveClosestBlip", function(playerPos) 254 | local currentClosest = nil 255 | local sprite = nil 256 | local currentDistance = 999999 257 | 258 | for spriteId, blipArray in pairs(blips) do 259 | for _, blip in pairs(blipArray) do 260 | local distance = getDistanceBetween(playerPos, blip.pos) 261 | 262 | if (distance < currentDistance) then 263 | currentDistance = distance 264 | currentClosest = blip 265 | sprite = spriteId 266 | end 267 | 268 | end 269 | end 270 | 271 | if currentClosest == nil then 272 | -- No blips at all? 273 | return 274 | end 275 | 276 | print("Removing closest blip (" .. sprite .. ") located at: " .. 277 | currentClosest.pos.x .. ", " .. currentClosest.pos.y .. ", " .. 278 | currentClosest.pos.z) 279 | 280 | local index = blipsContainsBlip(sprite, currentClosest.pos.x, 281 | currentClosest.pos.y, currentClosest.pos.z) 282 | 283 | if index == -1 then 284 | print( 285 | "LiveMap Error: Umm... The closest blip doesn't have an index.. Something seriously wrong here!!!") 286 | else 287 | blips[sprite][index] = nil 288 | TriggerEvent("livemap:internal_RemoveBlip", sprite, currentClosest) 289 | end 290 | 291 | end) 292 | 293 | AddEventHandler("livemap:blipsGenerated", function(blipTable) 294 | local id = GetPlayerIdentifier(source, 0) 295 | 296 | if playerWhoGeneratedBlips == nil or playerWhoGeneratedBlips ~= id then 297 | print("playerWhoGeneratedBlips was incorrect.. Maybe \"" .. id .. 298 | "\" triggered the event themselves?\nEither way, I'm not doing it..") 299 | return 300 | end 301 | 302 | blips = blipTable 303 | 304 | saveBlips() 305 | end) 306 | 307 | AddEventHandler("onResourceStop", function(name) 308 | if name == GetCurrentResourceName() then 309 | saveBlips() -- Make sure the blips file is saved 310 | end 311 | end) 312 | 313 | AddEventHandler("onResourceStart", function(name) 314 | if name == GetCurrentResourceName() then 315 | local blipFile = GetConvar("blip_file", "server/blips.json") 316 | local blipData = LoadResourceFile(GetCurrentResourceName(), blipFile) 317 | 318 | if blipData then 319 | blips = json.decode(blipData) 320 | 321 | -- Update all the old positions to use the new one :) 322 | for spriteId, blipArray in pairs(blips) do 323 | for _, blip in pairs(blipArray) do 324 | if not blip["pos"] then 325 | blip.pos = {x = blip.x, y = blip.y, z = blip.z} 326 | blip.x, blip.y, blip.z = nil, nil, nil 327 | end 328 | end 329 | end 330 | 331 | print("loaded blip cache from file") 332 | end 333 | end 334 | end) 335 | 336 | AddEventHandler('playerDropped', function() 337 | local id = GetPlayerIdentifier(source, 0) 338 | TriggerEvent("livemap:internal_RemovePlayer", id) 339 | end) 340 | 341 | --[[ 342 | =================================== 343 | = Misc = 344 | =================================== 345 | ]] 346 | 347 | --[[ 348 | Register a command and can be used in-game by an admin to generate the inital 349 | set of blips. 350 | 351 | ]] 352 | RegisterCommand("blips", function(source, args, rawCommand) 353 | local playerId = GetPlayerIdentifier(source, 0) 354 | if args[1] == "generate" then 355 | print( 356 | "Generating blips using the in-game native: Player " .. playerId .. 357 | " is generating (I hope you know them)") 358 | playerWhoGeneratedBlips = playerId 359 | 360 | TriggerClientEvent("livemap:getBlipsFromClient", source) 361 | 362 | return 363 | end 364 | 365 | end, true) 366 | 367 | --[[ 368 | Handle HTTP requests. Mainly used for getting the blips via ajax from the UI 369 | ]] 370 | SetHttpHandler(function(req, res) 371 | local path = req.path 372 | 373 | -- Restrict the origin if set, otherwise allow everyone 374 | res.writeHead(200, { 375 | ["Access-Control-Allow-Origin"] = GetConvar("livemap_access_control", 376 | "*") 377 | }) 378 | 379 | if path == "/blips" or path == "/blips.json" then return sendBlips(res) end 380 | 381 | return res.send(json.encode({error = "path \"" .. path .. "\" not found"})) 382 | end) 383 | -------------------------------------------------------------------------------- /server/setup_nucleus.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LiveMap - A LiveMap for FiveM servers 3 | Copyright (C) 2017 Jordan Dalton 4 | 5 | You should have received a copy of the GNU General Public License 6 | along with this program in the file "LICENSE". If not, see . 7 | ]] 8 | 9 | local shouldUseNucleus = GetConvar("livemap_use_nucleus", "true") 10 | local url = "https://cfx.re/api/register/?v=2" 11 | 12 | local function uuid() 13 | local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' 14 | return string.gsub(template, '[xy]', function (c) 15 | local v = (c == 'x') and math.random(0, 0xf) or math.random(8, 0xb) 16 | return string.format('%x', v) 17 | end) 18 | end 19 | 20 | if shouldUseNucleus == "false" then 21 | print("LiveMap will not use nucleus") 22 | return 23 | end 24 | 25 | local rawData = LoadResourceFile(GetCurrentResourceName(), "livemap_uuid") 26 | 27 | if not rawData then 28 | print("Couldn't load UUID from file... Generating a new one") 29 | rawData = uuid() 30 | SaveResourceFile(GetCurrentResourceName(), "livemap_uuid", rawData, -1) 31 | end 32 | 33 | local socketPort = GetConvar("socket_port", 30121) 34 | 35 | print("Woop, our uuid " .. rawData) 36 | print("Trying to set up a nucleus URL for " .. socketPort) 37 | 38 | local dataToPost = { 39 | ["token"] = "anonymous", 40 | ["tokenEx"] = string.format("%s_LiveMapResourcePloxNoBan", rawData), 41 | ["port"] = string.format("%d", socketPort) 42 | } 43 | 44 | print(json.encode(dataToPost)) 45 | 46 | PerformHttpRequest(url, function(returnCode, data, header) 47 | 48 | if returnCode ~= 200 then 49 | print("Woops. Looks like we cannot use the nucleus API to generate a secure proxy :(") 50 | print(returnCode) 51 | print(data) 52 | return 53 | end 54 | 55 | local parsedData = json.decode(data) 56 | -- Okay. So, we should get back a "host" and "rpToken". 57 | -- No idea what the rpToken is for (I'm too dumb to understand the source code of FiveM that has it implemented) but, it seems the proxy works without the reverse connection it sets up in the server. 58 | -- Sooooooo. We can just display the host stuff. 59 | 60 | -- Create a nice reverseProxy object that we can show to the user so they can copy-paste it into their config for the interface 61 | local reverseProxy = { 62 | ["blips"] = string.format("https://%s/blips", parsedData["host"]), 63 | ["socket"] = string.format("wss://%s", parsedData["host"]) 64 | } 65 | 66 | print("-------------------------------------------------------------------") 67 | print("-------------------------------------------------------------------") 68 | print("-------------------------------------------------------------------") 69 | 70 | print("Hey! LiveMap was able to use the Nucleus project to automatically set up a secure proxy to the resource.") 71 | print("If you want to use this in your config use the revserProxy settings printed below (https://docs.tgrhavoc.co.uk/livemap-interface/reverse_proxy/)") 72 | print("If you don't want to use Nucleus then put \"set livemap_use_nucleus false\" in your server.cfg file.") 73 | print(string.format("\"reverseProxy\": %s", json.encode(reverseProxy))) 74 | 75 | print("-------------------------------------------------------------------") 76 | print("-------------------------------------------------------------------") 77 | print("-------------------------------------------------------------------") 78 | 79 | end, "POST", json.encode(dataToPost), {["Content-Type"] = "application/json"}) 80 | -------------------------------------------------------------------------------- /server/update_check.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | LiveMap - A LiveMap for FiveM servers 3 | Copyright (C) 2017 Jordan Dalton 4 | 5 | You should have received a copy of the GNU General Public License 6 | along with this program in the file "LICENSE". If not, see . 7 | ]] 8 | 9 | local url = "https://raw.githubusercontent.com/TGRHavoc/live_map/master/version.json" 10 | local version = "2.1.7" 11 | local latest = true 12 | 13 | local rawData = LoadResourceFile(GetCurrentResourceName(), "version.json") 14 | 15 | if not rawData then 16 | print("Couldn't read \"versions.json\" file.. Please make sure it's readable and exists.") 17 | else 18 | rawData = json.decode(rawData) 19 | version = rawData["resource"] 20 | end 21 | 22 | function checkForUpdate() 23 | PerformHttpRequest(url, function(err, data, headers) 24 | local parsed = json.decode(data) 25 | 26 | if (parsed["resource"] ~= version) then 27 | print("|===================================================|") 28 | print("| Live Map Update Available |") 29 | print("| Current : " .. version .. " |") 30 | print("| Latest : " .. parsed["resource"] .. " |") 31 | print("| Download at: https://github.com/TGRHavoc/live_map |") 32 | print("|===================================================|") 33 | latest = false -- Stop running the timeout 34 | end 35 | 36 | -- Every 30 minutes, do the check (print the message if it's not up to date) 37 | SetTimeout( 30 * (60*1000), checkForUpdate) 38 | 39 | end, "GET", "", { ["Content-Type"] = 'application/json' }) 40 | end 41 | 42 | checkForUpdate(); 43 | -------------------------------------------------------------------------------- /server/wrapper.lua: -------------------------------------------------------------------------------- 1 | --[[ 2 | This file is deprecated. 3 | This is the original implementation of a "wrapper" that allows users to trigger server events, only kept for my amusement and educational purposes. 4 | ]] --[[ 5 | Adds some data to a player. That will get sent to the UI via websockets 6 | 7 | @param k The name of the data to add to the player (e.g. "Name") 8 | @param v The value to set the data to (e.g. "Havoc") 9 | 10 | Note: This MUST be triggered from a client 11 | ]] RegisterServerEvent("livemap:AddPlayerData") 12 | 13 | --[[ 14 | Updated some data asssociated with the player 15 | 16 | @param k The name of the data to add to the player (e.g. "Name") 17 | @param v The new value to set the data to (e.g. "Some Name") 18 | 19 | Note: This MUST be triggered from a client 20 | ]] 21 | RegisterServerEvent("livemap:UpdatePlayerData") 22 | 23 | --[[ 24 | Removed some data associated with a player. 25 | 26 | @param k The name of the data to remove from the player (e.g. "Name") 27 | 28 | Note: This MUST be triggered from a client 29 | ]] 30 | RegisterServerEvent("livemap:RemovePlayerData") 31 | 32 | --[[ 33 | Removes a player from the internal list and notifies any socket clients 34 | that said player has left. 35 | 36 | Note: This MUST be triggered from a client 37 | ]] 38 | RegisterServerEvent("livemap:RemovePlayer") 39 | 40 | --[[ 41 | Associated some static data (data that won't change) with the newly spawned 42 | player. This is data that can only be found on the server. 43 | 44 | This adds the player's identifer and their username 45 | 46 | Note: This MUST be triggered from a client 47 | ]] 48 | RegisterServerEvent("livemap:playerSpawned") 49 | 50 | --[[ 51 | =================================== 52 | = Functions = 53 | =================================== 54 | ]] 55 | 56 | --[[ 57 | Calls internal events (handlers in the DLL) to set some static data 58 | 59 | @param index The server ID of the player (generally source) 60 | @param id The first identifer of the player (e.g. "steam:HEX") 61 | ]] 62 | function setStaticDataFor(index, id) 63 | TriggerEvent("livemap:internal_AddPlayerData", id, "identifer", id) 64 | TriggerEvent("livemap:internal_AddPlayerData", id, "name", 65 | GetPlayerName(index)) 66 | end 67 | 68 | --[[ 69 | =================================== 70 | = Events = 71 | =================================== 72 | ]] 73 | 74 | AddEventHandler("livemap:AddPlayerData", function(k, d) 75 | local id = GetPlayerIdentifier(source, 0) -- Get the first id, it'll do 76 | -- print("Adding data for " .. id) 77 | 78 | TriggerEvent("livemap:internal_AddPlayerData", id, k, d) 79 | end) 80 | 81 | AddEventHandler("livemap:UpdatePlayerData", function(k, d) 82 | local id = GetPlayerIdentifier(source, 0) -- Get the first id, it'll do 83 | -- print("Updating data for " .. id) 84 | 85 | TriggerEvent("livemap:internal_UpdatePlayerData", id, k, d) 86 | end) 87 | 88 | AddEventHandler("livemap:RemovePlayerData", function(k) 89 | local id = GetPlayerIdentifier(source, 0) 90 | 91 | -- print("Removing " .. k .. " from " .. id) 92 | TriggerEvent("livemap:internal_RemovePlayerData", id, k) 93 | end) 94 | 95 | AddEventHandler("livemap:RemovePlayer", function() 96 | local id = GetPlayerIdentifier(source, 0) 97 | -- print("Removing player " .. id) 98 | 99 | TriggerEvent("livemap:internal_RemovePlayer", id) 100 | end) 101 | 102 | --[[ 103 | Set some static data that isn't going to change 104 | e.g. Player's Identifer 105 | ]] 106 | AddEventHandler("livemap:playerSpawned", function() 107 | local id = GetPlayerIdentifier(source, 0) -- Get the first id, it'll do 108 | setStaticDataFor(source, id) 109 | end) 110 | 111 | -- If any players are already on the server 112 | AddEventHandler("onResourceStart", function(name) 113 | -- print("NUMBER OF PLAYERS: " .. GetNumPlayerIndices()) 114 | if name == GetCurrentResourceName() then 115 | if GetNumPlayerIndices() ~= 0 then -- There's players on the server :) 116 | for i = 0, GetNumPlayerIndices() - 1 do 117 | local id = GetPlayerIdentifier(GetPlayerFromIndex(i), 0) 118 | setStaticDataFor(GetPlayerFromIndex(i), id) 119 | end 120 | end 121 | end 122 | end) 123 | -------------------------------------------------------------------------------- /src/blips.js: -------------------------------------------------------------------------------- 1 | const blipLog = require("simple-console-logger").getLogger("LiveMap Blips"); 2 | const fs = require("fs"); 3 | const path = require("path"); 4 | 5 | const BlipController = (SocketController) => { 6 | let playerWhoGeneratedBlips = null; 7 | let blips = null; 8 | const blipFile = GetConvar("blip_file", "server/blips.json"); 9 | 10 | // Middleware to send the blips 11 | const getBlips = (ctx) => { 12 | if (blips === null){ 13 | ctx.body = JSON.stringify({ 14 | error: "blip cache is empty" 15 | }); 16 | }else{ 17 | ctx.body = JSON.stringify(blips); 18 | } 19 | }; 20 | 21 | // function to save blips to blip file 22 | const saveBlips = () => { 23 | const saved = SaveResourceFile(GetCurrentResourceName(), blipFile, JSON.stringify(blips, null, 4), -1); 24 | 25 | if (saved) { 26 | blipLog.info("Saved blip file"); 27 | } else { 28 | blipLog.warn("Error writing to blip file... Maybe permissions aren't correct?"); 29 | } 30 | }; 31 | // function to load blips from blip file 32 | const loadBlips = () => { 33 | const loaded = LoadResourceFile(GetCurrentResourceName(), blipFile); 34 | if (loaded) { 35 | try { 36 | blips = JSON.parse(loaded); 37 | } catch (err) { 38 | blipLog.warn("Error when parsing blips.json file. Please make sure it's valid JSON. %s", err.message); 39 | } 40 | } else { 41 | // Make an empty blip file? 42 | blips = {}; 43 | saveBlips(); 44 | } 45 | }; 46 | 47 | const getDistanceBetween = (p1, p2) => { 48 | let x = Math.pow(p2.x - p1.x, 2); 49 | let y = Math.pow(p2.y - p1.y, 2); 50 | let z = Math.pow(p2.z - p1.z, 2); 51 | 52 | return Math.sqrt(x + y + z); 53 | }; 54 | 55 | const getBlipIndex = (sprite, pos) => { 56 | if (blips[sprite] === undefined){ 57 | return -1; 58 | } 59 | 60 | blips[sprite].forEach((blip, index) => { 61 | if (blip.pos == pos){ 62 | return index; 63 | } 64 | }); 65 | 66 | return -1; 67 | }; 68 | 69 | const validBlip = (blip) => { 70 | if (blip["sprite"] === undefined || blip["sprite"] === null) { 71 | blipLog.debug("Blip didn't have sprite: %o", blip); 72 | blipLog.warn("Blip has no sprite..."); 73 | return false; 74 | } 75 | 76 | if (blip["pos"] === undefined || blip["pos"] === null) { 77 | blipLog.debug("Blip didn't have pos: %o", blip); 78 | blipLog.warn("Blip has no position..."); 79 | return false; 80 | } 81 | 82 | if (typeof(blip.pos) !== "object"){ 83 | blipLog.warn("Blip position must be an object"); 84 | return false; 85 | } 86 | 87 | if (blip.pos["x"] === undefined || blip.pos["y"] === undefined || blip.pos["z"] === undefined){ 88 | blipLog.debug("Invalid position: %o", blip.pos); 89 | blipLog.warn("Blip position invalid"); 90 | return false; 91 | } 92 | 93 | if (typeof(blip.pos.x) !== "number" || typeof(blip.pos.y) !== "number" || typeof(blip.pos.z) !== "number"){ 94 | blipLog.warn("Blip pos must be numbers"); 95 | blipLog.debug("Invalid position: %o", blip.pos); 96 | return false; 97 | } 98 | 99 | return true; 100 | }; 101 | 102 | on("onResourceStart", (name) => { 103 | if (name === GetCurrentResourceName()){ 104 | loadBlips(); 105 | } 106 | }); 107 | on("onResourceStop", (name) => { 108 | if (name === GetCurrentResourceName()){ 109 | saveBlips(); 110 | } 111 | }); 112 | 113 | onNet("livemap:blipsGenerated", (blipTable) => { 114 | let playerIdentifier = GetPlayerIdentifier(source, 0); 115 | if (playerWhoGeneratedBlips === null || playerWhoGeneratedBlips !== playerIdentifier){ 116 | blipLog.warn("playerWhoGeneratedBlips doesn't match... Not using the blips recieved"); 117 | return; 118 | } 119 | 120 | blips = blipTable; 121 | saveBlips(); 122 | }); 123 | 124 | onNet("livemap:AddBlip", (blip) => { 125 | if (!validBlip(blip)){ 126 | return; 127 | } 128 | 129 | //Extract the spite 130 | const sprite = blip.sprite.toString(); 131 | delete blip.sprite; 132 | 133 | // Make sure it's to 2 dp 134 | blip.pos.x = blip.pos.x.toFixed(2); 135 | blip.pos.y = blip.pos.y.toFixed(2); 136 | blip.pos.z = blip.pos.z.toFixed(2); 137 | 138 | // Get the index of the blip.. Making sure it exists 139 | let blipIndex = getBlipIndex(sprite, blip); 140 | 141 | if (blipIndex !== -1){ 142 | blipLog.debug("Duplicate blip: %d = %o", blipIndex, blip); 143 | blipLog.warn("Blip already exists... Cannot add it!"); 144 | return; 145 | } 146 | 147 | if (blips[sprite] === undefined){ 148 | blips[sprite] = []; 149 | } 150 | 151 | blips[sprite].push(blip); 152 | 153 | SocketController.AddBlip(sprite, blip); 154 | }); 155 | 156 | onNet("livemap:UpdateBlip", (blip) => { 157 | if(!validBlip(blip)){ 158 | return; 159 | } 160 | 161 | //Extract the spite 162 | const sprite = blip.sprite.toString(); 163 | delete blip.sprite; 164 | 165 | // Make sure it's to 2 dp 166 | blip.pos.x = blip.pos.x.toFixed(2); 167 | blip.pos.y = blip.pos.y.toFixed(2); 168 | blip.pos.z = blip.pos.z.toFixed(2); 169 | 170 | // Get the index of the blip.. Making sure it exists 171 | let blipIndex = getBlipIndex(sprite, blip); 172 | 173 | if (blipIndex !== -1){ 174 | blips[sprite][blipIndex] = blip; 175 | SocketController.UpdateBlip(sprite, blip); 176 | }else{ 177 | if (blips[sprite] === undefined){ 178 | blips[sprite] = []; 179 | } 180 | 181 | blips[sprite].push(blip); 182 | SocketController.AddBlip(sprite, blip); 183 | } 184 | }); 185 | 186 | onNet("livemap:RemoveBlip", (blip) => { 187 | if (!validBlip(blip)){ 188 | return; 189 | } 190 | 191 | //Extract the spire 192 | const sprite = blip.sprite.toString(); 193 | delete blip.sprite; 194 | 195 | // Make sure it's to 2 dp 196 | blip.pos.x = blip.pos.x.toFixed(2); 197 | blip.pos.y = blip.pos.y.toFixed(2); 198 | blip.pos.z = blip.pos.z.toFixed(2); 199 | 200 | // Get the index of the blip.. Making sure it exists 201 | let blipIndex = getBlipIndex(sprite, blip); 202 | if (blipIndex !== -1) { 203 | delete blips[sprite][blipIndex]; 204 | blipLog.info("Removed blip: %o", blip); 205 | SocketController.RemoveBlip(sprite, blip); 206 | }else{ 207 | blipLog.warn("Cannot delete a blip that doesn't exist"); 208 | } 209 | }); 210 | 211 | onNet("livemap:RemoveClosestBlip", (playerPos) => { 212 | let closest, sprite, currentBest; 213 | for (let spriteId in blips){ 214 | blips[spriteId].forEach(blip => { 215 | let myDistance = getDistanceBetween(playerPos, blip.pos); 216 | if (currentBest === undefined || myDistance < currentBest){ 217 | currentBest = myDistance; 218 | closest = blip; 219 | sprite = spriteId; 220 | } 221 | }); 222 | } 223 | 224 | if (currentBest === undefined) { // Possibly no blips.. 225 | return; 226 | } 227 | 228 | blipLog.info("Removing closest blip. It's sprite is %d and position (dis=%d) is %o", sprite, closest.pos); 229 | 230 | const blipToDelete = getBlipIndex(sprite, closest.pos); 231 | if (blipToDelete == -1){ 232 | blipLog.debug("Closest blip doesn't exist? %o\n%O", closest, blips); 233 | return; 234 | } 235 | 236 | delete blips[sprite][blipToDelete]; 237 | SocketController.RemoveBlip(sprite, closest); 238 | }); 239 | 240 | RegisterCommand("blips", (src, args) => { 241 | if (src === 0) { 242 | blipLog.warn("Please run this command in game. Make sure you have ACE permissions set up"); 243 | blipLog.warn("https://docs.tgrhavoc.me/livemap-resource/faq/#how-do-i-get-blips"); 244 | return; 245 | } 246 | 247 | let playerIdentifier = GetPlayerIdentifier(src, 0); 248 | if (args[0] === "generate") { 249 | playerWhoGeneratedBlips = playerIdentifier; 250 | blipLog.warn("Generating blips using the in-game natives: Player %s is generating them.", playerIdentifier); 251 | emitNet("livemap:getBlipsFromClient", src); 252 | } 253 | }, true); 254 | 255 | return { 256 | getBlips 257 | }; 258 | }; 259 | 260 | 261 | module.exports = BlipController; 262 | -------------------------------------------------------------------------------- /src/server.js: -------------------------------------------------------------------------------- 1 | const Koa = require("koa"); 2 | const koaBody = require("koa-body"); 3 | const Router = require("koa-router"); 4 | const WS = require("ws"); 5 | const http = require("http"); 6 | const logger = require("simple-console-logger"); 7 | 8 | const app = new Koa(); 9 | const server = http.createServer(app.callback()); 10 | const router = new Router(); 11 | const wss = new WS.Server({ server }); 12 | 13 | const debugLevel = GetConvar("livemap_debug_level", "warn"); 14 | const access = GetConvar("livemap_access_control", "*"); 15 | 16 | logger.configure({ 17 | level: debugLevel 18 | }); 19 | const log = logger.getLogger("LiveMap"); 20 | 21 | router.use(async (ctx, next) => { 22 | ctx.response.append("Access-Control-Allow-Origin", access); 23 | next(); 24 | }); 25 | 26 | const SocketController = require("LivemapSocketController")(access); 27 | SocketController.hook(wss); 28 | 29 | require("LivemapEventsWrapper")(SocketController); 30 | 31 | // Passing the SocketController through as we need it to keep blips updated on the client. Plus, I can't seem to just "require" the server in the BlipController. 32 | const BlipController = require("LivemapBlipController")(SocketController); 33 | 34 | router.get("/blips", BlipController.getBlips); 35 | router.get("/blips.json", BlipController.getBlips); 36 | 37 | app.use(koaBody( 38 | { 39 | patchKoa: true, 40 | })) 41 | .use(router.routes()) 42 | .use(router.allowedMethods()); 43 | 44 | // Start a server on the socket_port... 45 | const port = GetConvarInt("socket_port", 30121); 46 | 47 | server.listen(port, "127.0.0.1", function listening() { 48 | log.info("Listening on %d", port); 49 | }); 50 | 51 | setInterval(SocketController.SendPlayerData, GetConvarInt("livemap_milliseconds", 500)); // Default = half a second. 52 | -------------------------------------------------------------------------------- /src/sockets.js: -------------------------------------------------------------------------------- 1 | const socketLog = require("simple-console-logger").getLogger("LiveMap Sockets"); 2 | const WS = require("ws"); 3 | 4 | const SocketController = (access) => { 5 | 6 | const hook = (wss) => { 7 | wss.broadcast = (data) => { 8 | wss.clients.forEach(function each(client) { 9 | if (client.readyState === WS.OPEN) { 10 | client.send(data); 11 | } 12 | }); 13 | }; 14 | wss.on("connection", function connection(ws, req) { //ws, res 15 | socketLog.trace("Access is: %s", access); 16 | if (access !== "*") { // We don't want to accept all requests 17 | if (req.headers.origin !== access) { 18 | ws.close(); 19 | socketLog.warn("Someone tried connecting from an invalid origin: %s", req.headers.origin); 20 | } 21 | } 22 | socketLog.debug("connection made from", req.headers.origin); 23 | }); 24 | websocketServer = wss; 25 | }; 26 | 27 | let playerData = {}; 28 | let websocketServer = null; 29 | 30 | const makeSurePlayerExists = (id) => { 31 | if (playerData[id] === undefined){ 32 | playerData[id] = {}; 33 | } 34 | }; 35 | 36 | const SendPlayerData = () => { 37 | if (websocketServer == null) return; 38 | 39 | let payload = []; 40 | for (let identifier in playerData){ 41 | payload.push(playerData[identifier]); 42 | } 43 | websocketServer.broadcast(JSON.stringify({ 44 | type: "playerData", 45 | payload: payload 46 | })); 47 | }; 48 | 49 | const checkInputs = (identifier, key, data) => { 50 | if (!identifier) { 51 | socketLog.debug("Empty identifier: ", identifier); 52 | socketLog.warn("Identifier cannot be null or empty when adding player data"); 53 | return false; 54 | } 55 | if (!key) { 56 | socketLog.warn("Key for the data cannot be null or empty when adding player data"); 57 | return false; 58 | } 59 | if (!data) { 60 | socketLog.warn("Cannot add no data to player"); 61 | return false; 62 | } 63 | 64 | return true; 65 | }; 66 | 67 | const validBlip = (blip) => { 68 | if (blip["sprite"] === undefined || blip["sprite"] === null) { 69 | socketLog.debug("Blip didn't have sprite: %o", blip); 70 | socketLog.warn("Blip has no sprite..."); 71 | return false; 72 | } 73 | 74 | if (blip["pos"] === undefined || blip["pos"] === null) { 75 | socketLog.debug("Blip didn't have pos: %o", blip); 76 | socketLog.warn("Blip has no position..."); 77 | return false; 78 | } 79 | 80 | if (typeof (blip.pos) !== "object") { 81 | socketLog.warn("Blip position must be an object"); 82 | return false; 83 | } 84 | 85 | if (blip.pos["x"] === undefined || blip.pos["y"] === undefined || blip.pos["z"] === undefined) { 86 | socketLog.debug("Invalid position: %o", blip.pos); 87 | socketLog.warn("Blip position invalid"); 88 | return false; 89 | } 90 | 91 | if (typeof (blip.pos.x) !== "number" || typeof (blip.pos.y) !== "number" || typeof (blip.pos.z) !== "number") { 92 | socketLog.warn("Blip pos must be numbers"); 93 | socketLog.debug("Invalid position: %o", blip.pos); 94 | return false; 95 | } 96 | 97 | return true; 98 | }; 99 | 100 | // The old, internal events... I can now just call them so... Make them functions! 101 | const AddPlayerData = (identifier, key, data) => { 102 | UpdatePlayerData(identifier, key, data); // It'll get added in here anyways... 103 | }; 104 | const UpdatePlayerData = (identifier, key, data) => { 105 | if (!checkInputs(identifier, key, data)) { 106 | return; 107 | } 108 | makeSurePlayerExists(identifier); 109 | 110 | playerData[identifier][key] = data; 111 | }; 112 | const RemovePlayerData = (identifier, key) => { 113 | if(!checkInputs(identifier, key, "s")) { 114 | return; 115 | } 116 | makeSurePlayerExists(identifier); 117 | 118 | if (playerData[identifier][key] !== undefined) { 119 | delete playerData[identifier][key]; 120 | } 121 | }; 122 | const RemovePlayer = (identifier) => { 123 | if (!identifier) { 124 | socketLog.warn("Cannot remove player with no identifier"); 125 | return; 126 | } 127 | 128 | delete playerData[identifier]; 129 | websocketServer.broadcast(JSON.stringify({ 130 | type: "playerLeft", 131 | payload: identifier 132 | })); 133 | }; 134 | const AddBlip = (blip) => { 135 | if(!validBlip(blip)) { 136 | return; 137 | } 138 | 139 | websocketServer.broadcast(JSON.stringify({ 140 | type: "addBlip", 141 | payload: blip 142 | })); 143 | }; 144 | const RemoveBlip = (blip) => { 145 | if(!validBlip(blip)) { 146 | return; 147 | } 148 | 149 | websocketServer.broadcast(JSON.stringify({ 150 | type: "removeBlip", 151 | payload: blip 152 | })); 153 | }; 154 | const UpdateBlip = (blip) => { 155 | if(!validBlip(blip)) { 156 | return; 157 | } 158 | 159 | websocketServer.broadcast(JSON.stringify({ 160 | type: "updateBlip", 161 | payload: blip 162 | })); 163 | }; 164 | 165 | return { 166 | hook, 167 | SendPlayerData, 168 | AddPlayerData, 169 | UpdatePlayerData, 170 | RemovePlayerData, 171 | RemovePlayer, 172 | AddBlip, 173 | UpdateBlip, 174 | RemoveBlip, 175 | }; 176 | }; 177 | 178 | module.exports = SocketController; -------------------------------------------------------------------------------- /src/wrapper.js: -------------------------------------------------------------------------------- 1 | const wrapperLog = require("simple-console-logger").getLogger("LiveMap Wrapper"); 2 | 3 | const EventsWrapper = (SocketController) => { 4 | 5 | const setStaticData = (source, id) => { 6 | SocketController.AddPlayerData(id, "identifier", id); 7 | SocketController.AddPlayerData(id, "name", GetPlayerName(source)); 8 | }; 9 | 10 | onNet("onResourceStart", (name) => { 11 | if (name == GetCurrentResourceName()){ 12 | if (GetNumPlayerIndices() !== 0){ 13 | wrapperLog.info("Players on the server... Initializing them"); 14 | for(let i = 0; i < GetNumPlayerIndices(); i++){ 15 | const id = GetPlayerIdentifier(GetPlayerFromIndex(i), 0); 16 | setStaticData(GetPlayerFromIndex(i), id); 17 | } 18 | } 19 | } 20 | }); 21 | 22 | onNet("livemap:playerSpawned", () => { 23 | setStaticData(source, GetPlayerIdentifier(source)); 24 | }); 25 | 26 | onNet("livemap:AddPlayerData", (k, d) => { 27 | SocketController.AddPlayerData(GetPlayerIdentifier(source, 0), k, d); 28 | }); 29 | 30 | onNet("livemap:UpdatePlayerData", (k, d) => { 31 | SocketController.UpdatePlayerData(GetPlayerIdentifier(source, 0), k, d); 32 | }); 33 | 34 | onNet("livemap:RemovePlayerData", (k) => { 35 | SocketController.RemovePlayerData(GetPlayerIdentifier(source, 0), k); 36 | }); 37 | 38 | onNet("livemap:RemovePlayer", () => { 39 | SocketController.RemovePlayer(GetPlayerIdentifier(source, 0)); 40 | }); 41 | 42 | onNet("playerDropped", () => { 43 | SocketController.RemovePlayer(GetPlayerIdentifier(source, 0)); 44 | }); 45 | 46 | // Internal events for server-side scripts. See https://github.com/TGRHavoc/live_map/issues/45 47 | on("livemap:internal_AddPlayerData", (id, k, d) => { 48 | SocketController.AddPlayerData(id, k, d); 49 | }); 50 | 51 | on("livemap:internal_UpdatePlayerData", (id, k, d) => { 52 | SocketController.UpdatePlayerData(id, k, d); 53 | }); 54 | 55 | on("livemap:internal_RemovePlayerData", (id, k) => { 56 | SocketController.RemovePlayerData(id, k); 57 | }); 58 | 59 | on("livemap:internal_RemovePlayer", (id) => { 60 | SocketController.RemovePlayer(id); 61 | }); 62 | 63 | return {}; 64 | }; 65 | 66 | module.exports = EventsWrapper; -------------------------------------------------------------------------------- /tools/bump-fxmanifest.js: -------------------------------------------------------------------------------- 1 | //version "2.3.2" 2 | 3 | const versionRegex = new RegExp("^version \"(.+)\"", "gm"); 4 | 5 | module.exports.readVersion = function (contents) { 6 | let matches = contents.match(versionRegex); 7 | let realversion = matches[0].match("\"(.+)\"")[1]; 8 | return realversion; 9 | }; 10 | 11 | module.exports.writeVersion = function (contents, version) { 12 | let t = contents; 13 | t = t.replace(versionRegex, `version "${version}"`); 14 | return t; 15 | }; -------------------------------------------------------------------------------- /tools/standard-version-bump.js: -------------------------------------------------------------------------------- 1 | 2 | module.exports.readVersion = function (contents) { 3 | return JSON.parse(contents).resource; 4 | }; 5 | 6 | module.exports.writeVersion = function (contents, version) { 7 | const json = JSON.parse(contents); 8 | json.resource = version; 9 | return JSON.stringify(json, null, 4); 10 | }; -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | { 2 | "resource": "3.2.1" 3 | } -------------------------------------------------------------------------------- /webpack.config.js: -------------------------------------------------------------------------------- 1 | const webpack = require("webpack"); 2 | const path = require("path"); 3 | const nodeExternals = require("webpack-node-externals"); 4 | 5 | const config = { 6 | entry: "./src/server.js", 7 | devtool: false, 8 | mode: "production", 9 | output: { 10 | path: path.resolve(__dirname, "dist"), 11 | filename: "livemap.js" 12 | }, 13 | resolve: { 14 | alias: { 15 | LivemapSocketController: path.resolve(__dirname, "src", "sockets.js"), 16 | LivemapBlipController: path.resolve(__dirname, "src", "blips.js"), 17 | LivemapEventsWrapper: path.resolve(__dirname, "src", "wrapper.js") 18 | } 19 | }, 20 | externals: [nodeExternals()], 21 | plugins: [ 22 | new webpack.DefinePlugin({ "global.GENTLY": false }) 23 | ], 24 | optimization: { 25 | minimize: false 26 | }, 27 | target: "node" 28 | }; 29 | 30 | module.exports = config; --------------------------------------------------------------------------------