- 41
- 3
- Версия MoonLoader
- .026-beta
Написал скрипт и не понимаю в чем проблема. После нескольких минут игры, скрипт перестает работать и выдает ошибку в консоли
Вот код самого скрипта, подскажите в чем может быть проблема
C:\gtawki\gta\moonloader\lib\rkeys.lua: in function <C:\gtawki\gta\moonloader\lib\rkeys.lua:89>
[23:12:11.038815] (error) Binder: Script died due to an error. (3C6D3FDC)
[23:12:11.038815] (error) Binder: Script died due to an error. (3C6D3FDC)
Вот код самого скрипта, подскажите в чем может быть проблема
Lua:
__name__ = "dhelper"
__version__ = "1.0"
__author__ = "nowlex"
require "lib.moonloader" -- подключение библиотеки moonloader
local samp = require 'samp.events'
local sampev = require 'lib.samp.events'
local keys = require "vkeys"
local wm = require 'lib.windows.message'
local mem = require "memory"
local samprak = require 'lib.samp.raknet'
local inicfg = require 'inicfg'
local settingsFile = 'dhelper.ini'
local ini = inicfg.load({
Bullet =
{
AmountPt=25
}
}, settingsFile)
if not doesFileExist('moonloader/config/'..settingsFile) then inicfg.save(ini, settingsFile) end
local rkeys = require 'rkeys'
local imgui = require "imgui"
local encoding = require "encoding"
encoding.default = "CP1251"
u8 = encoding.UTF8
local AmountPtInput = imgui.ImInt(ini.Bullet.AmountPt)
local show_amountpt_settings = imgui.ImBool(false)
imgui.ToggleButton = require('imgui_addons').ToggleButton
imgui.HotKey = require('imgui_addons').HotKey
imgui.Spinner = require('imgui_addons').Spinner
imgui.BufferingBar = require('imgui_addons').BufferingBar
local tLastKeys = {}
local ActiveClockMenu = {
v = decodeJson("[18,51]")
}
local main_window_state = imgui.ImBool(false)
check_status = imgui.ImBool(false)
check_status1 = imgui.ImBool(false)
local vkontakte = imgui.ImBool(false)
local dead = false
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand('dhelper',dhelper)
imgui.Process = false
bindClock = rkeys.registerHotKey(ActiveClockMenu.v, true, clockFunc)
wait(100)
sampAddChatMessage('{FF5656}[DHelper]: {FFFFFF}Загружен! {FF5656} Автор: Nowlex', -1)
while true do
wait(0)
if check_status.v then
if isCharDead(PLAYER_PED) and not dead then
wait(500)
sampSendChat('/us 15')
wait(1001)
sampSendChat('/us 15')
dead = true -- чтобы не флудило
elseif not isCharDead(PLAYER_PED) and dead then
dead = false
end
end
end
end
function sampev.onShowDialog(id, style, title, b1,b2,text)
if check_status1.v then
if title:find("{FFFFFF}Выход | {ae433d}Транспорт") then
sampSendDialogResponse(id, 1, 0)
lua_thread.create(function()
wait(300)
result, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
sampSendChat("/sellgun deagle " .. ini.Bullet.AmountPt .. " 5 " .. id)
end)
return false
end
end
end
function dhelper(arg)
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function theme()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
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.95, 0.96, 0.98, 1.00);
colors[clr.TextDisabled] = ImVec4(0.29, 0.29, 0.29, 1.00);
colors[clr.WindowBg] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.ChildWindowBg] = ImVec4(0.12, 0.12, 0.12, 1.00);
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94);
colors[clr.Border] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.BorderShadow] = ImVec4(1.00, 1.00, 1.00, 0.10);
colors[clr.FrameBg] = ImVec4(0.22, 0.22, 0.22, 1.00);
colors[clr.FrameBgHovered] = ImVec4(0.18, 0.18, 0.18, 1.00);
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00);
colors[clr.TitleBg] = ImVec4(0.14, 0.14, 0.14, 0.81);
colors[clr.TitleBgActive] = ImVec4(0.14, 0.14, 0.14, 1.00);
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51);
colors[clr.MenuBarBg] = ImVec4(0.20, 0.20, 0.20, 1.00);
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39);
colors[clr.ScrollbarGrab] = ImVec4(0.36, 0.36, 0.36, 1.00);
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00);
colors[clr.ScrollbarGrabActive] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.ComboBg] = ImVec4(0.24, 0.24, 0.24, 1.00);
colors[clr.CheckMark] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrab] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.SliderGrabActive] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.Button] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ButtonHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ButtonActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.Header] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.HeaderHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.HeaderActive] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.ResizeGrip] = ImVec4(1.00, 0.28, 0.28, 1.00);
colors[clr.ResizeGripHovered] = ImVec4(1.00, 0.39, 0.39, 1.00);
colors[clr.ResizeGripActive] = ImVec4(1.00, 0.19, 0.19, 1.00);
colors[clr.CloseButton] = ImVec4(0.40, 0.39, 0.38, 0.16);
colors[clr.CloseButtonHovered] = ImVec4(0.40, 0.39, 0.38, 0.39);
colors[clr.CloseButtonActive] = ImVec4(0.40, 0.39, 0.38, 1.00);
colors[clr.PlotLines] = ImVec4(0.61, 0.61, 0.61, 1.00);
colors[clr.PlotLinesHovered] = ImVec4(1.00, 0.43, 0.35, 1.00);
colors[clr.PlotHistogram] = ImVec4(1.00, 0.21, 0.21, 1.00);
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.18, 0.18, 1.00);
colors[clr.TextSelectedBg] = ImVec4(1.00, 0.32, 0.32, 1.00);
colors[clr.ModalWindowDarkening] = ImVec4(0.26, 0.26, 0.26, 0.60);
end
theme()
function imgui.OnDrawFrame()
if main_window_state.v == false then
imgui.Process = false
end
local sw, sh = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sw / 2, sh / 2), imgui.Cond.FirstUseEver, imgui.ImVec2(0.5, 0.5))
imgui.SetNextWindowSize(imgui.ImVec2(260, 150), imgui.Cond.FirstUseEver)
imgui.Begin("DHelper", main_window_state, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoCollapse)
imgui.Checkbox(u8"АвтоНарко после смерти", check_status)
imgui.Checkbox(u8"Крафт оружия при выходе с ДНК", check_status1)
imgui.Text(u8'Кол-во патрон для крафта')
if imgui.InputInt('##inputint0', AmountPtInput) then
ini.Bullet.AmountPt = AmountPtInput.v
inicfg.save(ini, settingsFile)
end
imgui.SameLine()
imgui.SetCursorPos(imgui.ImVec2(225, 120))
imgui.TextDisabled('Info')
if imgui.IsItemHovered() then
imgui.BeginTooltip()
imgui.PushTextWrapPos(450)
imgui.TextUnformatted('Author: '..__author__..'\nVersion: '..__version__)
imgui.PopTextWrapPos()
imgui.EndTooltip()
end
imgui.End()
end