From eaf4eecb3870c0fdd4858107b388cf6016f66446 Mon Sep 17 00:00:00 2001 From: lopezloo <7338099+lopezloo@users.noreply.github.com> Date: Fri, 10 Feb 2023 13:56:00 +0100 Subject: [PATCH 1/2] Add color validation --- loaddata.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/loaddata.js b/loaddata.js index be0dc2f..9c8bc82 100644 --- a/loaddata.js +++ b/loaddata.js @@ -54,7 +54,16 @@ SelectModel(model) let td = document.createElement('td'); td.width = "16px"; td.height = "16px"; - let col = VehicleColours[c[j]]; + + // GTA color ID + let colorID = c[j]; + + // RGB color + let col = VehicleColours[colorID]; + if(!col) { + continue; + } + td.style = "background-color: rgb("+col[0]+","+col[1]+","+col[2]+")"; tr.appendChild(td); } From 3e30124d667db72b8dbb696a469567fc8b877331 Mon Sep 17 00:00:00 2001 From: lopezloo <7338099+lopezloo@users.noreply.github.com> Date: Fri, 10 Feb 2023 14:00:43 +0100 Subject: [PATCH 2/2] Add color validation #2 --- loaddata.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/loaddata.js b/loaddata.js index 9c8bc82..6dce8d5 100644 --- a/loaddata.js +++ b/loaddata.js @@ -14,7 +14,15 @@ SetCarColors(cols) ]; if(cols !== undefined) for(let i = 0; i < cols.length; i++){ - let col = VehicleColours[cols[i]]; + // GTA color ID + let colorID = cols[i]; + + // RGB color + let col = VehicleColours[colorID]; + if(!col) { + continue; + } + carColors[i][0] = col[0]; carColors[i][1] = col[1]; carColors[i][2] = col[2];