- Версия MoonLoader
- .026-beta
Как сделать задержку при открытии фишек. Чтобы каждая открывалась в раз в 10-15 секунд.
Lua:
script_version("1") -- // Версия скрипта
local memory = require("memory")
local imgui = require("imgui")
local sampev = require("lib.samp.events")
local encoding = require("encoding") -- // Библиотека encoding
encoding.default = "CP1251"
u8 = encoding.UTF8
local rx, ry = getScreenResolution() -- // Размер экрана
local mainMenu = imgui.ImBool(false) -- // Основное меню
-- // JSON БД
local tableConfig = {
["config"] = thisScript().version, -- // Версия конфига
["ANTIAFK"] = false,
["COUNTERS"] = {
["MONEY"] = 0,
["EXP"] = 0,
["ALL"] = 0,
["CHIPS"] = 0,
["OTHER"] = {},
},
["ITEMS"] = {
"Усы",
"хоккейная маска",
"Маска CJ",
"Фиолетовый шлем",
"Соломенная шляпа",
"Trinitorolla",
"Bananaphone",
"Презерватив",
"Police Black",
"Police Red",
"Police Blue",
"Прибор ночного видения",
"Born to truck",
"Карнавальный комплект",
"Карнавальная маска",
"Redhat",
"Greenhat",
"Wehrmacht",
"Bluehat",
"Yellowhat",
"Камуфляжная каска",
"Kaiser Red",
"Kaiser Blue",
"Полицейская дубинка",
"Полицейский щит",
"Жезл регулировщика",
"Шлем патрульного",
"Police",
"Коричневая шляпа шерифа",
"Парадная фуражка",
"Офицерская фуражка",
"Pizza",
"Каска строителя",
"Белый цилиндр",
"Кудрявый парик",
"Синяя полицейская каска",
"Черная полицейская каска",
"Игрушечный самолет",
"Golden Cluckin",
"SUMMER WIDESCALE 2020",
"Zenit",
"рпг",
"mp5",
"маска",
"попугай"
}
}
local linkConfig = getWorkingDirectory() .. "/config/autochip2.json"
if not doesFileExist(linkConfig) then
local file = io.open(linkConfig, "w")
file:write(encodeJson(tableConfig))
io.close(file)
end
if doesFileExist(linkConfig) then
local file = io.open(linkConfig, "r")
if file then
local code = decodeJson(file:read("*a"))
if code["config"] == nil or tostring(code["config"]) ~= tostring(thisScript().version) then
os.remove(linkConfig)
io.close(file)
local file = io.open(linkConfig, "w")
file:write(encodeJson(tableConfig))
io.close(file)
end
end
local file = io.open(linkConfig, "r")
if file then
db = decodeJson(file:read("*a"))
end
io.close(file)
end
local checkBoxe = imgui.ImBool(db["ANTIAFK"])
local multiLine = imgui.ImBuffer(u8(table.concat(db["ITEMS"], "\n")), 19999)
local prefix = "{00BD39}[AC]{FFFFFF}: "
local clicker = function()
while true do
wait(100)
if onScript then
local num = 0
for id = 0, 2304 do
if sampTextdrawIsExists(id) then
local text = sampTextdrawGetString(id)
if text then
if text:find('CЊ‘ЏAЏ’ YѓAЌY')then
sampSendClickTextdraw(id)
num = num + 1
end
end
end
end
if num > 0 then
onScriptParse = true
tryActiveAntiAfk()
else
onScriptParse = false
end
end
end
end
function main()
while not isSampAvailable() do wait(0) end
local ip = sampGetCurrentServerAddress()
if ip ~= "185.169.134.83" and ip ~= "185.169.134.84" and ip ~= "185.169.134.85" then
thisScript():unload()
else
sampAddChatMessage(prefix .. "{FFFFFF}Команды: {00BD39}/aochip [menu/stats/clear] {FFFFFF} и {00BD39}/aochip{FFFFFF} - вкл/выкл скрипт", -1)
end
sampRegisterChatCommand(
"aochip",
function(cmd)
if cmd == "menu" then
mainMenu.v = not mainMenu.v
elseif cmd == "stats" then
sampAddChatMessage(prefix .. "Деньги: {00BD39}" .. db["COUNTERS"]["MONEY"] .. "${FFFFFF} // Опыт: {00BD39}" .. db["COUNTERS"]["EXP"] .. "{FFFFFF} // Другое: {00BD39}" .. table.sum(db["COUNTERS"]["OTHER"])..' ('..table.len(db["COUNTERS"]["OTHER"])..')', -1)
elseif cmd == "clear" then
sampAddChatMessage(prefix .. "Данные очищены.", -1)
db["COUNTERS"]["MONEY"] = 0
db["COUNTERS"]["EXP"] = 0
db["COUNTERS"]["ALL"] = 0
db["COUNTERS"]["CHIPS"] = 0
db["COUNTERS"]["OTHER"] = {}
saveDB()
else
toggleScript()
end
end
)
lua_thread.create(clicker)
while true do
wait(0)
imgui.Process = mainMenu.v
end
end
function toggleScript()
onScript = not onScript
onScriptParse = false
if onScript then
sampAddChatMessage(prefix .. "Скрипт {00BD39}включен{FFFFFF}, откройте окно с фишками.", -1)
else
sampAddChatMessage(prefix .. "Скрипт {00BD39}выключен{FFFFFF}, закройте окно с фишками.", -1)
tryActiveAntiAfk()
end
end
function imgui.OnDrawFrame()
if mainMenu.v then
imgui.SetNextWindowSize(imgui.ImVec2(380, 470), imgui.Cond.FirstUseEver)
imgui.SetNextWindowPos(imgui.ImVec2(rx / 2, ry / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.6, 0.6))
imgui.Begin("AutoChip | Trinity GTA", mainMenu, imgui.WindowFlags.NoCollapse + imgui.WindowFlags.NoResize)
imgui.Text(u8("Открыто: " .. db["COUNTERS"]["ALL"] .. " | Деньги: $" .. db["COUNTERS"]["MONEY"] .. " | Опыт: " .. db["COUNTERS"]["EXP"] .. "\nДругое: " .. table.sum(db["COUNTERS"]["OTHER"])..' ('..table.len(db["COUNTERS"]["OTHER"])..') || Фишки: '..db["COUNTERS"]["CHIPS"]))
if imgui.Checkbox(u8(" : Анти АФК при ALT + TAB"), checkBoxe) then
db["ANTIAFK"] = checkBoxe.v
saveDB()
end
imgui.SameLine()
imgui.Text(u8' Скрипт: ')
imgui.SameLine()
if imgui.Button(onScript and u8'ВКЛ' or u8'ВЫКЛ') then
toggleScript()
end
local multiline_size = 300
local other_size = 21 * table.len(db["COUNTERS"]["OTHER"])
if other_size > 1 then
if other_size > 130 then
other_size = 130
end
multiline_size = multiline_size - (other_size + 15)
imgui.Text(u8'Другое:')
imgui.BeginChild('other', imgui.ImVec2(-1, other_size), true)
for k, v in pairs(db["COUNTERS"]["OTHER"]) do
imgui.Text(u8(tostring(k)..': '..tostring(v)))
end
imgui.EndChild()
end
imgui.InputTextMultiline("##MULTILINE", multiLine, imgui.ImVec2(-1, multiline_size))
if imgui.Button(u8("СОХРАНИТЬ СЛОВА"), imgui.ImVec2(-1, 30)) then
db["ITEMS"] = {}
for line in string.gmatch(u8:decode(multiLine.v), "[^\r\n]+") do
if line ~= nil and line ~= "" then
table.insert(db["ITEMS"], line)
end
end
sampAddChatMessage(prefix .. "Данные сохранены.", -1)
saveDB()
end
if imgui.Button(u8("ОЧИСТИТЬ СТАТИСТИКУ"), imgui.ImVec2(-1, 30)) then
sampAddChatMessage(prefix .. "Данные очищены.", -1)
db["COUNTERS"]["MONEY"] = 0
db["COUNTERS"]["EXP"] = 0
db["COUNTERS"]["ALL"] = 0
db["COUNTERS"]["CHIPS"] = 0
db["COUNTERS"]["OTHER"] = {}
saveDB()
end
imgui.End()
end
end
function table.len(T)
local count = 0
for _ in pairs(T) do count = count + 1 end
return count
end
function table.sum(T)
local count = 0
for k, v in pairs(T) do count = count + v end
return count
end
function sampev.onShowDialog(dialogID, style, title, button1, button2, text)
if onScriptParse then
if text:find("Освободите в своем инвентаре как минимум одно место для начала игры") and dialogID == 45 then
onScript, onScriptParse = false, false
sampAddChatMessage(prefix .. "Скрипт выключен. Нет места для вещей в /inv", -1)
tryActiveAntiAfk()
sampSendDialogResponse(dialogID, 1, 0, "")
return false
elseif text:find("У вас закончились фишки!") and dialogID == 45 then
onScript, onScriptParse = false, false
sampAddChatMessage(prefix .. text .. " // Скрипт выключен.", -1)
tryActiveAntiAfk()
sampSendDialogResponse(dialogID, 1, 0, "")
return false
elseif dialogID == 45 and button1 == "X" then
local finded = false
if text:find("Вы выиграли {D8A903}%d+{ffffff} .+ опыта!") then
local num = text:match("Вы выиграли {D8A903}(%d+){ffffff} .+ опыта!")
db["COUNTERS"]["EXP"] = db["COUNTERS"]["EXP"] + tonumber(num)
finded = true
end
if text:find("Вы выиграли денежный приз в размере {33aa33}.* %${ffffff}") then
local num = text:match("Вы выиграли денежный приз в размере {33aa33}(.*) %${ffffff}")
local num = num:gsub("%.", "")
db["COUNTERS"]["MONEY"] = db["COUNTERS"]["MONEY"] + tonumber(num)
finded = true
end
if text:find("Вы выиграли {%S+}(%d+){%S+} %S+ Trinity GTA!") then
local num = text:match("Вы выиграли {%S+}(%d+){%S+} %S+ Trinity GTA!")
db["COUNTERS"]["CHIPS"] = db["COUNTERS"]["CHIPS"] + num
finded = true
end
if finded then
db["COUNTERS"]["ALL"] = db["COUNTERS"]["ALL"] + 1
sampAddChatMessage(prefix .. text, -1)
sampSendDialogResponse(dialogID, 1, 0, "")
saveDB()
return false
end
end
if dialogID == 7030 and button1:find("Сохранить") then
local matched = text:match("Вы выиграли {abcdef}(.*){ffffff}. Сохранить предмет или выбросить?")
if db["COUNTERS"]["OTHER"][matched] then
db["COUNTERS"]["OTHER"][matched] = db["COUNTERS"]["OTHER"][matched] + 1
else
db["COUNTERS"]["OTHER"][matched] = 1
end
local num = 0
for k, v in ipairs(db["ITEMS"]) do
if rusLower(matched):find(rusLower(v), nil, true) then
addOneOffSound(0, 0, 0, 1147)
sampAddChatMessage(prefix .. "Поздравляем, вы выиграли: {00BD39}" .. matched, -1)
sampSendDialogResponse(dialogID, 1, 0, "")
num = num + 1
return false
end
end
db["COUNTERS"]["ALL"] = db["COUNTERS"]["ALL"] + 1
sampSendDialogResponse(dialogID, 0, 0, "")
saveDB()
return false
end
if dialogID == 990 and title:find("Выбросить предмет") then
sampSendDialogResponse(dialogID, 1, 0, "")
return false
end
end
end
function tryActiveAntiAfk()
if db["ANTIAFK"] then
memory.setuint8(7634870, 0, false)
memory.setuint8(7635034, 0, false)
memory.hex2bin("0F 84 7B 01 00 00", 7623723, 8)
memory.hex2bin("50 51 FF 15 00 83 85 00", 5499528, 6)
end
end
local russian_characters = {
[168] = "Ё", [184] = "ё", [192] = "А", [193] = "Б", [194] = "В", [195] = "Г", [196] = "Д", [197] = "Е", [198] = "Ж", [199] = "З", [200] = "И", [201] = "Й", [202] = "К", [203] = "Л", [204] = "М", [205] = "Н", [206] = "О", [207] = "П", [208] = "Р", [209] = "С", [210] = "Т", [211] = "У", [212] = "Ф", [213] = "Х", [214] = "Ц", [215] = "Ч", [216] = "Ш", [217] = "Щ", [218] = "Ъ", [219] = "Ы", [220] = "Ь", [221] = "Э", [222] = "Ю", [223] = "Я", [224] = "а", [225] = "б", [226] = "в", [227] = "г", [228] = "д", [229] = "е", [230] = "ж", [231] = "з", [232] = "и", [233] = "й", [234] = "к", [235] = "л", [236] = "м", [237] = "н", [238] = "о", [239] = "п", [240] = "р", [241] = "с", [242] = "т", [243] = "у", [244] = "ф", [245] = "х", [246] = "ц", [247] = "ч", [248] = "ш", [249] = "щ", [250] = "ъ", [251] = "ы", [252] = "ь", [253] = "э", [254] = "ю", [255] = "я",
}
function rusLower(s)
local strlen = s:len()
if strlen == 0 then
return s
end
s = s:lower()
local output = ""
for i = 1, strlen do
local ch = s:byte(i)
if ch >= 192 and ch <= 223 then -- upper russian characters
output = output .. russian_characters[ch + 32]
elseif ch == 168 then
output = output .. russian_characters[184]
else
output = output .. string.char(ch)
end
end
return output
end
function saveDB()
local configFile = io.open(linkConfig, "w")
configFile:write(encodeJson(db))
configFile:close()
end
function darkgreentheme()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
style.WindowPadding = imgui.ImVec2(8, 8)
style.WindowRounding = 6
style.ChildWindowRounding = 5
style.FramePadding = imgui.ImVec2(5, 3)
style.FrameRounding = 3.0
style.ItemSpacing = imgui.ImVec2(5, 4)
style.ItemInnerSpacing = imgui.ImVec2(4, 4)
style.IndentSpacing = 21
style.ScrollbarSize = 10.0
style.ScrollbarRounding = 13
style.GrabMinSize = 8
style.GrabRounding = 1
style.WindowTitleAlign = imgui.ImVec2(0.5, 0.5)
style.ButtonTextAlign = imgui.ImVec2(0.5, 0.5)
colors[clr.Text] = ImVec4(0.90, 0.90, 0.90, 1.00)
colors[clr.TextDisabled] = ImVec4(0.60, 0.60, 0.60, 1.00)
colors[clr.WindowBg] = ImVec4(0.08, 0.08, 0.08, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.10, 0.10, 0.10, 1.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 1.00)
colors[clr.Border] = ImVec4(0.70, 0.70, 0.70, 0.40)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.15, 0.15, 0.15, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.19, 0.19, 0.19, 0.71)
colors[clr.FrameBgActive] = ImVec4(0.34, 0.34, 0.34, 0.79)
colors[clr.TitleBg] = ImVec4(0.00, 0.69, 0.33, 0.80)
colors[clr.TitleBgActive] = ImVec4(0.00, 0.74, 0.36, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.69, 0.33, 0.50)
colors[clr.MenuBarBg] = ImVec4(0.00, 0.80, 0.38, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.16, 0.16, 0.16, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.00, 0.82, 0.39, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.00, 1.00, 0.48, 1.00)
colors[clr.ComboBg] = ImVec4(0.20, 0.20, 0.20, 0.99)
colors[clr.CheckMark] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.SliderGrab] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.00, 0.77, 0.37, 1.00)
colors[clr.Button] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.00, 0.82, 0.39, 1.00)
colors[clr.ButtonActive] = ImVec4(0.00, 0.87, 0.42, 1.00)
colors[clr.Header] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.HeaderHovered] = ImVec4(0.00, 0.76, 0.37, 0.57)
colors[clr.HeaderActive] = ImVec4(0.00, 0.88, 0.42, 0.89)
colors[clr.Separator] = ImVec4(1.00, 1.00, 1.00, 0.40)
colors[clr.SeparatorHovered] = ImVec4(1.00, 1.00, 1.00, 0.60)
colors[clr.SeparatorActive] = ImVec4(1.00, 1.00, 1.00, 0.80)
colors[clr.ResizeGrip] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.ResizeGripHovered] = ImVec4(0.00, 0.76, 0.37, 1.00)
colors[clr.ResizeGripActive] = ImVec4(0.00, 0.86, 0.41, 1.00)
colors[clr.CloseButton] = ImVec4(0.00, 0.82, 0.39, 1.00)
colors[clr.CloseButtonHovered] = ImVec4(0.00, 0.88, 0.42, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.00, 1.00, 0.48, 1.00)
colors[clr.PlotLines] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.PlotLinesHovered] = ImVec4(0.00, 0.74, 0.36, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.00, 0.69, 0.33, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(0.00, 0.80, 0.38, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.00, 0.69, 0.33, 0.72)
colors[clr.ModalWindowDarkening] = ImVec4(0.17, 0.17, 0.17, 0.48)
end
darkgreentheme()