diff --git a/[gameplay]/gps/client.lua b/[gameplay]/gps/client.lua
index bc93583e6..f8d86f691 100644
--- a/[gameplay]/gps/client.lua
+++ b/[gameplay]/gps/client.lua
@@ -1,4 +1,5 @@
local floor = math.floor
+local currentRouteMode = "client"
addCommandHandler('path',
function(command, node1, node2)
@@ -6,7 +7,12 @@ addCommandHandler('path',
outputChatBox("Usage: /path node1 node2", 255, 0, 0)
return
end
- local path = server.calculatePathByNodeIDs(tonumber(node1), tonumber(node2))
+ local path
+ if currentRouteMode == "client" then
+ path = calculatePathByNodeIDs(tonumber(node1), tonumber(node2))
+ elseif currentRouteMode == "server" then
+ path = server.calculatePathByNodeIDs(tonumber(node1), tonumber(node2))
+ end
if not path then
outputConsole('No path found')
return
@@ -30,7 +36,12 @@ addCommandHandler('path2',
return
end
local x,y,z = getElementPosition(localPlayer)
- local path = server.calculatePathByCoords(x, y, z, tox, toy, toz)
+ local path
+ if currentRouteMode == "client" then
+ path = calculatePathByCoords(x, y, z, tox, toy, toz)
+ elseif currentRouteMode == "server" then
+ path = server.calculatePathByCoords(x, y, z, tox, toy, toz)
+ end
if not path then
outputConsole('No path found')
return
diff --git a/[gameplay]/gps/gps.lua b/[gameplay]/gps/gps.lua
index c51e844a0..9098ebbe0 100644
--- a/[gameplay]/gps/gps.lua
+++ b/[gameplay]/gps/gps.lua
@@ -1,10 +1,11 @@
local floor = math.floor
-local allowedRPC = {
- calculatePathByCoords = true,
- calculatePathByNodeIDs = true,
- spawnPlayer = true
-}
+local file = fileOpen("vehiclenodes.json", true)
+local size = fileGetSize(file)
+vehicleNodes = fromJSON(fileRead(file, size))
+fileClose(file)
+
+outputDebugString("GPS: " .. (localPlayer and "Client" or "Server") .. " database loaded successfully!")
local function getAreaID(x, y)
return floor((y + 3000)/750)*8 + floor((x + 3000)/750)
@@ -67,7 +68,6 @@ local function calculatePath(db, nodeFrom, nodeTo)
break
end
- local successors = {}
for id,distance in pairs(current.neighbours) do
local successor = getNodeByID(db, id)
local successor_g = g[current] + distance*distance
@@ -113,21 +113,3 @@ function calculatePathByNodeIDs(node1, node2)
return false
end
end
-
-addEvent('onServerCall', true)
-addEventHandler('onServerCall', root,
- function(fnName, ...)
- if allowedRPC[fnName] then
- _G[fnName](...)
- end
- end
-)
-
-addEvent('onServerCallback', true)
-addEventHandler('onServerCallback', root,
- function(crID, fnName, ...)
- if allowedRPC[fnName] then
- triggerClientEvent(source, 'onServerCallbackReply', resourceRoot, crID, _G[fnName](...))
- end
- end
-)
diff --git a/[gameplay]/gps/meta.xml b/[gameplay]/gps/meta.xml
index 226d3dbec..a8309df58 100644
--- a/[gameplay]/gps/meta.xml
+++ b/[gameplay]/gps/meta.xml
@@ -1,15 +1,21 @@
+
+
+
+
+
+
-
-
-
+
+
+