script_name('CreamTools')
script_author('Shvchuk')
script_description('CreamTools 2.0')
require("lib.moonloader")
local event = require 'lib.samp.events'
local memory = require 'memory'
local sampev = require("lib.samp.events")
local imgui = require("imgui")
local encoding = require("encoding")
encoding.default = "CP1251"
u8 = encoding.UTF8
local tag = '[Cream Tools]: '
local label = 0
local main_color = 0xFDF4E3
local main_color_text = '{FDF4E3}'
local white_color = '{FFFFFF}'
local arr_str = {}
local mem = require "memory"
local text_buffer = imgui.ImBuffer(256)
local main_window_state = imgui.ImBool(false)
local checkbox_sprinthook = imgui.ImBool(false)
local checkbox_infinityrun = imgui.ImBool(false)
local checkbox_asp = imgui.ImBool(false)
local checkbox_asppp = imgui.ImBool(false)
local checkbox_bhop = imgui.ImBool(false)
local slider = imgui.ImFloat(0)
sprint = false
function main()
while not isSampAvailable() do wait(0) end
sampAddChatMessage(tag .. '{FFFFFF}Загружен.', 0xfae7b5)
sampAddChatMessage(tag .. '{FFFFFF}Активация - {fae7b5}/ctools', 0xfae7b5)
sampAddChatMessage(tag .. '{FFFFFF}Автор - {fae7b5}Shvchuk.', 0xfae7b5)
sampRegisterChatCommand("ctools", ctools)
imgui.Process = false
while true do
wait(0)
if main_window_state.v == false then
imgui.Process = false
end
end
end
function ctools()
main_window_state.v = not main_window_state.v
imgui.Process = main_window_state.v
end
function imgui.OnDrawFrame()
imgui.SetNextWindowPos(imgui.ImVec2(500, 350), imgui.Cond.FirstUseEver, imgui.ImVec2(0.0, 0.0))
imgui.SetNextWindowSize(imgui.ImVec2(640, 480), imgui.Cond.FirstUseEver)
imgui.Begin(u8'Cream Tools by Shvchuk 2.0', main_window_state)
imgui.Separator()
imgui.Text(u8'Взаимодействие с чатом')
imgui.InputText(u8'поле ввода', text_buffer)
if imgui.Button(u8' Сохранить в чате ') then
sampAddChatMessage(u8:decode(text_buffer.v), -7)
end
if imgui.Button(u8' Отправить в чат ') then
sampSendChat(u8:decode(text_buffer.v), -7)
end
if imgui.Button(u8' Очистить чат ') then
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
sampAddChatMessage(" ")
end
imgui.Separator()
imgui.Text(u8'Скрипты')
if imgui.Checkbox("Sprinthook", checkbox_sprinthook) then
sprint = not sprint
if checkbox_sprinthook.v then
sampAddChatMessage("{fae7b5}SprintHook - {50c878}activated")
lua_thread.create(function()
while true do
wait(0)
if sprint then
if isCharOnFoot(playerPed) and isKeyDown(0x10) and isKeyCheckAvailable() then
setGameKeyState(16, 256)
wait(10)
setGameKeyState(16, 0)
end
end
end
end)
else
sprint = false
sampAddChatMessage("{fae7b5}SprintHook - {ff2b2b}deactivated")
end
end
if imgui.Checkbox("Infinity Run", checkbox_infinityrun) then
if checkbox_infinityrun.v then
sampAddChatMessage("{fae7b5}Infinity Run - {50c878}activated")
lua_thread.create(function()
while true do
wait(0)
if isSampAvailable() then
mem.setint8(0xB7CEE4, 1)
end
end
end)
else
sampAddChatMessage("{fae7b5}Infinity Run - {ff2b2b}deactivated")
end
end
if imgui.Checkbox("Allow Bhop", checkbox_bhop) then
if checkbox_bhop.v then
sampAddChatMessage("{fae7b5}Allow Bhop - {50c878}activated")
else
sampAddChatMessage("{fae7b5}Allow Bhop - {ff2b2b}deactivated")
end
end
local q = require 'samp.events'
function q.onSendPlayerSync(data)
if checkbox_bhop.v then
if data.keysData == 40 or data.keysData == 42 then sendOnfootSync(); data.keysData = 32 end
end
end
function sendOnfootSync()
local _, myId = sampGetPlayerIdByCharHandle(PLAYER_PED)
local data = allocateMemory(68)
sampStorePlayerOnfootData(myId, data)
setStructElement(data, 4, 1, 0, false)
sampSendOnfootData(data)
freeMemory(data)
end
imgui.Separator()
imgui.Text(u8'Растяжка экрана')
if imgui.Checkbox("Aspect Ratio Pro", checkbox_asp) then
if checkbox_asp.v then
memory.fill(0x6FF452, 0x90, 6, true)
memory.setfloat(0xC3EFA4, 1, true)
else
memory.fill(0x6FF452, 0x90, 6, true)
memory.setfloat(0xC3EFA4, 1.3, true)
end
end
if imgui.Checkbox("Aspect Ratio Pro v2", checkbox_asppp) then
if checkbox_asppp.v then
memory.fill(0x6FF452, 0x90, 6, true)
memory.setfloat(0xC3EFA4, 0.831, true)
else
memory.fill(0x6FF452, 0x90, 6, true)
memory.setfloat(0xC3EFA4, 1.3, true)
end
end
imgui.SliderFloat("Aspect Ratio", slider, 0, 10)
if imgui.IsItemEdited() then
memory.fill(0x6FF452, 0x90, 6, true)
memory.setfloat(0xC3EFA4, 1, true)
end
imgui.End()
end
function isKeyCheckAvailable()
if not isSampLoaded() then
return true
end
if not isSampfuncsLoaded() then
return not sampIsChatInputActive() and not sampIsDialogActive()
end
return not sampIsChatInputActive() and not sampIsDialogActive() and not isSampfuncsConsoleActive()
end
function apply_custom_style()
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 = 15.0
style.FramePadding = ImVec2(5, 5)
style.ItemSpacing = ImVec2(12, 8)
style.ItemInnerSpacing = ImVec2(8, 6)
style.IndentSpacing = 25.0
style.ScrollbarSize = 15.0
style.ScrollbarRounding = 15.0
style.GrabMinSize = 15.0
style.GrabRounding = 7.0
style.ChildWindowRounding = 8.0
style.FrameRounding = 6.0
colors[clr.Text] = ImVec4(0.95, 0.96, 0.98, 1.00)
colors[clr.TextDisabled] = ImVec4(0.36, 0.42, 0.47, 1.00)
colors[clr.WindowBg] = ImVec4(0.11, 0.15, 0.17, 1.00)
colors[clr.ChildWindowBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.PopupBg] = ImVec4(0.08, 0.08, 0.08, 0.94)
colors[clr.Border] = ImVec4(0.43, 0.43, 0.50, 0.50)
colors[clr.BorderShadow] = ImVec4(0.00, 0.00, 0.00, 0.00)
colors[clr.FrameBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.FrameBgHovered] = ImVec4(0.12, 0.20, 0.28, 1.00)
colors[clr.FrameBgActive] = ImVec4(0.09, 0.12, 0.14, 1.00)
colors[clr.TitleBg] = ImVec4(0.09, 0.12, 0.14, 0.65)
colors[clr.TitleBgCollapsed] = ImVec4(0.00, 0.00, 0.00, 0.51)
colors[clr.TitleBgActive] = ImVec4(0.08, 0.10, 0.12, 1.00)
colors[clr.MenuBarBg] = ImVec4(0.15, 0.18, 0.22, 1.00)
colors[clr.ScrollbarBg] = ImVec4(0.02, 0.02, 0.02, 0.39)
colors[clr.ScrollbarGrab] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ScrollbarGrabHovered] = ImVec4(0.18, 0.22, 0.25, 1.00)
colors[clr.ScrollbarGrabActive] = ImVec4(0.09, 0.21, 0.31, 1.00)
colors[clr.ComboBg] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.CheckMark] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrab] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.SliderGrabActive] = ImVec4(0.37, 0.61, 1.00, 1.00)
colors[clr.Button] = ImVec4(0.20, 0.25, 0.29, 1.00)
colors[clr.ButtonHovered] = ImVec4(0.28, 0.56, 1.00, 1.00)
colors[clr.ButtonActive] = ImVec4(0.06, 0.53, 0.98, 1.00)
colors[clr.Header] = ImVec4(0.20, 0.25, 0.29, 0.55)
colors[clr.HeaderHovered] = ImVec4(0.26, 0.59, 0.98, 0.80)
colors[clr.HeaderActive] = ImVec4(0.26, 0.59, 0.98, 1.00)
colors[clr.ResizeGrip] = ImVec4(0.26, 0.59, 0.98, 0.25)
colors[clr.ResizeGripHovered] = ImVec4(0.26, 0.59, 0.98, 0.67)
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.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.25, 1.00, 0.00, 0.43)
colors[clr.ModalWindowDarkening] = ImVec4(1.00, 0.98, 0.95, 0.73)
end
apply_custom_style()