- 283
- 90
Lua:
script_name('Namalsk Leader Helper')
script_author('Cort_Quwin')
script_version('0.1')
local hook = require 'lib.samp.events'
local imgui = require('imgui')
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local menu = 1
local window = imgui.ImBool(false)
function main()
while not isSampAvailable() do wait(200) end
wait(1000)
sampAddChatMessage("{e8a321}[Namalsk Leader's Helper]{ffffff} - Успешно загружен! ", -1)
sampAddChatMessage("{e8a321}[Namalsk Leader's Helper]{ffffff} - Автор: Cort_Quwin", -1)
sampRegisterChatCommand("zle", cmd_startt)
handle, id = sampGetPlayerIdByCharHandle(PLAYER_PED)
nick = sampGetPlayerNickname(id)
imgui.Process = false
if sampIsLocalPlayerSpawned() then
wait(7000)
sampSendChat('/stats')
return false
end
while true do
wait(0)
end
end
function cmd_startt()
window.v = not window.v
imgui.Process = window.v
end
local fontsize = nil
function imgui.BeforeDrawFrame()
if fontsize == nil then
fontsize = imgui.GetIO().Fonts:AddFontFromFileTTF(getFolderPath(0x14) .. '\\trebucbd.ttf', 30.0, nil, imgui.GetIO().Fonts:GetGlyphRangesCyrillic()) -- вместо 30 любой нужный размер
end
end
function imgui.CenterText(text)
imgui.SetCursorPosX(imgui.GetWindowSize().x / 2 - imgui.CalcTextSize(text).x / 2)
imgui.Text(text)
end
function imgui.OnDrawFrame()
if window.v then
local resX, resY = getScreenResolution()
local sizeX, sizeY = 650, 280 -- WINDOW SIZE (37)
imgui.SetNextWindowPos(imgui.ImVec2(resX / 2 - sizeX / 2, resY / 2 - sizeY / 2), imgui.Cond.FirstUseEver)
imgui.SetNextWindowSize(imgui.ImVec2(sizeX, sizeY), imgui.Cond.FirstUseEver)
imgui.Begin("text", window, imgui.WindowFlags.NoResize + imgui.WindowFlags.NoTitleBar)
imgui.PushFont(fontsize)
imgui.CenterText("Namalsk Leader's Helper")
imgui.PopFont()
imgui.BeginChild('##vkladki', imgui.ImVec2(160, 195), true)
if imgui.Button(u8'Ваш аккаунт', imgui.ImVec2(139, 40)) then
menu = 1
end
if imgui.Button(u8'Собеседования', imgui.ImVec2(139, 40)) then
menu = 2
end
if imgui.Button(u8'Лекции', imgui.ImVec2(139, 40)) then
menu = 3
end
if imgui.Button(u8'Прочее', imgui.ImVec2(139, 40)) then
menu = 4
end
imgui.EndChild()
imgui.SameLine()
imgui.BeginChild('##menushki', imgui.ImVec2(450, 195), true)
if menu == 1 then
end
if menu == 2 then
imgui.BeginChild('##voprosi', imgui.ImVec2(130, 180), true)
imgui.CenterText(u8'Вопросы')
imgui.Separator()
if imgui.Button(u8'Начало', imgui.ImVec2(110,20)) then
sampSendChat('Здравствуйте, Вы на собеседование ?')
end
if imgui.Button(u8'Паспорт', imgui.ImVec2(110,20)) then
sampSendChat('Я понял, дайте мне свой паспорт')
end
if imgui.Button(u8'Отыгровка', imgui.ImVec2(110,20)) then
sampSendChat('/me взял документ из рук человека напротив')
wait(1700)
sampSendChat('/do Паспорт в руках...')
wait(1700)
sampSendChat('/me осмотрел паспорт, зачем вернул человеку напротив')
end
imgui.EndChild()
end
if menu == 3 then
end
if menu == 4 then
imgui.NewLine()
imgui.CenterText(u8'автор скрипта: cort_quwin')
imgui.CenterText(u8'vk автора: vk.com/maksim04qa')
imgui.CenterText(u8'группа ВК: vk.com/quwin_cln')
end
imgui.EndChild()
if imgui.Button('close', imgui.ImVec2(50,20)) then
window.v = not window.v
imgui.Process = window.v
end
imgui.End()
end
end
function hook.OnShowDialog(dialogId, dialogStyle, dialogTitle, okButtonText, cancelButtonText, dialogText)
if dialogId == (171) and sampIsLocalPlayerSpawned() then
return false
end
end
function imgui.VerticalSeparator()
local p = imgui.GetCursorScreenPos()
imgui.GetWindowDrawList():AddLine(imgui.ImVec2(p.x, p.y), imgui.ImVec2(p.x, p.y + imgui.GetContentRegionMax().y), imgui.GetColorU32(imgui.GetStyle().Colors[imgui.Col.Separator]))
end
function imgui.TextColoredRGB(text)
local style = imgui.GetStyle()
local colors = style.Colors
local ImVec4 = imgui.ImVec4
local explode_argb = function(argb)
local a = bit.band(bit.rshift(argb, 24), 0xFF)
local r = bit.band(bit.rshift(argb, 16), 0xFF)
local g = bit.band(bit.rshift(argb, 8), 0xFF)
local b = bit.band(argb, 0xFF)
return a, r, g, b
end
local getcolor = function(color)
if color:sub(1, 6):upper() == 'SSSSSS' then
local r, g, b = colors[1].x, colors[1].y, colors[1].z
local a = tonumber(color:sub(7, 8), 16) or colors[1].w * 255
return ImVec4(r, g, b, a / 255)
end
local color = type(color) == 'string' and tonumber(color, 16) or color
if type(color) ~= 'number' then return end
local r, g, b, a = explode_argb(color)
return imgui.ImColor(r, g, b, a):GetVec4()
end
local render_text = function(text_)
for w in text_:gmatch('[^\r\n]+') do
local text, colors_, m = {}, {}, 1
w = w:gsub('{(......)}', '{%1FF}')
while w:find('{........}') do
local n, k = w:find('{........}')
local color = getcolor(w:sub(n + 1, k - 1))
if color then
text[#text], text[#text + 1] = w:sub(m, n - 1), w:sub(k + 1, #w)
colors_[#colors_ + 1] = color
m = n
end
w = w:sub(1, n - 1) .. w:sub(k + 1, #w)
end
if text[0] then
for i = 0, #text do
imgui.TextColored(colors_[i] or colors[1], u8(text[i]))
imgui.SameLine(nil, 0)
end
imgui.NewLine()
else imgui.Text(u8(w)) end
end
end
render_text(text)
end
function style()
imgui.SwitchContext()
local style = imgui.GetStyle()
local colors = style.Colors
local clr = imgui.Col
local ImVec4 = imgui.ImVec4
local ImVec2 = imgui.ImVec2
style.WindowRounding = 4.0
style.WindowTitleAlign = ImVec2(0.5, 0.5)
style.ChildWindowRounding = 2.0
style.FrameRounding = 2.0
style.ItemSpacing = ImVec2(10, 5)
style.ScrollbarSize = 15
style.ScrollbarRounding = 0
style.GrabMinSize = 9.6
style.GrabRounding = 1.0
style.WindowPadding = ImVec2(10, 10)
style.AntiAliasedLines = true
style.AntiAliasedShapes = true
style.FramePadding = ImVec2(5, 4)
style.DisplayWindowPadding = ImVec2(27, 27)
style.DisplaySafeAreaPadding = ImVec2(5, 5)
style.ButtonTextAlign = ImVec2(0.5, 0.5)
colors[clr.Text] = ImVec4(0.92, 0.92, 0.92, 1.00)
colors[clr.TextDisabled] = ImVec4(0.44, 0.44, 0.44, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.06, 0.06, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.ComboBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.51, 0.36, 0.15, 1.00)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.11, 0.11, 0.11, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.51, 0.36, 0.15, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.78, 0.55, 0.21, 1.00)
colors[clr.TitleBg] = ImVec4(0.51, 0.36, 0.15, 1.00)
colors[clr.TitleBgActive] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.MenuBarBg] = ImVec4(0.11, 0.11, 0.11, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.06, 0.06, 0.06, 0.53)
colors[clr.ScrollbarGrab] = ImVec4(0.21, 0.21, 0.21, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.47, 0.47, 0.47, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.81, 0.83, 0.81, 1.00)
colors[clr.CheckMark] = ImVec4(0.78, 0.55, 0.21, 1.00)
colors[clr.SliderGrab] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.Button] = ImVec4(0.51, 0.36, 0.15, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.ButtonActive] = ImVec4(0.78, 0.55, 0.21, 1.00)
colors[clr.Header] = ImVec4(0.51, 0.36, 0.15, 1.00)
colors[clr.HeaderHovered] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.HeaderActive] = ImVec4(0.93, 0.65, 0.14, 1.00)
colors[clr.Separator] = ImVec4(0.21, 0.21, 0.21, 1.00)
colors[clr.SeparatorHovered] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.SeparatorActive] = ImVec4(0.78, 0.55, 0.21, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.21, 0.21, 0.21, 1.00)
colors[clr.ResizeGripHovered] = ImVec4(0.91, 0.64, 0.13, 1.00)
colors[clr.ResizeGripActive] = ImVec4(0.78, 0.55, 0.21, 1.00)
colors[clr.CloseButton] = ImVec4(0.47, 0.47, 0.47, 1.00)
colors[clr.CloseButtonHovered] = ImVec4(0.98, 0.39, 0.36, 1.00)
colors[clr.CloseButtonActive] = ImVec4(0.98, 0.39, 0.36, 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(0.90, 0.70, 0.00, 1.00)
colors[clr.PlotHistogramHovered] = ImVec4(1.00, 0.60, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.26, 0.59, 0.98, 0.35)
colors[clr.ModalWindowDarkening] = ImVec4(0.80, 0.80, 0.80, 0.35)
end
style()
здравствуйте, в 105 строке есть РП отыгровка паспорта, но скрипт крашит. Как добавить сюда wait ?