Skip to content

Commit

Permalink
chore: fix lint error + clean up the code
Browse files Browse the repository at this point in the history
  • Loading branch information
bitpredator committed Nov 19, 2023
1 parent 8904c30 commit c812209
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 39 deletions.
3 changes: 2 additions & 1 deletion .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,5 @@
26. [esx_status/server]: fix: unused argument @bitpredator
27. [esx_addoninventory]: chore: check for nil society @bitpredator
28. [npwd]: chore: npwd update to version 1.8.6 @bitpredator
29. [bpt_deliveries]: chore: clean up the code @bitpredator
29. [bpt_deliveries]: chore: clean up the code @bitpredator
30. [esx-radialmenu]: chore: fix lint error + clean up the code @bitpredator
26 changes: 3 additions & 23 deletions server-data/resources/[esx_addons]/esx-radialmenu/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ local function getNearestVeh()
local pos = GetEntityCoords(PlayerPedId())
local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0)
local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0)
local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle)
local vehicleHandle = GetRaycastResult(rayHandle)
return vehicleHandle
end

Expand Down Expand Up @@ -250,7 +250,7 @@ RegisterKeyMapping('radialmenu', _U("command_description"), 'keyboard', Config.
-- Events

-- Sets the metadata when the player spawns
RegisterNetEvent('esx:playerLoaded', function(xPlayer, isNew)
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
ESX.PlayerData = xPlayer
ESX.PlayerLoaded = true
end)
Expand Down Expand Up @@ -360,25 +360,7 @@ RegisterNetEvent('esx-radialmenu:client:ChangeSeat', function(data)
end
end)

RegisterNetEvent('esx-radialmenu:flipVehicle', function()
TriggerEvent('animations:client:EmoteCommandStart', {"mechanic"})
QBCore.Functions.Progressbar("pick_grape", _U("progress.flipping_car"), Config.Fliptime, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
local vehicle = getNearestVeh()
SetVehicleOnGroundProperly(vehicle)
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end, function() -- Cancel
ESX.ShowNotification( _U("task.cancel_task"), "error")
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end)
end)

-- NUI Callbacks

RegisterNUICallback('closeRadial', function(data, cb)
setRadialState(false, false, data.delay)
cb('ok')
Expand All @@ -396,12 +378,10 @@ RegisterNUICallback('selectItem', function(inData, cb)
TriggerServerEvent(data.event, data)
elseif data.type == 'command' then
ExecuteCommand(data.event)
-- elseif data.type == 'qbcommand' then
-- TriggerServerEvent('QBCore:CallCommand', data.event, data)
end
end
cb('ok')
end)

exports('AddOption', AddOption)
exports('RemoveOption', RemoveOption)
exports('RemoveOption', RemoveOption)
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ local disabledTrunk = {
}

-- Functions

local function DrawText3Ds(x, y, z, text)
SetTextScale(0.35, 0.35)
SetTextFont(4)
Expand All @@ -44,7 +43,7 @@ local function getNearestVeh()
local entityWorld = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 20.0, 0.0)

local rayHandle = CastRayPointToPoint(pos.x, pos.y, pos.z, entityWorld.x, entityWorld.y, entityWorld.z, 10, PlayerPedId(), 0)
local _, _, _, _, vehicleHandle = GetRaycastResult(rayHandle)
local vehicleHandle = GetRaycastResult(rayHandle)
return vehicleHandle
end

Expand All @@ -70,7 +69,6 @@ local function TrunkCam(bool)
end

-- Events

RegisterNetEvent('esx_kidnapping:client:SetKidnapping', function(bool)
isKidnapping = bool
end)
Expand Down Expand Up @@ -207,7 +205,6 @@ RegisterNetEvent('esx-trunk:client:GetIn', function()
end)

-- Threads

CreateThread(function()
while true do
local sleep = 1000
Expand Down
11 changes: 3 additions & 8 deletions server-data/resources/[esx_addons]/esx-radialmenu/fxmanifest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@ shared_scripts {

client_scripts {
'locales/*.lua',
'client/main.lua',
'client/clothing.lua',
'client/trunk.lua',
'client/stretcher.lua'
'client/*.lua',
}

server_scripts {
'locales/*.lua',
'server/trunk.lua',
'server/stretcher.lua'
'server/*.lua',
}

files {
'html/index.html',
'html/css/main.css',
'html/js/main.js',
'html/js/RadialMenu.js',
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ RegisterNetEvent('esx-trunk:server:KidnapTrunk', function(targetId, closestVehic
TriggerClientEvent('esx-trunk:client:KidnapGetIn', targetId, closestVehicle)
end)

ESX.RegisterServerCallback('esx-trunk:server:getTrunkBusy', function(src, cb, plate)
ESX.RegisterServerCallback('esx-trunk:server:getTrunkBusy', function(_, cb, plate)
if trunkBusy[plate] then cb(true) return end
cb(false)
end)

ESX.RegisterCommand({"getintrunk"}, 'user', function(xPlayer, args, showError)
ESX.RegisterCommand({"getintrunk"}, 'user', function(xPlayer)
TriggerClientEvent('esx-trunk:client:GetIn', xPlayer.source)
end, false, {help = _U("getintrunk_command_desc")})

ESX.RegisterCommand({"putintrunk"}, 'user', function(xPlayer, args, showError)
ESX.RegisterCommand({"putintrunk"}, 'user', function(xPlayer, args)
TriggerClientEvent('esx-trunk:server:KidnapTrunk', xPlayer.source)
end, false, {help = _U("putintrunk_command_desc")})

0 comments on commit c812209

Please sign in to comment.