local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sett = imgui.ImBool(false)
local cmds = imgui.ImBuffer(512)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
imgui.ShowCursor = sett.v
imgui.Process = sett.v
if isKeyJustPressed(18) and isKeyJustPressed(2) then
validtar, pedtar = getCharPlayerIsTargeting(playerHandle)
if validtar and doesCharExist(pedtar) then
local result, id = sampGetPlayerIdByCharHandle(pedtar)
if result then
cmds.v = '/hi '..id...
да, тип того, но мне не нужен полный готовый скрипт.
Как сделать так, если нажимаешь ПКМ + альт, то вызывалась это окошко взаимодействий.
И как в этом окошке сделать простую команду, например /pay
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
if isKeyJustPressed(18) and isKeyJustPressed(2) then
validtar, pedtar = getCharPlayerIsTargeting(playerHandle)
if validtar and doesCharExist(pedtar) then
local result, id = sampGetPlayerIdByCharHandle(pedtar)
if result then
sampShowDialog(6405, "Сумма", "Введите сумму перевода", "Выбрать", "Отмена", 1) -- сам диалог
while sampIsDialogActive(6405) do wait(100) end -- ждёт пока вы ответите на диалог
local res, button, list, input = sampHasDialogRespond(6405)
if button == 1 then
if #input ~= 0 and input:find('%d+')then
sampSendChat('/c /pay '..id..' '..input)
elseif #input == 0 then
sampAddChatMessage('Вы нечего не ввели', 0xFF0000)
else
sampAddChatMessage('Слава что ты сделал', 0xFF0000)
end
else
sampAddChatMessage('Вы отменили перевод', 0xFF0000)
end
end
end
end
end
end
бл, я тупой /pay плохая команда,Lua:function main() if not isSampLoaded() or not isSampfuncsLoaded() then return end while not isSampAvailable() do wait(100) end while true do wait(0) if isKeyJustPressed(18) and isKeyJustPressed(2) then validtar, pedtar = getCharPlayerIsTargeting(playerHandle) if validtar and doesCharExist(pedtar) then local result, id = sampGetPlayerIdByCharHandle(pedtar) if result then sampShowDialog(6405, "Сумма", "Введите сумму перевода", "Выбрать", "Отмена", 1) -- сам диалог while sampIsDialogActive(6405) do wait(100) end -- ждёт пока вы ответите на диалог local res, button, list, input = sampHasDialogRespond(6405) if button == 1 then if #input ~= 0 and input:find('%d+')then sampSendChat('/c /pay '..id..' '..input) elseif #input == 0 then sampAddChatMessage('Вы нечего не ввели', 0xFF0000) else sampAddChatMessage('Слава что ты сделал', 0xFF0000) end else sampAddChatMessage('Вы отменили перевод', 0xFF0000) end end end end end end
бл, я тупой /pay плохая команда,
Крч, сорян, что туплю, но как, что бы вместо диалога высвечивалось окошко imgui например с командой /hi
если так можно то ответьте пжпжпжп
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sett = imgui.ImBool(false)
local cmds = imgui.ImBuffer(512)
cmds.v = '/hi'
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
imgui.ShowCursor = sett.v
imgui.Process = sett.v
if isKeyJustPressed(18) and isKeyJustPressed(2) then
validtar, pedtar = getCharPlayerIsTargeting(playerHandle)
if validtar and doesCharExist(pedtar) then
local result, id = sampGetPlayerIdByCharHandle(pedtar)
if result then
sett.v = true
end
end
end
end
end
function imgui.OnDrawFrame()
if sett.v then
imgui.Begin(u8'Окно а хули не окно?',sett, imgui.WindowFlags_AlwaysAutoResize) -- флаг авторазмера окна = imgui.WindowFlags_AlwaysAutoResize
if imgui.Button(u8'Активация') then
sampSendChat(u8:decode(cmds.v))
end imgui.SameLine()
imgui.InputText(u8'Вводить команду сюда', cmds)
imgui.End()
end
end
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local sett = imgui.ImBool(false)
local cmds = imgui.ImBuffer(512)
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
imgui.ShowCursor = sett.v
imgui.Process = sett.v
if isKeyJustPressed(18) and isKeyJustPressed(2) then
validtar, pedtar = getCharPlayerIsTargeting(playerHandle)
if validtar and doesCharExist(pedtar) then
local result, id = sampGetPlayerIdByCharHandle(pedtar)
if result then
cmds.v = '/hi '..id
sett.v = true
end
end
end
end
end
function imgui.OnDrawFrame()
if sett.v then
imgui.Begin(u8'Окно а хули не окно?',sett, imgui.WindowFlags_AlwaysAutoResize) -- флаг авторазмера окна = imgui.WindowFlags_AlwaysAutoResize
if imgui.Button(u8'Активация') then
sampSendChat(u8:decode(cmds.v))
end imgui.SameLine()
imgui.InputText(u8'Вводить команду сюда', cmds)
imgui.End()
end
end
Обязательно окно создавать для этого? Просто можно прямо в чате это сделать..Фак у меня такая же проблема, только другого характера. Есть где нибудь настраиваемый скрипт по работе адвоката? Например наводишь курсор на игрока, зажимаешь ПКМ+Q и автоматом вводится команда /free id игрока, и вам остается например в окно прописать сумму за освобождение и нажать Enter
-- Беск. цикл
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if valid and doesCharExist(ped) then
local result, id = sampGetPlayerIdByCharHandle(ped)
if result and isKeyJustPressed(VK_Q) then
sampSetChatInputText("/free "..id.." ")
sampSetChatInputEnabled(true)
end
end
а как ? Подбегаю к челу, навожу прицел ПКМ+Q и ничего не происходит. Я просто ваще ни капли не шарю че где настроить надо. готовый скрипт есть? В этих кодах который ты скинул я походу тоже нуб :DОбязательно окно создавать для этого? Просто можно прямо в чате это сделать..
Lua:-- Беск. цикл local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) if valid and doesCharExist(ped) then local result, id = sampGetPlayerIdByCharHandle(ped) if result and isKeyJustPressed(VK_Q) then sampSetChatInputText("/free "..id.." ") sampSetChatInputEnabled(true) end end
а как ? Подбегаю к челу, навожу прицел ПКМ+Q и ничего не происходит. Я просто ваще ни капли не шарю че где настроить надо. готовый скрипт есть? В этих кодах который ты скинул я походу тоже нуб :D
require "moonloader"
function main()
while not isSampAvailable() do wait(100) end
while true do wait(0)
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if valid and doesCharExist(ped) then
local result, id = sampGetPlayerIdByCharHandle(ped)
if result and isKeyJustPressed(VK_Q) then
sampSetChatInputText("/free "..id.." ")
sampSetChatInputEnabled(true)
end
end
end
end