Skip to content

Commit

Permalink
Merge pull request #945 from bitpredator/dev
Browse files Browse the repository at this point in the history
chore:  (esx-radialmenu) remove vehicle management from the radial menu
  • Loading branch information
bitpredator authored Jan 7, 2025
2 parents 75608a7 + de735fa commit 6dd37d4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 197 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ function IncurCooldown(ms)
end

function Notify(message, color) -- However you want your notifications to be shown, you can switch it up here.
ESX.ShowNotification(message, color)
ESX.ShowNotification(message, color, false, 1)
end

function IsMpPed(ped)
Expand Down
40 changes: 17 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 @@ -95,17 +95,6 @@ local function SetupVehicleMenu()
VehicleMenu.items[#VehicleMenu.items + 1] = Config.VehicleExtras
end

if not IsVehicleOnAllWheels(Vehicle) then
VehicleMenu.items[#VehicleMenu.items + 1] = {
id = "vehicle-flip",
title = "Flip Vehicle",
icon = "car-burst",
type = "client",
event = "esx-radialmenu:flipVehicle",
shouldClose = true,
}
end

if IsPedInAnyVehicle(PlayerPedId(), false) then
local seatIndex = #VehicleMenu.items + 1
VehicleMenu.items[seatIndex] = deepcopy(Config.VehicleSeats)
Expand Down Expand Up @@ -208,7 +197,7 @@ local function setRadialState(bool, sendMessage, delay)
if Config.UseWhilstWalking then
if bool then
SetupRadialMenu()
PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1)
PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", true)
controlToggle(true)
else
controlToggle(false)
Expand Down Expand Up @@ -240,14 +229,17 @@ local function setRadialState(bool, sendMessage, delay)
inRadialMenu = bool
end

-- Command

-- Commands
RegisterCommand("radialmenu", function()
if ((IsDowned() and IsPoliceOrEMS()) or not IsDowned()) and not LocalPlayer.state.handcuffed and not IsPauseMenuActive() and not inRadialMenu then
setRadialState(true, true)
SetCursorLocation(0.5, 0.5)
if not IsPauseMenuActive() then
if not inRadialMenu then
setRadialState(true, true)
SetCursorLocation(0.5, 0.5)
else
setRadialState(false, true)
end
end
end)
end, false)

RegisterKeyMapping("radialmenu", TranslateCap("command_description"), "keyboard", Config.Keybind)

Expand Down Expand Up @@ -308,16 +300,16 @@ RegisterNetEvent("esx-radialmenu:client:setExtra", function(data)
local replace = string:gsub("extra", "")
local extra = tonumber(replace)
local ped = PlayerPedId()
local veh = GetVehiclePedIsIn(ped)
local veh = GetVehiclePedIsIn(ped, false)
if veh ~= nil then
if GetPedInVehicleSeat(veh, -1) == ped then
SetVehicleAutoRepairDisabled(veh, true) -- Forces Auto Repair off when Toggling Extra [GTA 5 Niche Issue]
if DoesExtraExist(veh, extra) then
if IsVehicleExtraTurnedOn(veh, extra) then
SetVehicleExtra(veh, extra, 1)
SetVehicleExtra(veh, extra, true)
ESX.ShowNotification(TranslateCap("extra_deactivated", { extra = extra }), "error", 2500)
else
SetVehicleExtra(veh, extra, 0)
SetVehicleExtra(veh, extra, false)
ESX.ShowNotification(TranslateCap("extra_activated", { extra = extra }), "success", 2500)
end
else
Expand All @@ -330,7 +322,7 @@ RegisterNetEvent("esx-radialmenu:client:setExtra", function(data)
end)

RegisterNetEvent("esx-radialmenu:trunk:client:Door", function(plate, door, open)
local veh = GetVehiclePedIsIn(PlayerPedId())
local veh = GetVehiclePedIsIn(PlayerPedId(), false)
if veh ~= 0 then
local pl = GetVehicleNumberPlateText(veh)
if pl == plate then
Expand All @@ -344,9 +336,11 @@ RegisterNetEvent("esx-radialmenu:trunk:client:Door", function(plate, door, open)
end)

RegisterNetEvent("esx-radialmenu:client:ChangeSeat", function(data)
local Veh = GetVehiclePedIsIn(PlayerPedId())
local PlayerPedId = PlayerPedId()
local Veh = GetVehiclePedIsIn(PlayerPedId, false)
local IsSeatFree = IsVehicleSeatFree(Veh, data.id)
local speed = GetEntitySpeed(Veh)
local HasHarnass = (PlayerPedId) and IsPedInAnyVehicle(PlayerPedId, false)
if not HasHarnass then
local kmh = speed * 3.6
if IsSeatFree then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ end

local function getOffStretcher()
local ped = PlayerPedId()
local coords = GetOffsetFromEntityInWorldCoords(stretcherObject, 0.85, 0.0, 0)
local coords = GetOffsetFromEntityInWorldCoords(ped, 0.85, 0.0, 0)
ClearPedTasks(ped)
DetachEntity(ped, false, true)
SetEntityCoords(ped, coords.x, coords.y, coords.z)
Expand Down Expand Up @@ -118,7 +118,7 @@ local function attachToStretcher()
end

local function detachStretcher()
DetachEntity(stretcherObject, false, true)
DetachEntity(PlayerPedId(), false, true)
ClearPedTasksImmediately(PlayerPedId())
isAttached = false
end
Expand Down Expand Up @@ -178,10 +178,10 @@ RegisterNetEvent("esx-radialmenu:client:RemoveStretcherFromArea", function(playe
if stretcherObject then
if stretcherObject == bObject then
if #(pos - playerPos) < 10 then
if IsEntityPlayingAnim(ped, "anim@heists@box_carry@", "idle", false) then
if IsEntityPlayingAnim(ped, "anim@heists@box_carry@", "idle", 0) then
detachStretcher()
end
if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", false) then
if IsEntityPlayingAnim(ped, "anim@gangops@morgue@table@", "ko_front", 0) then
local coords = GetOffsetFromEntityInWorldCoords(ped, 0.85, 0.0, 0)
ClearPedTasks(ped)
DetachEntity(ped, false, true)
Expand Down Expand Up @@ -219,7 +219,7 @@ RegisterNetEvent("esx-radialmenu:client:Result", function(isBusy, type)
local inBedAnims = "ko_front"
if type == "lay" then
if not isBusy then
NetworkRequestControlOfEntity(stretcherObject)
NetworkRequestControlOfEntity(ped)
loadAnim(inBedDicts)
TaskPlayAnim(ped, inBedDicts, inBedAnims, 8.0, 8.0, -1, 69, 1, false, false, false)
AttachEntityToEntity(ped, stretcherObject, 0, 0, 0.0, 1.6, 0.0, 0.0, 360.0, 0.0, false, false, false, false, 2)
Expand Down
168 changes: 0 additions & 168 deletions server-data/resources/[esx_addons]/esx-radialmenu/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -228,174 +228,6 @@ Config.MenuItems = {
},
}

Config.VehicleDoors = {
id = "vehicledoors",
title = "Vehicle Doors",
icon = "car-side",
items = {
{
id = "door0",
title = "Drivers door",
icon = "car-side",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
{
id = "door4",
title = "Hood",
icon = "car",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
{
id = "door1",
title = "Passengers door",
icon = "car-side",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
{
id = "door3",
title = "Right rear",
icon = "car-side",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
{
id = "door5",
title = "Trunk",
icon = "car",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
{
id = "door2",
title = "Left rear",
icon = "car-side",
type = "client",
event = "esx-radialmenu:client:openDoor",
shouldClose = false,
},
},
}

Config.VehicleExtras = {
id = "vehicleextras",
title = "Vehicle Extras",
icon = "plus",
items = {
{
id = "extra1",
title = "Extra 1",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra2",
title = "Extra 2",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra3",
title = "Extra 3",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra4",
title = "Extra 4",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra5",
title = "Extra 5",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra6",
title = "Extra 6",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra7",
title = "Extra 7",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra8",
title = "Extra 8",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra9",
title = "Extra 9",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra10",
title = "Extra 10",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra11",
title = "Extra 11",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra12",
title = "Extra 12",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
{
id = "extra13",
title = "Extra 13",
icon = "box-open",
type = "client",
event = "esx-radialmenu:client:setExtra",
shouldClose = false,
},
},
}

Config.VehicleSeats = {
id = "vehicleseats",
title = "Vehicle Seats",
Expand Down

0 comments on commit 6dd37d4

Please sign in to comment.