- 85
- 18
Как сделать что бы функция срабатывала при iskeyjustpressed и включенном чекбоксе? С командой (SampRegisterChatcomand) смог а вот с кнопкой нет.
if check.v and isKeyJustPressed(VK_P) then
setCurrentCharWeapon(playerPed,0)
end
-- начало кода
local Checkbox = imgui.ImBool(false)
-- imgui
imgui.Checkbox(u8'Текст', Checkbox)
-- main
if Checkbox.v and isKeyJustPressed(клавиша) then
-- code
end
бесконечный цикл в main (после while true do wait(0))так а куда засунуть iskeyjustpressed?
Так что ли?Lua:while true do [/QUOTE] wait(0) if checked_test.v and isKeyJustPressed(VK_P) then sampAddChatMessage("Hello world", -1) end
Ну я так и сделал. Оно не работает. Есть может какое то видео по настройке такого? Или документация? Почитаю может пойму чеLua:if checked_test.v and isKeyJustPressed(VK_P) then sampAddChatMessage("Hello world", -1) end
скинь кодНу я так и сделал. Оно не работает. Есть может какое то видео по настройке такого? Или документация? Почитаю может пойму че
local key = require('vkeys')
local imgui = require('imgui')
local window = imgui.ImBool(false)
local check = imgui.ImBool(false)
function main()
repeat wait(0) until isSampAvailable()
while true do wait(0)
imgui.Process = window.v
if wasKeyPressed(key.VK_X) then window.v = not window.v end
if check.v and isKeyJustPressed(key.VK_P) then
sampAddChatMessage("Hello world", -1)
end
end
end
function imgui.OnDrawFrame()
if window.v then
imgui.Begin('My window', window)
imgui.Checkbox('text', check)
imgui.End()
end
end
Lua:local key = require('vkeys') local imgui = require('imgui') local window = imgui.ImBool(false) local check = imgui.ImBool(false) function main() repeat wait(0) until isSampAvailable() while true do wait(0) imgui.Process = window.v if wasKeyPressed(key.VK_X) then window.v = not window.v end if check.v and isKeyJustPressed(key.VK_P) then sampAddChatMessage("Hello world", -1) end end end function imgui.OnDrawFrame() if window.v then imgui.Begin('My window', window) imgui.Checkbox('text', check) imgui.End() end end
script_name('Weapon Helper')
require "lib.moonloader"
local hook = require 'lib.samp.events'
local imgui = require 'imgui'
local encoding = require 'encoding'
local key = require('vkeys')
encoding.default = 'CP1251'
u8 = encoding.UTF8
local main_window_state = imgui.ImBool(false)
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("checking", cmd_check)
sampAddChatMessage("{DAA520}[WP]{FFFFFF}: Weapon Helper for {008000}Trinity RP {FFFFFF}by {DAA520}Yar1kkk{FFFFFF} | Version: 2.0", -1)
sampAddChatMessage("{DAA520}[WP]{FFFFFF}: Активация по умолчанию: Z - Спрятать оружие, X - Достать оружие.", -1)
sampRegisterChatCommand("wpn", test)
imgui.Process = false
while true do
wait(0)
end
end
function test()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function BH_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 = ImVec2(15, 15)
style.WindowRounding = 6.0
style.FramePadding = ImVec2(5, 5)
style.FrameRounding = 4.0
style.ItemSpacing = ImVec2(12, 8)
style.ItemInnerSpacing = ImVec2(8, 6)
style.IndentSpacing = 25.0
style.ScrollbarSize = 15.0
style.ScrollbarRounding = 9.0
style.GrabMinSize = 5.0
style.GrabRounding = 3.0
colors[clr.Text] = ImVec4(0.80, 0.80, 0.83, 1.00)
colors[clr.TextDisabled] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.WindowBg] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.PopupBg] = ImVec4(0.07, 0.07, 0.09, 1.00)
colors[clr.Border] = ImVec4(0.80, 0.80, 0.83, 0.88)
colors[clr.BorderShadow] = ImVec4(0.92, 0.91, 0.88, 0.00)
colors[clr.FrameBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.TitleBg] = ImVec4(0.76, 0.31, 0.00, 1.00)
colors[clr.TitleBgCollapsed] = ImVec4(1.00, 0.98, 0.95, 0.75)
colors[clr.TitleBgActive] = ImVec4(0.80, 0.33, 0.00, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ScrollbarGrab] = ImVec4(0.80, 0.80, 0.83, 0.31)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ComboBg] = ImVec4(0.19, 0.18, 0.21, 1.00)
colors[clr.CheckMark] = ImVec4(1.00, 0.42, 0.00, 0.53)
colors[clr.SliderGrab] = ImVec4(1.00, 0.42, 0.00, 0.53)
colors[clr.SliderGrabActive] = ImVec4(1.00, 0.42, 0.00, 1.00)
colors[clr.Button] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.24, 0.23, 0.29, 1.00)
colors[clr.ButtonActive] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.Header] = ImVec4(0.10, 0.09, 0.12, 1.00)
colors[clr.HeaderHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.HeaderActive] = ImVec4(0.06, 0.05, 0.07, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.ResizeGripHovered] = ImVec4(0.56, 0.56, 0.58, 1.00)
colors[clr.ResizeGripActive] = ImVec4(0.06, 0.05, 0.07, 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.40, 0.39, 0.38, 0.63)
colors[clr.PlotLinesHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.PlotHistogram] = ImVec4(0.40, 0.39, 0.38, 0.63)
colors[clr.PlotHistogramHovered] = ImVec4(0.25, 1.00, 0.00, 1.00)
colors[clr.TextSelectedBg] = ImVec4(0.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
BH_theme()
local glock = imgui.ImBool(false)
local desert_eagle = imgui.ImBool(false)
local shotgun = imgui.ImBool(false)
local microsmg = imgui.ImBool(false)
local tec = imgui.ImBool(false)
local AK47 = imgui.ImBool(false)
local m4 = imgui.ImBool(false)
local rifle = imgui.ImBool(false)
local rpg = imgui.ImBool(false)
local armour = imgui.ImBool(false)
local sniperrifle = imgui.ImBool(false)
function main1()
sampRegisterChatCommand("checking", cmd_check)
end
function cmd_check()
if glock.v then
sampAddChatMessage("Glock-17", -1)
end
if desert_eagle.v then
sampAddChatMessage("DEAGLE", -1)
sampSendChat("/take deagle")
end
if shotgun.v then
sampAddChatMessage("PEREMOGA 3", -1)
sampSendChat("/take shotgun")
end
if microsmg.v then
sampAddChatMessage("PEREMOGA 4", -1)
sampSendChat("/take Micro")
end
if tec.v then
sampAddChatMessage("AK47", -1)
sampSendChat("/take ak47")
end
if AK47.v then
sampAddChatMessage("Tec-9", -1)
sampSendChat("/take tec")
end
if m4.v then
sampAddChatMessage("M4", -1)
sampSendChat("/take m4")
end
if rifle.v then
sampAddChatMessage("Rifle", -1)
sampSendChat("/take rifle")
end
if rpg.v then
sampAddChatMessage("RPG-7", -1)
sampSendChat("/take rpg")
end
if armour.v then
sampAddChatMessage("ARMOUR", -1)
sampSendChat("/take armour")
end
if sniperrifle.v then
sampAddChatMessage("SNIPER RIFLE", -1)
sampSendChat ("/take sniper")
end
end
function imgui.OnDrawFrame()
if main_window_state.v then
imgui.SetNextWindowSize(imgui.ImVec2(850, 450), imgui.Cond.FirstUseEver)
local sW, sH = getScreenResolution()
imgui.SetNextWindowPos(imgui.ImVec2(sW / 2, sH / 2), imgui.Cond.ImGuiCond_Always, imgui.ImVec2(0.5, 0.5))
imgui.Begin("Weapon Helper | Yar1kkk",main_window_state)
imgui.BeginChild('left pane', imgui.ImVec2(150, 0), true)
imgui.Text(u8"Пистолеты:")
imgui.Checkbox("Glock-17", glock)
imgui.Checkbox("Deagle", desert_eagle)
imgui.Checkbox("Micro SMG", microsmg)
imgui.Checkbox("TEC-9", tec)
imgui.EndChild()
imgui.SameLine(165)
imgui.SetCursorPos(imgui.ImVec2(185, 350))
imgui.BeginChild('left pane2', imgui.ImVec2(175,200), true)
imgui.Text(u8"Винтовки:")
imgui.Checkbox("AK-47", AK47)
imgui.Checkbox("M4", m4)
imgui.Checkbox("Rifle", rifle)
imgui.Checkbox("Sniper Rifle", sniper)
imgui.EndChild()
imgui.BeginChild('right pane', imgui.ImVec2(170,0), true)
imgui.Checkbox("RPG-7", rpg)
imgui.Checkbox("Armour", armour)
imgui.Checkbox("Shotgun", shotgun)
imgui.EndChild()
imgui.End()
end
end
Да я сам в шоке, мне просто нужно было что бы пряталось оружие которое выбирается через чекбоксы и прячется через кнопку P Я уже год делаю этот скриптНу хуй его знает
тут ток реанимация в помощь, ты все подряд намешал
Так а вообще реально такое сделать? Я надеюсь что ты понял о чем я, просто я плохо обьясняюНу хуй его знает
тут ток реанимация в помощь, ты все подряд намешал