From f8a5aabe87bc29d636f384a5b3dc1a5dd6b526b2 Mon Sep 17 00:00:00 2001 From: zykem#0643 <86602828+Zykem@users.noreply.github.com> Date: Wed, 15 Oct 2025 11:56:03 +0200 Subject: [PATCH] Revert "feat(noclip) Add initial files" This reverts commit 9c186308be14a177652f43c33f8370fa7524e41d. --- [core]/es_extended/client/modules/events.lua | 181 +++++-------------- [core]/es_extended/locales/de.lua | 2 - [core]/es_extended/locales/el.lua | 2 - [core]/es_extended/locales/en.lua | 2 - [core]/es_extended/locales/es.lua | 2 - [core]/es_extended/locales/fr.lua | 2 - [core]/es_extended/locales/he.lua | 2 - [core]/es_extended/locales/hu.lua | 2 - [core]/es_extended/locales/id.lua | 2 - [core]/es_extended/locales/it.lua | 2 - [core]/es_extended/locales/nl.lua | 2 - [core]/es_extended/locales/sl.lua | 2 - [core]/es_extended/locales/sr.lua | 2 - [core]/es_extended/locales/sv.lua | 2 - [core]/es_extended/locales/tr.lua | 2 - [core]/es_extended/locales/zh-cn.lua | 2 - [core]/es_extended/shared/config/main.lua | 54 ++---- 17 files changed, 64 insertions(+), 201 deletions(-) diff --git a/[core]/es_extended/client/modules/events.lua b/[core]/es_extended/client/modules/events.lua index f59cef91..5cffaeb6 100644 --- a/[core]/es_extended/client/modules/events.lua +++ b/[core]/es_extended/client/modules/events.lua @@ -138,7 +138,7 @@ AddStateBagChangeHandler("VehicleProperties", nil, function(bagName, _, value) end local tries = 0 - + while not NetworkDoesEntityExistWithNetworkId(netId) do Wait(200) tries = tries + 1 @@ -499,132 +499,49 @@ RegisterNetEvent("esx:tpm", function() end) end) -local noclipActive = false -local noclipEntity = nil -local followCamMode = true -local speedIndex = 1 -local currentSpeed = 0.2 -local yOffset, zOffset, hOffset = 0.5, 0.2, 3 - --- cached config values -local controls = Config.Noclip.controls -local speedOptions = Config.Noclip.speeds - ---- Toggles noclip state for the given entity ----@param entity number? Entity handle to apply noclip settings to ----@param isActive boolean Whether noclip should be enabled or disabled -local function toggleNoclip(entity, isActive) - if not entity or not DoesEntityExist(entity) then return end - - SetEntityAlpha(entity, isActive and 102 or 255, false) - SetEntityCollision(entity, not isActive, not isActive) - FreezeEntityPosition(entity, isActive) - SetEntityInvincible(entity, isActive) - SetEntityVisible(entity, not isActive, isActive) - - local ped = ESX.PlayerData.ped - SetEveryoneIgnorePlayer(ped, isActive) - SetPoliceIgnorePlayer(ped, isActive) - LocalPlayer.state:set('inNoclip', isActive, true) -end - -local function cycleSpeed() - if not noclipActive then return end - - speedIndex = speedIndex % #speedOptions + 1 - currentSpeed = speedOptions[speedIndex] - ESX.ShowNotification(TranslateCap("noclip_new_speed", currentSpeed)) -end - -local function handleMovement() - if not noclipEntity or not DoesEntityExist(noclipEntity) then return end - - local yMove, zMove = 0.0, 0.0 - local isForward = false - local hasMovement = false - - if IsDisabledControlPressed(0, controls.forward) then - yMove = yOffset - isForward = true - hasMovement = true - elseif IsDisabledControlPressed(0, controls.backward) then - yMove = -yOffset - hasMovement = true - end - - if not followCamMode then - if IsDisabledControlPressed(0, controls.up) then - zMove = zOffset - hasMovement = true - elseif IsDisabledControlPressed(0, controls.down) then - zMove = -zOffset - hasMovement = true - end - - if IsDisabledControlPressed(0, controls.left) then - SetEntityHeading(noclipEntity, GetEntityHeading(noclipEntity) + hOffset) - elseif IsDisabledControlPressed(0, controls.right) then - SetEntityHeading(noclipEntity, GetEntityHeading(noclipEntity) - hOffset) - end - else - if hasMovement then - local pitch = GetGameplayCamRelativePitch() - zMove = isForward and (pitch * 0.01) or (pitch * -0.01) - end - end - - if not hasMovement then return end - - local speedMult = currentSpeed + 0.3 - - local heading = GetEntityHeading(noclipEntity) - local newPos = GetOffsetFromEntityInWorldCoords(noclipEntity, 0.0, yMove * speedMult, zMove * speedMult) - - SetEntityVelocity(noclipEntity, 0.0, 0.0, 0.0) - SetEntityRotation(noclipEntity, 0.0, 0.0, 0.0, 0, false) - - if followCamMode then - SetEntityHeading(noclipEntity, GetGameplayCamRelativeHeading()) - else - SetEntityHeading(noclipEntity, heading) - end - - SetEntityCoordsNoOffset(noclipEntity, newPos.x, newPos.y, newPos.z, true, true, true) -end +local noclip = false +local noclip_pos = vector3(0, 0, 70) +local heading = 0 local function noclipThread() - CreateThread(function() - local allowedKeys = Config.Noclip.allowedKeys - local switchKey = Config.Noclip.controls.switchMode - local lastToggleTime = 0 + while noclip do + SetEntityCoordsNoOffset(ESX.PlayerData.ped, noclip_pos.x, noclip_pos.y, noclip_pos.z, false, false, true) - while noclipActive do - local currentTime = GetGameTimer() - - DisableAllControlActions(0) - - for i = 1, #allowedKeys do - local key = allowedKeys[i] - EnableControlAction(key[1], key[2], true) + if IsControlPressed(1, 34) then + heading = heading + 1.5 + if heading > 360 then + heading = 0 end - if IsDisabledControlJustPressed(0, switchKey) then - followCamMode = not followCamMode - ESX.ShowNotification(TranslateCap("noclip_mode_toggled", followCamMode and Translate("enabled") or Translate("disabled"))) - Wait(100) - end - - SetLocalPlayerVisibleLocally(true); - handleMovement() - - if currentTime - lastToggleTime >= 1000 then - toggleNoclip(noclipEntity, true) - lastToggleTime = currentTime - end - - Wait(0) + SetEntityHeading(ESX.PlayerData.ped, heading) end - end) + + if IsControlPressed(1, 9) then + heading = heading - 1.5 + if heading < 0 then + heading = 360 + end + + SetEntityHeading(ESX.PlayerData.ped, heading) + end + + if IsControlPressed(1, 8) then + noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 1.0, 0.0) + end + + if IsControlPressed(1, 32) then + noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, -1.0, 0.0) + end + + if IsControlPressed(1, 27) then + noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, 1.0) + end + + if IsControlPressed(1, 173) then + noclip_pos = GetOffsetFromEntityInWorldCoords(ESX.PlayerData.ped, 0.0, 0.0, -1.0) + end + Wait(0) + end end RegisterNetEvent("esx:noclip", function() @@ -633,18 +550,17 @@ RegisterNetEvent("esx:noclip", function() return end - if noclipActive then - noclipActive = false - toggleNoclip(noclipEntity, false) - return + if not noclip then + noclip_pos = GetEntityCoords(ESX.PlayerData.ped, false) + heading = GetEntityHeading(ESX.PlayerData.ped) end - noclipActive = true - noclipEntity = ESX.PlayerData.vehicle or ESX.PlayerData.ped - toggleNoclip(noclipEntity, true) - noclipThread() + noclip = not noclip + if noclip then + CreateThread(noclipThread) + end - if noclipActive then + if noclip then ESX.ShowNotification(TranslateCap("noclip_message", Translate("enabled")), "success") else ESX.ShowNotification(TranslateCap("noclip_message", Translate("disabled")), "error") @@ -652,9 +568,6 @@ RegisterNetEvent("esx:noclip", function() end) end) --- cycling speed -ESX.RegisterInput('cyclenoclipspeed', 'Cycle Noclip Speed', 'keyboard', Config.Noclip.controls.cycleNoclipSpeed, cycleSpeed) - RegisterNetEvent("esx:killPlayer", function() SetEntityHealth(ESX.PlayerData.ped, 0) end) @@ -685,7 +598,7 @@ ESX.RegisterClientCallback("esx:GetVehicleType", function(cb, model) end) ESX.SecureNetEvent('esx:updatePlayerData', function(key, val) - ESX.SetPlayerData(key, val) + ESX.SetPlayerData(key, val) end) ---@param command string diff --git a/[core]/es_extended/locales/de.lua b/[core]/es_extended/locales/de.lua index eb25cfcf..f32b3434 100644 --- a/[core]/es_extended/locales/de.lua +++ b/[core]/es_extended/locales/de.lua @@ -124,8 +124,6 @@ return { ["tpm_success"] = "Erfolgreich teleportiert.", ["noclip_message"] = "Noclip wurde %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~Aktiviert~s~", ["disabled"] = "~r~Deaktiviert~s~", diff --git a/[core]/es_extended/locales/el.lua b/[core]/es_extended/locales/el.lua index de56a619..365ba3a3 100644 --- a/[core]/es_extended/locales/el.lua +++ b/[core]/es_extended/locales/el.lua @@ -122,8 +122,6 @@ return { ["tpm_success"] = "Επιτυχής τηλεμεταφορά", ["noclip_message"] = "Το Noclip έχει %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~ενεργοποιήθηκε~s~", ["disabled"] = "~r~απενεργοποιήθηκε~s~", diff --git a/[core]/es_extended/locales/en.lua b/[core]/es_extended/locales/en.lua index b91c525c..d9513546 100644 --- a/[core]/es_extended/locales/en.lua +++ b/[core]/es_extended/locales/en.lua @@ -126,8 +126,6 @@ return { ["tpm_success"] = "Successfully Teleported", ["noclip_message"] = "Noclip has been %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~enabled~s~", ["disabled"] = "~r~disabled~s~", diff --git a/[core]/es_extended/locales/es.lua b/[core]/es_extended/locales/es.lua index e343ce5b..5750812b 100644 --- a/[core]/es_extended/locales/es.lua +++ b/[core]/es_extended/locales/es.lua @@ -124,8 +124,6 @@ return { ["tpm_success"] = "Teletransportado con éxito", ["noclip_message"] = "Noclip ha sido %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~activado~s~", ["disabled"] = "~r~desactivado~s~", diff --git a/[core]/es_extended/locales/fr.lua b/[core]/es_extended/locales/fr.lua index 726b0cf2..47e6dcc9 100644 --- a/[core]/es_extended/locales/fr.lua +++ b/[core]/es_extended/locales/fr.lua @@ -124,8 +124,6 @@ return { ["tpm_success"] = "Vous avez bien été téléporté", ["noclip_message"] = "Le mode noclip a été %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~activé~s~", ["disabled"] = "~r~désactivé~s~", diff --git a/[core]/es_extended/locales/he.lua b/[core]/es_extended/locales/he.lua index 6c9e43ef..e103e8b0 100644 --- a/[core]/es_extended/locales/he.lua +++ b/[core]/es_extended/locales/he.lua @@ -121,8 +121,6 @@ return { ["tpm_success"] = "הועברת בהצלחה", ["noclip_message"] = "מצב Noclip %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~מאופשר~s~", ["disabled"] = "~r~מנוטרל~s~", diff --git a/[core]/es_extended/locales/hu.lua b/[core]/es_extended/locales/hu.lua index 71fd6ad9..c515932b 100644 --- a/[core]/es_extended/locales/hu.lua +++ b/[core]/es_extended/locales/hu.lua @@ -118,8 +118,6 @@ return { ["tpm_success"] = "Sikeres teleportálás", ["noclip_message"] = "Noclip %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~engedélyezve~s~", ["disabled"] = "~r~letiltva~s~", diff --git a/[core]/es_extended/locales/id.lua b/[core]/es_extended/locales/id.lua index f8596117..17c13327 100644 --- a/[core]/es_extended/locales/id.lua +++ b/[core]/es_extended/locales/id.lua @@ -122,8 +122,6 @@ return { ["tpm_success"] = "Berhasil Teleportasi", ["noclip_message"] = "Noclip telah %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~diaktifkan~s~", ["disabled"] = "~r~dimatikan~s~", diff --git a/[core]/es_extended/locales/it.lua b/[core]/es_extended/locales/it.lua index 158155b1..8d097026 100644 --- a/[core]/es_extended/locales/it.lua +++ b/[core]/es_extended/locales/it.lua @@ -122,8 +122,6 @@ return { ["tpm_success"] = "Teletrasportato con successo", ["noclip_message"] = "Noclip %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~abilitato~s~", ["disabled"] = "~r~disabilitato~s~", diff --git a/[core]/es_extended/locales/nl.lua b/[core]/es_extended/locales/nl.lua index a08afd98..03daad47 100644 --- a/[core]/es_extended/locales/nl.lua +++ b/[core]/es_extended/locales/nl.lua @@ -114,8 +114,6 @@ return { ["tpm_success"] = "Successvol geteleporteerd", ["noclip_message"] = "Noclip is %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~aangezet~s~", ["disabled"] = "~r~uitgezet~s~", diff --git a/[core]/es_extended/locales/sl.lua b/[core]/es_extended/locales/sl.lua index 2355ef59..42a2c35e 100644 --- a/[core]/es_extended/locales/sl.lua +++ b/[core]/es_extended/locales/sl.lua @@ -118,8 +118,6 @@ return { ["tpm_success"] = "Uspesno teleportiran", ["noclip_message"] = "Noclip je bil %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~Vkljucen~s~", ["disabled"] = "~r~Izkljucen~s~", diff --git a/[core]/es_extended/locales/sr.lua b/[core]/es_extended/locales/sr.lua index 80407396..292e350e 100644 --- a/[core]/es_extended/locales/sr.lua +++ b/[core]/es_extended/locales/sr.lua @@ -118,8 +118,6 @@ return { ["tpm_success"] = "Teleportovani ste na lokaciju", ["noclip_message"] = "Noclip %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~upaljen~s~", ["disabled"] = "~r~ugašen~s~", diff --git a/[core]/es_extended/locales/sv.lua b/[core]/es_extended/locales/sv.lua index dd7c757b..ac05ff7c 100644 --- a/[core]/es_extended/locales/sv.lua +++ b/[core]/es_extended/locales/sv.lua @@ -122,8 +122,6 @@ return { ["tpm_success"] = "Du har teleporterat", ["noclip_message"] = "Noclip har %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~aktiverats~s~", ["disabled"] = "~r~avaktiverats~s~", diff --git a/[core]/es_extended/locales/tr.lua b/[core]/es_extended/locales/tr.lua index 4f1adf75..5157e291 100644 --- a/[core]/es_extended/locales/tr.lua +++ b/[core]/es_extended/locales/tr.lua @@ -122,8 +122,6 @@ return { ["tpm_success"] = "Başarıyla Teleport Edildi", ["noclip_message"] = "Noclip %s Yapıldı", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~Aktif Edildi~s~", ["disabled"] = "~r~Pasif Edildi~s~", diff --git a/[core]/es_extended/locales/zh-cn.lua b/[core]/es_extended/locales/zh-cn.lua index 235380ff..4f55db78 100644 --- a/[core]/es_extended/locales/zh-cn.lua +++ b/[core]/es_extended/locales/zh-cn.lua @@ -124,8 +124,6 @@ return { ["tpm_success"] = "路径点传送完成", ["noclip_message"] = "飞行模式 %s", - ["noclip_mode_toggled"] = "Noclip Camera Mode: %s", - ["noclip_new_speed"] = "New speed: %s", ["enabled"] = "~g~已激活~s~", ["disabled"] = "~r~已禁用~s~", diff --git a/[core]/es_extended/shared/config/main.lua b/[core]/es_extended/shared/config/main.lua index b21725c8..0bb55117 100644 --- a/[core]/es_extended/shared/config/main.lua +++ b/[core]/es_extended/shared/config/main.lua @@ -26,7 +26,7 @@ Config.StartingAccountMoney = { bank = 50000 } Config.StartingInventoryItems = false -- table/false -Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations +Config.DefaultSpawns = { -- If you want to have more spawn positions and select them randomly uncomment commented code or add more locations { x = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 }, --{x = 224.9865, y = -865.0871, z = 30.2922, heading = 1.0}, --{x = 227.8436, y = -866.0400, z = 30.2922, heading = 1.0}, @@ -40,50 +40,30 @@ Config.AdminGroups = { } Config.ValidCharacterSets = { -- Only enable additional charsets if your server is multilingual. By default everything is false. - ['el'] = false, -- Greek - ['sr'] = false, -- Cyrillic - ['he'] = false, -- Hebrew - ['ar'] = false, -- Arabic - ['zh-cn'] = false -- Chinese, Japanese, Korean + ['el'] = false, -- Greek + ['sr'] = false, -- Cyrillic + ['he'] = false, -- Hebrew + ['ar'] = false, -- Arabic + ['zh-cn'] = false -- Chinese, Japanese, Korean } -Config.EnablePaycheck = true -- enable paycheck -Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false) -Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society -Config.MaxWeight = 24 -- the max inventory weight without a backpack -Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds -Config.SaveDeathStatus = true -- Save the death status of a player -Config.EnableDebug = false -- Use Debug options? +Config.EnablePaycheck = true -- enable paycheck +Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false) +Config.EnableSocietyPayouts = false -- pay from the society account that the player is employed at? Requirement: esx_society +Config.MaxWeight = 24 -- the max inventory weight without a backpack +Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds +Config.SaveDeathStatus = true -- Save the death status of a player +Config.EnableDebug = false -- Use Debug options? -Config.DefaultJobDuty = true -- A players default duty status when changing jobs +Config.DefaultJobDuty = true -- A players default duty status when changing jobs Config.OffDutyPaycheckMultiplier = 0.5 -- The multiplier for off duty paychecks. 0.5 = 50% of the on duty paycheck Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing" -Config.Identity = true -- Select a character identity data before they have loaded in (this happens by default with multichar) -Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc. +Config.Identity = true -- Select a character identity data before they have loaded in (this happens by default with multichar) +Config.DistanceGive = 4.0 -- Max distance when giving items, weapons etc. Config.AdminLogging = false -- Logs the usage of certain commands by those with group.admin ace permissions (default is false) -Config.Noclip = { - allowedKeys = { - { 0, 1 }, -- MOUSE RIGHT - { 0, 2 }, -- MOUSE DOWN - { 0, 245 } -- T (for chat) - }, - controls = { -- https://docs.fivem.net/docs/game-references/controls/ - switchMode = 38, -- E - forward = 32, -- W - backward = 33, -- S - up = 85, -- Q - down = 210, -- LEFT CTRL - left = 34, -- A - right = 35, -- D - cycleNoclipSpeed = 'LSHIFT' -- changing noclip speed - }, - speeds = { 0.2, 0.5, 2, 5, 10, 15, 20, 30 }, - defaultSpeedIndex = 1, -} - ------------------------------------- -- DO NOT CHANGE BELOW THIS LINE !!! ------------------------------------- @@ -92,4 +72,4 @@ if GetResourceState("ox_inventory") ~= "missing" then end Config.EnableDefaultInventory = Config.CustomInventory == false -- Display the default Inventory ( F2 ) -Config.Identifier = GetConvar("esx:identifier", "license") +Config.Identifier = GetConvar("esx:identifier", "license") \ No newline at end of file