- 219
- 36
Из за моего скрипта на .lua крашит весь самп нахуй
помогите пжжпжпжп
помогите пжжпжпжп
Lua:
local encoding = require 'encoding'
encoding.default = 'CP1251'
local u8 = encoding.UTF8
local imgui = require('mimgui')
local faicons = require('fAwesome6')
local ffi = require('ffi')
local inicfg = require('inicfg')
local settings = inicfg.load({
script =
{
trueatools = false,
}}, 'atools.ini')
local new = imgui.new
local win = new.bool()
local win2 = new.bool()
local nakaz = new.bool()
local nakaz1 = new.bool()
local nakaz2 = new.bool()
local nakaz3 = new.bool()
local nakaz4 = new.bool()
local flags = imgui.WindowFlags
local trueatools = new.bool(settings.script.trueatools)
local inputidre = new.char[256]()
local inputgun = new.char[256]()
local inputidban = new.char[256]()
local inputdayban = new.char[256]()
local inputreasonban = new.char[256]()
local inputidkick = new.char[256]()
local inputdaykick = new.char[256]()
local inputreasonkick = new.char[256]()
local inputidmute = new.char[256]()
local inputdaymute = new.char[256]()
local inputreasonmute = new.char[256]()
local inputidjail = new.char[256]()
local inputdayjail = new.char[256]()
local inputreasonjail = new.char[256]()
local inputidwarn = new.char[256]()
local inputreasonwarn = new.char[256]()
local target = getCharPlayerIsTargeting(playerHandle)
local result, playerid = sampGetPlayerIdByCharHandle(PLAYER_PED)
imgui.OnFrame(function() return win[0] end, function(player)
imgui.Begin('A-Tools', win, flags.NoResize + flags.AlwaysAutoResize)
imgui.Text(faicons('user')..u8' Ваш ник: '..sampGetPlayerNickname(playerid))
if imgui.Checkbox(faicons('bug')..u8' Включить скрипт', trueatools) then
settings.script.trueatools = trueatools[0]
inicfg.save(settings, 'atools.ini')
end
imgui.Text(faicons('wrench')..u8' Настройки A-Tools внизу')
imgui.Separator()
imgui.Text(faicons('shuffle')..u8' Следить за игроком (Введите ID игрока в строчку ниже)')
imgui.InputText(u8'##1', inputidre, 256)
imgui.SameLine()
if imgui.Button(u8'Начать слежку') then
sampSendChat('/re '..ffi.string(inputidre))
win[0] = not win[0]
win2[0] = not win2[0]
end
imgui.SameLine()
if imgui.Button(u8'Прекратить слежку') then
sampSendChat('/reoff')
end
imgui.Separator()
imgui.Text(faicons('gun')..u8' Выдать себе оружие')
imgui.InputText(u8'##16', inputgun, 256)
imgui.SameLine()
if imgui.Button(u8"Выдать оружие себе") then
sampSendChat("/givegun "..playerid.." "..ffi.string(inputgun).." 500")
end
imgui.TextDisabled('by h0los')
imgui.End()
end)
imgui.OnFrame(function() return nakaz[0] end, function(player)
imgui.Begin(u8'BAN', nakaz, flags.NoResize + flags.AlwaysAutoResize)
imgui.Text(faicons('ban')..u8' Забанить игрока')
imgui.InputText(u8'##2', inputidban, 256)
imgui.SameLine()
imgui.InputText(u8'##3', inputdayban, 256)
imgui.SameLine()
imgui.InputText(u8'##4', inputreasonban, 256)
imgui.SameLine()
if imgui.Button(u8'Забанить') then
sampSendChat('/ban '..ffi.string(inputidban)..' '..ffi.string(inputdayban)..' '..ffi.string(inputreasonban))
end
imgui.End()
end)
imgui.OnFrame(function() return nakaz1[0] end, function(player)
imgui.Begin(u8'KICK', nakaz1, flags.NoResize + flags.AlwaysAutoResize)
imgui.Text(faicons('sickle')..u8' Кикнуть игрока')
imgui.InputText(u8'##5', inputidkick, 256)
imgui.SameLine()
imgui.InputText(u8'##6', inputdaykick, 256)
imgui.SameLine()
imgui.InputText(u8'##7', inputreasonkick, 256)
imgui.SameLine()
if imgui.Button(u8'Кикнуть') then
sampSendChat('/kick '..ffi.string(inputidkick)..' '..ffi.string(inputdaykick)..' '..ffi.string(inputreasonkick))
end
imgui.End()
end)
imgui.OnFrame(function() return nakaz2[0] end, function(player)
imgui.Begin(u8'JAIL', nakaz2, flags.NoResize + flags.AlwaysAutoResize)
imgui.Text(faicons('bong')..u8' Посадить игрока')
imgui.InputText(u8'##8', inputidjail, 256)
imgui.SameLine()
imgui.InputText(u8'##9', inputdayjail, 256)
imgui.SameLine()
imgui.InputText(u8'##10', inputreasonjail, 256)
imgui.SameLine()
if imgui.Button(u8'Посадить') then
sampSendChat('/jail '..ffi.string(inputidjail)..' '..ffi.string(inputdayjail)..' '..ffi.string(inputreasonjail))
end
imgui.End()
end)
imgui.OnFrame(function() return nakaz3[0] end, function(player)
imgui.Begin(u8'MUTE', nakaz3, flags.NoResize + flags.AlwaysAutoResize)
imgui.Separator()
imgui.Text(faicons('volume_slash')..u8' Замутить игрока')
imgui.InputText(u8'##13', inputidmute, 256)
imgui.SameLine()
imgui.InputText(u8'##14', inputdaymute, 256)
imgui.SameLine()
imgui.InputText(u8'##15', inputreasonmute, 256)
imgui.SameLine()
if imgui.Button(u8'Замутить') then
sampSendChat('/mute '..ffi.string(inputidmute)..' '..ffi.string(inputdaymute)..' '..ffi.string(inputreasonmute))
end
imgui.End()
end)
imgui.OnFrame(function() return nakaz4[0] end, function(player)
imgui.Begin(u8'WARN', nakaz4, flags.NoResize + flags.AlwaysAutoResize)
imgui.Text(faicons('bold')..u8' Заварнить игрока')
imgui.InputText(u8'##11', inputidwarn, 256)
imgui.SameLine()
imgui.InputText(u8'##12', inputreasonwarn, 256)
imgui.SameLine()
if imgui.Button(u8'Варн') then
sampSendChat('/warn '..ffi.string(inputidwarn)..' '..ffi.string(inputreasonwarn))
end
end)
imgui.OnFrame(function() return win2[0] end, function(player)
imgui.Begin(u8'Выдача наказаний', win2, flags.NoResize + flags.AlwaysAutoResize)
if imgui.Button(u8'Забанить') then
win2[0] = not win2[0]
nakaz[0] = not nakaz[0]
end
if imgui.Button(u8'Кикнуть') then
win2[0] = not win2[0]
nakaz1[0] = not nakaz1[0]
end
if imgui.Button(u8'Посадить') then
win2[0] = not win2[0]
nakaz2[0] = not nakaz2[0]
end
if imgui.Button(u8'Замутить') then
win2[0] = not win2[0]
nakaz3[0] = not nakaz3[0]
end
if imgui.Button(u8'Заварнить') then
win2[0] = not win2[0]
nakaz4[0] = not nakaz4[0]
end
imgui.End()
end)
function main()
sampRegisterChatCommand('atset', function() win[0] = not win[0] end)
while true do wait(0) end
end
imgui.OnInitialize(function()
imgui.GetIO().IniFilename = nil
local config = imgui.ImFontConfig()
config.MergeMode = true
config.PixelSnapH = true
iconRanges = imgui.new.ImWchar[3](faicons.min_range, faicons.max_range, 0)
imgui.GetIO().Fonts:AddFontFromMemoryCompressedBase85TTF(faicons.get_font_data_base85('solid'), 14, config, iconRanges)
end)