Revert "feat(noclip) Add initial files"

This reverts commit 9c186308be.
This commit is contained in:
zykem#0643
2025-10-19 07:23:49 -05:00
committed by _Not_
parent b671e8a9f4
commit f8a5aabe87
17 changed files with 64 additions and 201 deletions
+47 -134
View File
@@ -138,7 +138,7 @@ AddStateBagChangeHandler("VehicleProperties", nil, function(bagName, _, value)
end end
local tries = 0 local tries = 0
while not NetworkDoesEntityExistWithNetworkId(netId) do while not NetworkDoesEntityExistWithNetworkId(netId) do
Wait(200) Wait(200)
tries = tries + 1 tries = tries + 1
@@ -499,132 +499,49 @@ RegisterNetEvent("esx:tpm", function()
end) end)
end) end)
local noclipActive = false local noclip = false
local noclipEntity = nil local noclip_pos = vector3(0, 0, 70)
local followCamMode = true local heading = 0
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 function noclipThread() local function noclipThread()
CreateThread(function() while noclip do
local allowedKeys = Config.Noclip.allowedKeys SetEntityCoordsNoOffset(ESX.PlayerData.ped, noclip_pos.x, noclip_pos.y, noclip_pos.z, false, false, true)
local switchKey = Config.Noclip.controls.switchMode
local lastToggleTime = 0
while noclipActive do if IsControlPressed(1, 34) then
local currentTime = GetGameTimer() heading = heading + 1.5
if heading > 360 then
DisableAllControlActions(0) heading = 0
for i = 1, #allowedKeys do
local key = allowedKeys[i]
EnableControlAction(key[1], key[2], true)
end end
if IsDisabledControlJustPressed(0, switchKey) then SetEntityHeading(ESX.PlayerData.ped, heading)
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)
end 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 end
RegisterNetEvent("esx:noclip", function() RegisterNetEvent("esx:noclip", function()
@@ -633,18 +550,17 @@ RegisterNetEvent("esx:noclip", function()
return return
end end
if noclipActive then if not noclip then
noclipActive = false noclip_pos = GetEntityCoords(ESX.PlayerData.ped, false)
toggleNoclip(noclipEntity, false) heading = GetEntityHeading(ESX.PlayerData.ped)
return
end end
noclipActive = true noclip = not noclip
noclipEntity = ESX.PlayerData.vehicle or ESX.PlayerData.ped if noclip then
toggleNoclip(noclipEntity, true) CreateThread(noclipThread)
noclipThread() end
if noclipActive then if noclip then
ESX.ShowNotification(TranslateCap("noclip_message", Translate("enabled")), "success") ESX.ShowNotification(TranslateCap("noclip_message", Translate("enabled")), "success")
else else
ESX.ShowNotification(TranslateCap("noclip_message", Translate("disabled")), "error") ESX.ShowNotification(TranslateCap("noclip_message", Translate("disabled")), "error")
@@ -652,9 +568,6 @@ RegisterNetEvent("esx:noclip", function()
end) end)
end) end)
-- cycling speed
ESX.RegisterInput('cyclenoclipspeed', 'Cycle Noclip Speed', 'keyboard', Config.Noclip.controls.cycleNoclipSpeed, cycleSpeed)
RegisterNetEvent("esx:killPlayer", function() RegisterNetEvent("esx:killPlayer", function()
SetEntityHealth(ESX.PlayerData.ped, 0) SetEntityHealth(ESX.PlayerData.ped, 0)
end) end)
@@ -685,7 +598,7 @@ ESX.RegisterClientCallback("esx:GetVehicleType", function(cb, model)
end) end)
ESX.SecureNetEvent('esx:updatePlayerData', function(key, val) ESX.SecureNetEvent('esx:updatePlayerData', function(key, val)
ESX.SetPlayerData(key, val) ESX.SetPlayerData(key, val)
end) end)
---@param command string ---@param command string
-2
View File
@@ -124,8 +124,6 @@ return {
["tpm_success"] = "Erfolgreich teleportiert.", ["tpm_success"] = "Erfolgreich teleportiert.",
["noclip_message"] = "Noclip wurde %s", ["noclip_message"] = "Noclip wurde %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~Aktiviert~s~", ["enabled"] = "~g~Aktiviert~s~",
["disabled"] = "~r~Deaktiviert~s~", ["disabled"] = "~r~Deaktiviert~s~",
-2
View File
@@ -122,8 +122,6 @@ return {
["tpm_success"] = "Επιτυχής τηλεμεταφορά", ["tpm_success"] = "Επιτυχής τηλεμεταφορά",
["noclip_message"] = "Το Noclip έχει %s", ["noclip_message"] = "Το Noclip έχει %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~ενεργοποιήθηκε~s~", ["enabled"] = "~g~ενεργοποιήθηκε~s~",
["disabled"] = "~r~απενεργοποιήθηκε~s~", ["disabled"] = "~r~απενεργοποιήθηκε~s~",
-2
View File
@@ -126,8 +126,6 @@ return {
["tpm_success"] = "Successfully Teleported", ["tpm_success"] = "Successfully Teleported",
["noclip_message"] = "Noclip has been %s", ["noclip_message"] = "Noclip has been %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~enabled~s~", ["enabled"] = "~g~enabled~s~",
["disabled"] = "~r~disabled~s~", ["disabled"] = "~r~disabled~s~",
-2
View File
@@ -124,8 +124,6 @@ return {
["tpm_success"] = "Teletransportado con éxito", ["tpm_success"] = "Teletransportado con éxito",
["noclip_message"] = "Noclip ha sido %s", ["noclip_message"] = "Noclip ha sido %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~activado~s~", ["enabled"] = "~g~activado~s~",
["disabled"] = "~r~desactivado~s~", ["disabled"] = "~r~desactivado~s~",
-2
View File
@@ -124,8 +124,6 @@ return {
["tpm_success"] = "Vous avez bien été téléporté", ["tpm_success"] = "Vous avez bien été téléporté",
["noclip_message"] = "Le mode noclip a été %s", ["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~", ["enabled"] = "~g~activé~s~",
["disabled"] = "~r~désactivé~s~", ["disabled"] = "~r~désactivé~s~",
-2
View File
@@ -121,8 +121,6 @@ return {
["tpm_success"] = "הועברת בהצלחה", ["tpm_success"] = "הועברת בהצלחה",
["noclip_message"] = "מצב Noclip %s", ["noclip_message"] = "מצב Noclip %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~מאופשר~s~", ["enabled"] = "~g~מאופשר~s~",
["disabled"] = "~r~מנוטרל~s~", ["disabled"] = "~r~מנוטרל~s~",
-2
View File
@@ -118,8 +118,6 @@ return {
["tpm_success"] = "Sikeres teleportálás", ["tpm_success"] = "Sikeres teleportálás",
["noclip_message"] = "Noclip %s", ["noclip_message"] = "Noclip %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~engedélyezve~s~", ["enabled"] = "~g~engedélyezve~s~",
["disabled"] = "~r~letiltva~s~", ["disabled"] = "~r~letiltva~s~",
-2
View File
@@ -122,8 +122,6 @@ return {
["tpm_success"] = "Berhasil Teleportasi", ["tpm_success"] = "Berhasil Teleportasi",
["noclip_message"] = "Noclip telah %s", ["noclip_message"] = "Noclip telah %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~diaktifkan~s~", ["enabled"] = "~g~diaktifkan~s~",
["disabled"] = "~r~dimatikan~s~", ["disabled"] = "~r~dimatikan~s~",
-2
View File
@@ -122,8 +122,6 @@ return {
["tpm_success"] = "Teletrasportato con successo", ["tpm_success"] = "Teletrasportato con successo",
["noclip_message"] = "Noclip %s", ["noclip_message"] = "Noclip %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~abilitato~s~", ["enabled"] = "~g~abilitato~s~",
["disabled"] = "~r~disabilitato~s~", ["disabled"] = "~r~disabilitato~s~",
-2
View File
@@ -114,8 +114,6 @@ return {
["tpm_success"] = "Successvol geteleporteerd", ["tpm_success"] = "Successvol geteleporteerd",
["noclip_message"] = "Noclip is %s", ["noclip_message"] = "Noclip is %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~aangezet~s~", ["enabled"] = "~g~aangezet~s~",
["disabled"] = "~r~uitgezet~s~", ["disabled"] = "~r~uitgezet~s~",
-2
View File
@@ -118,8 +118,6 @@ return {
["tpm_success"] = "Uspesno teleportiran", ["tpm_success"] = "Uspesno teleportiran",
["noclip_message"] = "Noclip je bil %s", ["noclip_message"] = "Noclip je bil %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~Vkljucen~s~", ["enabled"] = "~g~Vkljucen~s~",
["disabled"] = "~r~Izkljucen~s~", ["disabled"] = "~r~Izkljucen~s~",
-2
View File
@@ -118,8 +118,6 @@ return {
["tpm_success"] = "Teleportovani ste na lokaciju", ["tpm_success"] = "Teleportovani ste na lokaciju",
["noclip_message"] = "Noclip %s", ["noclip_message"] = "Noclip %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~upaljen~s~", ["enabled"] = "~g~upaljen~s~",
["disabled"] = "~r~ugašen~s~", ["disabled"] = "~r~ugašen~s~",
-2
View File
@@ -122,8 +122,6 @@ return {
["tpm_success"] = "Du har teleporterat", ["tpm_success"] = "Du har teleporterat",
["noclip_message"] = "Noclip har %s", ["noclip_message"] = "Noclip har %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~aktiverats~s~", ["enabled"] = "~g~aktiverats~s~",
["disabled"] = "~r~avaktiverats~s~", ["disabled"] = "~r~avaktiverats~s~",
-2
View File
@@ -122,8 +122,6 @@ return {
["tpm_success"] = "Başarıyla Teleport Edildi", ["tpm_success"] = "Başarıyla Teleport Edildi",
["noclip_message"] = "Noclip %s Yapıldı", ["noclip_message"] = "Noclip %s Yapıldı",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~Aktif Edildi~s~", ["enabled"] = "~g~Aktif Edildi~s~",
["disabled"] = "~r~Pasif Edildi~s~", ["disabled"] = "~r~Pasif Edildi~s~",
-2
View File
@@ -124,8 +124,6 @@ return {
["tpm_success"] = "路径点传送完成", ["tpm_success"] = "路径点传送完成",
["noclip_message"] = "飞行模式 %s", ["noclip_message"] = "飞行模式 %s",
["noclip_mode_toggled"] = "Noclip Camera Mode: %s",
["noclip_new_speed"] = "New speed: %s",
["enabled"] = "~g~已激活~s~", ["enabled"] = "~g~已激活~s~",
["disabled"] = "~r~已禁用~s~", ["disabled"] = "~r~已禁用~s~",
+17 -37
View File
@@ -26,7 +26,7 @@ Config.StartingAccountMoney = { bank = 50000 }
Config.StartingInventoryItems = false -- table/false 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 = 222.2027, y = -864.0162, z = 30.2922, heading = 1.0 },
--{x = 224.9865, y = -865.0871, 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}, --{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. Config.ValidCharacterSets = { -- Only enable additional charsets if your server is multilingual. By default everything is false.
['el'] = false, -- Greek ['el'] = false, -- Greek
['sr'] = false, -- Cyrillic ['sr'] = false, -- Cyrillic
['he'] = false, -- Hebrew ['he'] = false, -- Hebrew
['ar'] = false, -- Arabic ['ar'] = false, -- Arabic
['zh-cn'] = false -- Chinese, Japanese, Korean ['zh-cn'] = false -- Chinese, Japanese, Korean
} }
Config.EnablePaycheck = true -- enable paycheck Config.EnablePaycheck = true -- enable paycheck
Config.LogPaycheck = false -- Logs paychecks to a nominated Discord channel via webhook (default is false) 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.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.MaxWeight = 24 -- the max inventory weight without a backpack
Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds Config.PaycheckInterval = 7 * 60000 -- how often to receive paychecks in milliseconds
Config.SaveDeathStatus = true -- Save the death status of a player Config.SaveDeathStatus = true -- Save the death status of a player
Config.EnableDebug = false -- Use Debug options? 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.OffDutyPaycheckMultiplier = 0.5 -- The multiplier for off duty paychecks. 0.5 = 50% of the on duty paycheck
Config.Multichar = GetResourceState("esx_multicharacter") ~= "missing" 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.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.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.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 !!! -- DO NOT CHANGE BELOW THIS LINE !!!
------------------------------------- -------------------------------------
@@ -92,4 +72,4 @@ if GetResourceState("ox_inventory") ~= "missing" then
end end
Config.EnableDefaultInventory = Config.CustomInventory == false -- Display the default Inventory ( F2 ) Config.EnableDefaultInventory = Config.CustomInventory == false -- Display the default Inventory ( F2 )
Config.Identifier = GetConvar("esx:identifier", "license") Config.Identifier = GetConvar("esx:identifier", "license")