- 130
- 39
- Версия MoonLoader
- .026-beta
Всем добрый вечер, я написал код на биндер, но у меня что-то не получилось и в moonloader.log выводить ошибку и не работает биндер.
Помогите пожалуйста, просто там ошибка какая то необычная :)
Вот сам говнокод биндера:
Оставляю сам скрипт и moonloader.log:
Помогите пожалуйста, просто там ошибка какая то необычная :)
Вот сам говнокод биндера:
Lua:
------------------------------------------------
function updatechatcommands()
for i, binder_slot in pairs(binderIni.BindsName) do
if tostring(binder_slot) == tostring(binderIni.BindsName[i]) then
if binderIni.BindsCmd[i] ~= '' then
sampUnregisterChatCommand(binderIni.BindsCmd[i])
sampRegisterChatCommand(binderIni.BindsCmd[i], function()
if not inprocess then
local temp = 0
local temp2 = 0
for bp in tostring(binderIni.BindsAction[i]):gmatch('[^~]+') do
temp = temp + 1
end
lua_thread.create(function()
inprocess = true
for bp in tostring(binderIni.BindsAction[i]):gmatch('[^~]+') do
temp2 = temp2 + 1
sampSendChat(tostring(bp))
if temp2 ~= temp then
wait(binderIni.BindsDelay[i])
end
end
inprocess = false
end)
else
acm('Не торопитесь, вы уже отыгрываете что-то!')
end
end)
end
end
end
end
------------------------------------------------
-- Начало меню биндера --
function imgui.Window_Binder()
imgui.BeginChild("Binder_Slots", imgui.ImVec2(100, -1),true)
if i == nil then
for i = 1, binder_slot do
if imgui.Selectable(u8"Слот № " ..i) then
z = i
binder_settings = true
bindersettings.binderbuff.v = ''
bindersettings.bindername.v = ''
bindersettings.bindertype.v = 0
bindersettings.bindercmd.v = ''
binderkeystatus = nil
bindersettings.binderdelay.v = ''
updatechatcommands()
end
end
else
for i = 1, binder_slot do
if imgui.Selectable(u8(binderIni.BindsName[i])) then
z = i
bindersettings.binderbuff.v = u8(binderIni.BindsAction[i]):gsub('~', '\n')
bindersettings.bindername.v = u8(binderIni.BindsName[i])
bindersettings.bindertype.v = u8(binderIni.BindsType[i])
bindersettings.bindercmd.v = u8(binderIni.BindsCmd[i])
binderkeystatus = u8(binderIni.BindsKeys[i])
bindersettings.binderdelay.v = u8(binderIni.BindsDelay[i])
end
end
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild("binder_settings", imgui.ImVec2(-1,-1), true)
if binder_settings then
imgui.SameLine(165)
if binderIni.BindsName.v == nil then
imgui.Text(u8"Вы редактируете слот под номером: " ..z)
else
imgui.Text(u8"Вы редактируете слот под название: " ..mainIni.BindsName)
end
imgui.Text(u8"Название биндера: ") imgui.SameLine() imgui.PushItemWidth(250) imgui.InputText('##bindersettings.bindername', bindersettings.bindername)
imgui.Text(u8"Задержка:") imgui.SameLine() imgui.PushItemWidth(50) imgui.InputText('##bindersettings.binderdelay', bindersettings.binderdelay, imgui.InputTextFlags.CharsDecimal) imgui.SameLine() imgui.Text(u8'Сек')
if tonumber(bindersettings.binderdelay.v) and tonumber(bindersettings.binderdelay.v) > 60000 then
bindersettings.binderdelay.v = '60000'
elseif tonumber(bindersettings.binderdelay.v) and tonumber(bindersettings.binderdelay.v) < 1 then
bindersettings.binderdelay.v = '1'
end
imgui.Text(u8"Команда: ") imgui.SameLine() imgui.Text("/") imgui.SetCursorPos(imgui.ImVec2(95, 88)) imgui.PushItemWidth(100) imgui.InputText('##bindersettings.bindercmd',bindersettings.bindercmd,imgui.InputTextFlags.CharsNoBlank)
imgui.PopItemWidth()
imgui.SetCursorPos(imgui.ImVec2(3, 115))
imgui.InputTextMultiline(u8'',bindersettings.binderbuff, imgui.ImVec2(664,200))
local kei
local doreplace = false
if bindersettings.binderbuff.v ~= '' and bindersettings.bindername.v ~= '' and bindersettings.binderdelay.v ~= '' and bindersettings.bindertype.v ~= nil then
if imgui.Button(u8"Сохранить", imgui.ImVec2(150,25)) then
if not inprocess then
if bindersettings.bindertype.v == 0 then
if bindersettings.bindercmd.v ~= '' and bindersettings.bindercmd.v ~= nil then
for i, binder_slot in pairs(binderIni.BindsName) do
if tostring(u8:decode(bindersettings.bindername.v)) == tostring(binder_slot) then
sampUnregisterChatCommand(binderIni.BindsCmd[i])
doreplace = true
kei = i
end
end
if doreplace then
local refresh_text = u8:decode(bindersettings.binderbuff.v):gsub('\n', '~')
binderIni.BindsName[kei] = u8:decode(bindersettings.bindername.v)
binderIni.BindsAction[kei] = refresh_text
binderIni.BindsDelay[kei] = u8:decode(bindersettings.binderdelay.v)
binderIni.BindsType[kei]= u8:decode(bindersettings.bindertype.v)
binderIni.BindsCmd[kei] = u8:decode(bindersettings.bindercmd.v)
binderIni.BindsKeys[kei] = ''
if inicfg.save(binderIni, 'PoliceHelper/binder_settings.ini') then
acm('Бинд успешно сохранён!')
setbinderkey = false
keyname = nil
keyname2 = nil
bindersettings.bindercmd.v = ''
bindersettings.binderbuff.v = ''
bindersettings.bindername.v = ''
bindersettings.bindertype.v = 0
bindersettings.binderdelay.v = ''
bindersettings.bindercmd.v = ''
binderkeystatus = nil
binder_slot = i
end
else
local refresh_text = u8:decode(bindersettings.binderbuff.v):gsub('\n', '~')
table.insert(binderIni.BindsName, u8:decode(bindersettings.bindername.v))
table.insert(binderIni.BindsAction, refresh_text)
table.insert(binderIni.BindsDelay, u8:decode(bindersettings.binderdelay.v))
table.insert(binderIni.BindsType, u8:decode(bindersettings.bindertype.v))
table.insert(binderIni.BindsCmd, u8:decode(bindersettings.bindercmd.v))
table.insert(binderIni.BindsKeys, '')
if inicfg.save(binderIni, 'PoliceHelper/binder_settings.ini') then
acm('Бинд успешно создан!')
setbinderkey = false
keyname = nil
keyname2 = nil
bindersettings.bindercmd.v = ''
bindersettings.binderbuff.v = ''
bindersettings.bindername.v = ''
bindersettings.bindertype.v = 0
bindersettings.binderdelay.v = ''
bindersettings.bindercmd.v = ''
binderkeystatus = nil
binder_slot = i
end
end
else
acm('Вы неправильно указали команду бинда!')
end
end
updatechatcommands()
else
acm('Вы не можете взаимодействовать с биндером во время любой отыгровки!')
end
end
end
end
imgui.EndChild()
end
-- Конец меню биндера --
()
Вложения
Последнее редактирование: