Skip to content

Commit

Permalink
Add support for disabling sending position
Browse files Browse the repository at this point in the history
  • Loading branch information
actuallykane committed Apr 16, 2020
1 parent fd9e3d1 commit b7b7f75
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 9 deletions.
9 changes: 8 additions & 1 deletion client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
-- GNU AFFERO GENERAL PUBLIC LICENSE --
-- Version 3, 19 November 2007 --

local enablePositionSending = true

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
Expand All @@ -19,7 +21,7 @@ TriggerServerEvent('es:firstJoinProper')
local oldPos

Citizen.CreateThread(function()
while true do
while enablePositionSending do
Citizen.Wait(1000)
local pos = GetEntityCoords(PlayerPedId())

Expand Down Expand Up @@ -48,4 +50,9 @@ AddEventHandler("playerSpawned", function()
end

TriggerServerEvent('playerSpawn')
end)

RegisterNetEvent("es:disableClientPosition")
AddEventHandler("es:disableClientPosition", function()
enablePositionSending = false
end)
10 changes: 5 additions & 5 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
-- GNU AFFERO GENERAL PUBLIC LICENSE --
-- Version 3, 19 November 2007 --

ip = GetConvar('es_couchdb_url', '127.0.0.1') -- Change to wherever your DB is hosted, use convar
port = GetConvar('es_couchdb_port', '5984') -- Change to whatever port you have CouchDB running on, use convar
auth = GetConvar('es_couchdb_password', 'root:1202') -- "user:password", if you have auth setup, use convar
metrics = GetConvar('es_enable_metrics', '0') -- Change to '0' to disable metrics, no identifiable data is stored
show_zap = GetConvar('is_zap', '0') -- Zaphosting check
ip = GetConvar('es_couchdb_url', '127.0.0.1') -- Change to wherever your DB is hosted, use convar
port = GetConvar('es_couchdb_port', '5984') -- Change to whatever port you have CouchDB running on, use convar
auth = GetConvar('es_couchdb_password', 'root:1202') -- "user:password", if you have auth setup, use convar
metrics = GetConvar('es_enable_metrics', '0') -- Change to '0' to disable metrics, no identifiable data is stored
show_zap = GetConvar('is_zap', '0') -- Zaphosting check
8 changes: 6 additions & 2 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,12 @@ end)

RegisterServerEvent('es:updatePositions')
AddEventHandler('es:updatePositions', function(x, y, z)
if(Users[source])then
Users[source].setCoords(x, y, z)
if(settings.defaultSettings.sendPosition == "0")then
TriggerClientEvent("es:disableClientPosition", source)
else
if(Users[source])then
Users[source].setCoords(x, y, z)
end
end
end)

Expand Down
3 changes: 2 additions & 1 deletion server/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ settings.defaultSettings = {
['enableCustomData'] = GetConvar('es_enableCustomData', 'false'),
['defaultDatabase'] = GetConvar('es_defaultDatabase', '1'),
['disableCommandHandler'] = GetConvar('es_disableCommandHandler', 'false'),
['identifierUsed'] = GetConvar('es_identifierUsed', 'steam')
['identifierUsed'] = GetConvar('es_identifierUsed', 'steam'),
['sendPosition'] = GetConvar('es_send_position', '1')
}
settings.sessionSettings = {}
commandSuggestions = {}
Expand Down

0 comments on commit b7b7f75

Please sign in to comment.