Ошибка в пути к UI элементу. В Gamesense путь к хитшансу может отличаться. Вот исправленный код:
-- @region: precache
local ui_get = ui.get;
local ui_set = ui.set;
local ui_new_slider = ui.new_slider;
local ui_new_checkbox = ui.new_checkbox;
local ui_new_hotkey = ui.new_hotkey;
local ui_set_callback = ui.set_callback;
local ui_set_visible = ui.set_visible;
local ui_is_menu_open = ui.is_menu_open;
local ui_reference = ui.reference;
local entity_get_local_player = entity.get_local_player;
local entity_is_alive = entity.is_alive;
local entity_get_prop = entity.get_prop;
local renderer_indicator = renderer.indicator;
local bit_band = bit.band;
local FL_ONGROUND = 1;
-- @endregion
-- @region: references
local skeet = {
weapon_type = ui_reference("RAGE", "Aimbot", "Weapon"),
hitchance = ui_reference("RAGE", "Aimbot", "Minimum hit chance")
};
-- @endregion
-- @package hitchance
local hitchance = {}; do
-- @private
local original_hitchance = {};
local is_overriding = {};
local master = ui_new_checkbox("RAGE", "Aimbot", "Override hit chance");
local on_hotkey_indicator = ui_new_checkbox("RAGE", "Other", "Hotkey hit chance indicator");
local on_hotkey = ui_new_slider("RAGE", "Aimbot", "On hotkey hit chance", 0, 100, 50, true, "%", 1, {[0] = "Off"});
local hotkey = ui_new_hotkey("RAGE", "Aimbot", "\n hotkey-hitchance", true);
local in_air = ui_new_slider("RAGE", "Aimbot", "In-air hit chance", 0, 100, 50, true, "%", 1, {[0] = "Off"});
local function save_original(weapon)
if not is_overriding[weapon] then
original_hitchance[weapon] = ui_get(skeet.hitchance);
end
end
local function restore_original(weapon)
if original_hitchance[weapon] ~= nil then
ui_set(skeet.hitchance, original_hitchance[weapon]);
is_overriding[weapon] = false;
end
end
local function callback()
local val = ui_get(master);
local wpn = ui_get(skeet.weapon_type);
ui_set_visible(on_hotkey_indicator, val);
ui_set_visible(on_hotkey, val);
ui_set_visible(hotkey, val);
ui_set_visible(in_air, val);
if not val then
restore_original(wpn);
end
end
ui_set_callback(master, callback);
ui_set_callback(hotkey, callback);
callback();
function hitchance:on_shutdown()
local prev = ui_get(skeet.weapon_type);
for weapon, orig_value in pairs(original_hitchance) do
if is_overriding[weapon] then
ui_set(skeet.weapon_type, weapon);
ui_set(skeet.hitchance, orig_value);
is_overriding[weapon] = false;
end
end
ui_set(skeet.weapon_type, prev);
end
function hitchance:set(weapon, value)
if not is_overriding[weapon] then
original_hitchance[weapon] = ui_get(skeet.hitchance);
is_overriding[weapon] = true;
end
ui_set(skeet.hitchance, value);
end
function hitchance:on_paint()
if not ui_get(master) then
return;
end
local me = entity_get_local_player();
if me == nil or not entity_is_alive(me) then
return;
end
local wpn = ui_get(skeet.weapon_type);
local m_fFlags = entity_get_prop(me, "m_fFlags");
local should_override = false;
if not ui_is_menu_open() then
if ui_get(hotkey) then
local value = ui_get(on_hotkey);
if value ~= 0 then
self:set(wpn, value);
should_override = true;
if ui_get(on_hotkey_indicator) then
renderer_indicator(255, 255, 255, 200, "HITCHANCE OVR");
end
end
end
if not should_override and bit_band(m_fFlags, FL_ONGROUND) == 0 then
local value = ui_get(in_air);
if value ~= 0 then
self:set(wpn, value);
should_override = true;
end
end
end
if not should_override and is_overriding[wpn] then
restore_original(wpn);
end
end
end
-- @region: callbacks
client.set_event_callback("paint", function()
hitchance:on_paint();
end);
client.set_event_callback("shutdown", function()
hitchance:on_shutdown();
end);
-- @endregionИзменения:
"Rage" -> "RAGE" (регистр важен в gamesense)"Weapon type" -> "Weapon""Hit chance" -> "Minimum hit chance"Если всё ещё будет ошибка, напиши какая именно строка - возможно путь к элементу отличается в твоей версии чита.
Вот исправленный код с оригинальными путями:
-- downloaded from dsc.gg/southwestcfgs
-- @qhouz
-- FIXED: скрипт работает только когда включён мастер-переключатель
-- const
local FL_ONGROUND = bit.lshift(1, 0); -- 1 << 0
-- @package skeet
local skeet = {}; do
skeet.weapon_type = ui.reference("Rage", "Weapon type", "Weapon type");
skeet.hitchance = ui.reference("Rage", "Aimbot", "Minimum hit chance");
end
-- @package hitchance
local hitchance = {}; do
-- @private
local original_hitchance = {};
local is_overriding = {};
local master = ui.new_checkbox("Rage", "Aimbot", "Override hit chance");
local on_hotkey_indicator = ui.new_checkbox("Rage", "Other", "Hotkey hit chance indicator");
local on_hotkey = ui.new_slider("Rage", "Aimbot", "On hotkey hit chance", 0, 100, 50, true, "%", 1, {[0] = "Off"});
local hotkey = ui.new_hotkey("Rage", "Aimbot", "\n hotkey-hitchance", true);
local in_air = ui.new_slider("Rage", "Aimbot", "In-air hit chance", 0, 100, 50, true, "%", 1, {[0] = "Off"});
local can_scope = {
["G3SG1 / SCAR-20"] = true,
["SSG 08"] = true,
["AWP"] = true,
["Rifles"] = true
};
local function save_original(weapon)
if not is_overriding[weapon] then
original_hitchance[weapon] = ui.get(skeet.hitchance);
end
end
local function restore_original(weapon)
if original_hitchance[weapon] ~= nil then
ui.set(skeet.hitchance, original_hitchance[weapon]);
is_overriding[weapon] = false;
end
end
local function callback()
local val = ui.get(master);
local wpn = ui.get(skeet.weapon_type);
ui.set_visible(on_hotkey_indicator, val);
ui.set_visible(on_hotkey, val);
ui.set_visible(hotkey, val);
ui.set_visible(in_air, val);
if not val then
restore_original(wpn);
end
end
ui.set_callback(master, callback);
ui.set_callback(hotkey, callback);
callback();
function hitchance:on_shutdown()
local prev = ui.get(skeet.weapon_type);
for weapon, orig_value in pairs(original_hitchance) do
if is_overriding[weapon] then
ui.set(skeet.weapon_type, weapon);
ui.set(skeet.hitchance, orig_value);
is_overriding[weapon] = false;
end
end
ui.set(skeet.weapon_type, prev);
end
function hitchance:set(weapon, value)
if not is_overriding[weapon] then
original_hitchance[weapon] = ui.get(skeet.hitchance);
is_overriding[weapon] = true;
end
ui.set(skeet.hitchance, value);
end
function hitchance:on_paint()
if not ui.get(master) then
return;
end
local me = entity.get_local_player();
if me == nil or not entity.is_alive(me) then
return;
end
local wpn = ui.get(skeet.weapon_type);
local m_fFlags = entity.get_prop(me, "m_fFlags");
local should_override = false;
if not ui.is_menu_open() then
if ui.get(hotkey) then
local value = ui.get(on_hotkey);
if value ~= 0 then
self:set(wpn, value);
should_override = true;
if ui.get(on_hotkey_indicator) then
renderer.indicator(255, 255, 255, 200, "HITCHANCE OVR");
end
end
end
if not should_override and bit.band(m_fFlags, FL_ONGROUND) == 0 then
local value = ui.get(in_air);
if value ~= 0 then
self:set(wpn, value);
should_override = true;
end
end
end
if not should_override and is_overriding[wpn] then
restore_original(wpn);
end
end
end
-- @event
client.set_event_callback("shutdown", function()
hitchance:on_shutdown();
end);
client.set_event_callback("pre_config_save", function()
hitchance:on_shutdown();
end);
client.set_event_callback("paint", function()
hitchance:on_paint();
end);Оставил оригинальные пути:
ui.reference("Rage", "Weapon type", "Weapon type")ui.reference("Rage", "Aimbot", "Minimum hit chance")Логика исправления та же: is_overriding[weapon] защищает оригинальный хитшанс от перезаписи пока бинд активен.