Update main.lua
This commit is contained in:
68
main.lua
68
main.lua
@@ -105,6 +105,7 @@ local DEFAULT_SETTINGS = {
|
|||||||
espTextSize = 15,
|
espTextSize = 15,
|
||||||
espRefreshMs = 150,
|
espRefreshMs = 150,
|
||||||
espMaxDistance = 1500,
|
espMaxDistance = 1500,
|
||||||
|
espInactiveDetection = false,
|
||||||
|
|
||||||
teleportViewKey = "V",
|
teleportViewKey = "V",
|
||||||
teleportPointKey = "Equals",
|
teleportPointKey = "Equals",
|
||||||
@@ -236,6 +237,7 @@ local function loadSettings()
|
|||||||
settings.espTextSize = math.floor(clampNumber(parsed.espTextSize, 10, 22, settings.espTextSize) + 0.5)
|
settings.espTextSize = math.floor(clampNumber(parsed.espTextSize, 10, 22, settings.espTextSize) + 0.5)
|
||||||
settings.espRefreshMs = math.floor(clampNumber(parsed.espRefreshMs, 33, 500, settings.espRefreshMs) + 0.5)
|
settings.espRefreshMs = math.floor(clampNumber(parsed.espRefreshMs, 33, 500, settings.espRefreshMs) + 0.5)
|
||||||
settings.espMaxDistance = math.floor(clampNumber(parsed.espMaxDistance, 50, 10000, settings.espMaxDistance) + 0.5)
|
settings.espMaxDistance = math.floor(clampNumber(parsed.espMaxDistance, 50, 10000, settings.espMaxDistance) + 0.5)
|
||||||
|
settings.espInactiveDetection = readBoolean(parsed.espInactiveDetection, settings.espInactiveDetection)
|
||||||
|
|
||||||
settings.teleportViewKey = normaliseKeyName(parsed.teleportViewKey, settings.teleportViewKey)
|
settings.teleportViewKey = normaliseKeyName(parsed.teleportViewKey, settings.teleportViewKey)
|
||||||
settings.teleportPointKey = normaliseKeyName(parsed.teleportPointKey, settings.teleportPointKey)
|
settings.teleportPointKey = normaliseKeyName(parsed.teleportPointKey, settings.teleportPointKey)
|
||||||
@@ -1737,6 +1739,36 @@ end
|
|||||||
local espEntries = {}
|
local espEntries = {}
|
||||||
local espAccumulator = 0
|
local espAccumulator = 0
|
||||||
local espWasEnabledLastTick = false
|
local espWasEnabledLastTick = false
|
||||||
|
local espActivityStates = {}
|
||||||
|
|
||||||
|
local ESP_INACTIVE_TIMEOUT_SECONDS = 60
|
||||||
|
local ESP_INACTIVE_POSITION_EPSILON = 0.35
|
||||||
|
|
||||||
|
local function clearEspActivityState(player)
|
||||||
|
espActivityStates[player] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local function isEspPlayerInactive(player, rootPart, nowTime)
|
||||||
|
local state = espActivityStates[player]
|
||||||
|
local position = rootPart.Position
|
||||||
|
|
||||||
|
if not state then
|
||||||
|
espActivityStates[player] = {
|
||||||
|
lastPosition = position,
|
||||||
|
lastMovedAt = nowTime
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
if (position - state.lastPosition).Magnitude > ESP_INACTIVE_POSITION_EPSILON then
|
||||||
|
state.lastPosition = position
|
||||||
|
state.lastMovedAt = nowTime
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
|
state.lastPosition = position
|
||||||
|
return (nowTime - state.lastMovedAt) >= ESP_INACTIVE_TIMEOUT_SECONDS
|
||||||
|
end
|
||||||
|
|
||||||
local function hideEspEntry(entry)
|
local function hideEspEntry(entry)
|
||||||
if not entry then
|
if not entry then
|
||||||
@@ -1787,6 +1819,7 @@ local function destroyEspEntry(player)
|
|||||||
end
|
end
|
||||||
|
|
||||||
espEntries[player] = nil
|
espEntries[player] = nil
|
||||||
|
clearEspActivityState(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getEspEntry(player)
|
local function getEspEntry(player)
|
||||||
@@ -1849,6 +1882,7 @@ local function updateEsp()
|
|||||||
if espWasEnabledLastTick then
|
if espWasEnabledLastTick then
|
||||||
hideAllEspEntries()
|
hideAllEspEntries()
|
||||||
end
|
end
|
||||||
|
espActivityStates = {}
|
||||||
espWasEnabledLastTick = false
|
espWasEnabledLastTick = false
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -1873,6 +1907,8 @@ local function updateEsp()
|
|||||||
local maxDistance = settings.espMaxDistance
|
local maxDistance = settings.espMaxDistance
|
||||||
local textSize = settings.espTextSize
|
local textSize = settings.espTextSize
|
||||||
local useDistanceIndicator = showTracers and settings.espDistanceIndicator
|
local useDistanceIndicator = showTracers and settings.espDistanceIndicator
|
||||||
|
local nowTime = os.clock()
|
||||||
|
local inactivePlayers = settings.espInactiveDetection and {} or nil
|
||||||
|
|
||||||
local nearestDistance = nil
|
local nearestDistance = nil
|
||||||
local furthestDistance = nil
|
local furthestDistance = nil
|
||||||
@@ -1885,6 +1921,13 @@ local function updateEsp()
|
|||||||
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
|
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
|
||||||
|
|
||||||
if humanoid and humanoid.Health > 0 and rootPart then
|
if humanoid and humanoid.Health > 0 and rootPart then
|
||||||
|
local isInactive = false
|
||||||
|
if inactivePlayers then
|
||||||
|
isInactive = isEspPlayerInactive(player, rootPart, nowTime)
|
||||||
|
inactivePlayers[player] = isInactive
|
||||||
|
end
|
||||||
|
|
||||||
|
if not isInactive then
|
||||||
local distance = (rootPart.Position - cameraPosition).Magnitude
|
local distance = (rootPart.Position - cameraPosition).Magnitude
|
||||||
if distance <= maxDistance then
|
if distance <= maxDistance then
|
||||||
if not nearestDistance or distance < nearestDistance then
|
if not nearestDistance or distance < nearestDistance then
|
||||||
@@ -1895,6 +1938,9 @@ local function updateEsp()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
elseif inactivePlayers then
|
||||||
|
clearEspActivityState(player)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1911,6 +1957,17 @@ local function updateEsp()
|
|||||||
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
|
local rootPart = character and character:FindFirstChild("HumanoidRootPart")
|
||||||
|
|
||||||
if humanoid and humanoid.Health > 0 and head and rootPart then
|
if humanoid and humanoid.Health > 0 and head and rootPart then
|
||||||
|
local isInactive = false
|
||||||
|
if inactivePlayers then
|
||||||
|
if inactivePlayers[player] == nil then
|
||||||
|
inactivePlayers[player] = isEspPlayerInactive(player, rootPart, nowTime)
|
||||||
|
end
|
||||||
|
isInactive = inactivePlayers[player]
|
||||||
|
end
|
||||||
|
|
||||||
|
if isInactive then
|
||||||
|
hideEspEntry(entry)
|
||||||
|
else
|
||||||
local distance = (rootPart.Position - cameraPosition).Magnitude
|
local distance = (rootPart.Position - cameraPosition).Magnitude
|
||||||
if distance <= maxDistance then
|
if distance <= maxDistance then
|
||||||
local rootPosition, rootOnScreen = Camera:WorldToViewportPoint(rootPart.Position)
|
local rootPosition, rootOnScreen = Camera:WorldToViewportPoint(rootPart.Position)
|
||||||
@@ -1971,7 +2028,9 @@ local function updateEsp()
|
|||||||
else
|
else
|
||||||
hideEspEntry(entry)
|
hideEspEntry(entry)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
clearEspActivityState(player)
|
||||||
hideEspEntry(entry)
|
hideEspEntry(entry)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -2200,6 +2259,14 @@ end, function(value)
|
|||||||
saveSettings()
|
saveSettings()
|
||||||
end, 50, 10000)
|
end, 50, 10000)
|
||||||
|
|
||||||
|
addToggleRow(PlayersPage, "Inactive player detection", function()
|
||||||
|
return settings.espInactiveDetection
|
||||||
|
end, function(state)
|
||||||
|
settings.espInactiveDetection = state
|
||||||
|
espActivityStates = {}
|
||||||
|
saveSettings()
|
||||||
|
end)
|
||||||
|
|
||||||
if not hasDrawing then
|
if not hasDrawing then
|
||||||
addActionRow(PlayersPage, "Drawing API", "Unavailable", function()
|
addActionRow(PlayersPage, "Drawing API", "Unavailable", function()
|
||||||
end)
|
end)
|
||||||
@@ -2331,6 +2398,7 @@ addActionRow(ConfigPage, "Reset", "Defaults", function()
|
|||||||
|
|
||||||
espAccumulator = 0
|
espAccumulator = 0
|
||||||
espWasEnabledLastTick = false
|
espWasEnabledLastTick = false
|
||||||
|
espActivityStates = {}
|
||||||
selectedTeleportPointIndex = 1
|
selectedTeleportPointIndex = 1
|
||||||
selectedTeleportPlayerIndex = 1
|
selectedTeleportPlayerIndex = 1
|
||||||
selectedTeleportPlayerUserId = nil
|
selectedTeleportPlayerUserId = nil
|
||||||
|
|||||||
Reference in New Issue
Block a user