require "lib.moonloader"
require 'lib.vkeys'
local imgui = require 'imgui'
local encoding = require 'encoding'
encoding.default = 'CP1251'
u8 = encoding.UTF8
local main_window_state = imgui.ImBool(false)
sms = sampAddChatMessage
local Player_ID = -1
function imgui.OnDrawFrame()
if main_window_state.v then
imgui.SetNextWindowPos(imgui.ImVec2(50,350)) --местополож
imgui.SetNextWindowSize(imgui.ImVec2(150, 100), imgui.Cond.FirstUseEver)--размер
imgui.ShowCursor = false
imgui.Begin('My window', main_window_state)
if imgui.Button(u8('Цель '..Player_ID..'?')) then
sms('id '..Player_ID,-1)
end
imgui.End()
end
end
function main()
sampRegisterChatCommand('cdd', function()main_window_state.v = not main_window_state.v end)
while true do wait(0)
if isKeyDown(VK_RBUTTON) then
local result, ped = getCharPlayerIsTargeting(PLAYER_HANDLE)
if result and doesCharExist(ped) then
local success, id = sampGetPlayerIdByCharHandle(ped)
if success then
local pname = sampGetPlayerNickname(id)
local pscore = sampGetPlayerScore(id)
Player_ID = id
main_window_state.v = true
end
end
end
imgui.Process = main_window_state.v
end
end