- 27
- 1
- Версия MoonLoader
- Другое
Авто БП сам работает, но проблема в том, что даже если все чек боксы выключены, оно берет БП, помогите исправить пожалуйста
Код:
local config = inicfg.load({
config = {
},
autogun = {
trueORfalse = false,
deagle = true,
rifle = true,
m4 = true,
shotgun = true
}
}, configFileName)
local trueORfalseGUN = new.bool(config.autogun.trueORfalse)
local trueorfalseDeagle = new.bool(config.autogun.deagle)
local trueorfalseM4 = new.bool(config.autogun.m4)
local trueorfalserifle = new.bool(config.autogun.rifle)
local trueorfalseshotgun = new.bool(config.autogun.shotgun)
local isEnable = config.autogun.trueORfalse
local weaponDialogId = 1183
local satiety = 20
local weapons = {
-- Deagle
[24] = {
enable = config.autogun.deagle, -- Заменить на 'false' для выключения взятия Deagle
maxAmmo = 63,
listItem = 0
},
-- Shotgun
[25] = {
enable = config.autogun.shotgun, -- Заменить на 'false' для выключения взятия Shotgun
maxAmmo = 30,
listItem = 1
},
-- M4
[31] = {
enable = config.autogun.m4, -- Заменить на 'false' для выключения взятия M4
maxAmmo = 300,
listItem = 3
},
-- Rifle
[33] = {
enable = config.autogun.rifle, -- Заменить на 'false' для выключения взятия Rifle
maxAmmo = 30,
listItem = 4
}
}
local Menus_8 = imgui.OnFrame(function() return Menu_8[0] end,
function(self)
imgui.SetNextWindowSize(imgui.ImVec2(500, 50), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2((sw / 2), sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.Begin(u8'Los Santos Special Forces | Auto Gun', Menu_8, imgui.WindowFlags.NoResize)
if imgui.Checkbox(u8'Включить или выключить', trueORfalseGUN) then
config.autogun.trueORfalse = trueORfalseGUN[0]
inicfg.save(config, configFileName)
enable()
end
imgui.TextWrapped(u8'Перед использованием, нужно нажать на галочку выше, для его включения, данная функция в разы упростит вашу игру в LSSF.')
if imgui.Checkbox('Desert Eagle', trueorfalseDeagle) then
config.autogun.deagle = trueorfalseDeagle[0]
inicfg.save(config, configFileName)
end
if imgui.Checkbox('M4', trueorfalseM4) then
config.autogun.m4 = trueorfalseM4[0]
inicfg.save(config, configFileName)
end
if imgui.Checkbox('Rifle', trueorfalserifle) then
config.autogun.rifle = trueorfalserifle[0]
inicfg.save(config, configFileName)
end
if imgui.Checkbox('ShotGun', trueorfalseshotgun) then
config.autogun.shotgun = trueorfalseshotgun[0]
inicfg.save(config, configFileName)
end
imgui.End()
end)
function getAllWeapons()
local tWeapons = {}
for i = 0, 12 do
local weapon, ammo, _ = getCharWeaponInSlot(PLAYER_PED, i)
if weapon >= 1 and weapon <= 46 then
tWeapons[weapon] = ammo
end
end
return tWeapons
end
function getTime()
return os.time()
end
function samp.onShowDialog(dialogId, style, title, button1, button2, text)
if dialogId == weaponDialogId and isEnable then
local myWeapons = getAllWeapons()
local health = 0
local armor = 0
result, myId = sampGetPlayerIdByCharHandle(playerPed)
if result then
health = sampGetPlayerHealth(myId)
armor = sampGetPlayerArmor(myId)
end
for key, weapon in pairs(weapons) do
if weapon.enable and not myWeapons[key] or myWeapons[key] and myWeapons[key] < weapon.maxAmmo then
if weapon.timer and getTime() - weapon.timer > 10 or not weapon.timer then
weapons[key]['timer'] = getTime()
sampSendDialogResponse(dialogId, 1, weapon.listItem, '')
return false
end
end
end
if health < 100 or armor < 100 or satiety < 20 then
sampSendDialogResponse(dialogId, 1, 5, "")
end
return false
end
end
function samp.onTextDrawSetString(id, text)
if id == 2048 then -- Получение сытости
satiety = tonumber(string.match(text, "~.+~(%d+)"))
end
end
function enable()
isEnable = not isEnable
if isEnable then
sampAddChatMessage(scriptTag ..' Авто-БП включен.', scriptColor)
else
sampAddChatMessage(scriptTag ..' Авто-БП выключен.', scriptColor)
end
end