Skip to content

Commit

Permalink
fix: distance check and mysql import
Browse files Browse the repository at this point in the history
  • Loading branch information
BerkieBb committed May 7, 2024
1 parent 6a1d156 commit 3a922bc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ local isHotwiring = false

local function giveKeys(id, plate)
local distance = #(GetEntityCoords(cache.ped) - GetEntityCoords(GetPlayerPed(GetPlayerFromServerId(id))))
if distance < 1.5 and distance > 0.0 then
if distance < 3 then
TriggerServerEvent('qb-vehiclekeys:server:GiveVehicleKeys', id, plate)
else
exports.qbx_core:Notify(locale("notify.not_near"), 'error')
Expand Down Expand Up @@ -473,7 +473,7 @@ RegisterNetEvent('qb-vehiclekeys:client:GiveKeys', function(id, plate)
TriggerServerEvent('qb-vehiclekeys:server:GiveVehicleKeys', GetPlayerServerId(NetworkGetPlayerIndexFromPed(otherOccupants[p])), targetPlate)
end
else -- Give keys to closest player
local playerId, _, _ = lib.getClosestPlayer(GetEntityCoords(cache.ped), 3, false)
local playerId = lib.getClosestPlayer(GetEntityCoords(cache.ped), 3, false)
giveKeys(playerId, targetPlate)
end
end
Expand Down
5 changes: 4 additions & 1 deletion fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ client_scripts {
'client/*.lua'
}

server_script 'server/*.lua'
server_scripts {
'@oxmysql/lib/MySQL.lua',
'server/*.lua'
}

0 comments on commit 3a922bc

Please sign in to comment.