Загрузить файлы в «/»

version 1.1
This commit is contained in:
2025-10-30 23:10:11 +01:00
parent 65e3a21fa4
commit a5863b828b

View File

@@ -48,6 +48,8 @@ local player_data = {}
local mark_data = {}
local script_image
local killed_players = {}
local recent_textdraws = {}
local script_states = {
antiflood = false
@@ -68,7 +70,7 @@ local settings = inicfg.load({
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
killsay_variation = 0,
killsay_variation_custom = u8[[<5B><><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>]],
killsay_variation_custom = "",
killsay_distance = false,
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
@@ -296,17 +298,41 @@ local function sendRolePlay(nickname, id)
end
end
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local function killsay(id)
local x, y, z, nickname
local _, handle = sampGetCharHandleBySampPlayerId(id)
local function sampGetPlayerIdByNickname(nick)
for i = 0, 1003 do
if sampIsPlayerConnected(i) and sampGetPlayerNickname(i) == nick then
return i
end
end
return nil
end
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
local function killsay(nickname_or_id)
if script_states.antiflood then
return false
end
script_states.antiflood = true
local x, y, z, nickname, id
if type(nickname_or_id) == "number" then
id = nickname_or_id
if sampIsPlayerConnected(id) then
nickname = (sampGetPlayerNickname(id)):gsub("^%b[]", "")
end
else
nickname = nickname_or_id
id = sampGetPlayerIdByNickname(nickname)
end
local _, handle = sampGetCharHandleBySampPlayerId(id)
if _ then x, y, z = getCharCoordinates(handle) end
if sampIsPlayerConnected(id) then nickname = (sampGetPlayerNickname(id)):gsub("^%b[]", "") end
local px, py, pz = getCharCoordinates(PLAYER_PED)
if not (x and y and z and nickname) or x == "" or y == "" or z == "" or nickname == "" then
if not (x and y and z and nickname and id ~= nil) or x == "" or y == "" or z == "" or nickname == "" then
print("[" .. os.date("%H:%M:%S") .. "]: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
print("[" .. os.date("%H:%M:%S") .. "]: <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> / <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
return false
@@ -331,6 +357,8 @@ local function killsay(id)
sampSendChat("/fs ".. nickname .. "[" .. id .. "] <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>")
end
end
script_states.antiflood = false
end
local function centerColumnText(text)
@@ -597,20 +625,61 @@ function main()
sampRegisterChatCommand("killsay", function() imgui_states.window_state[0] = not imgui_states.window_state[0] end)
end
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
function sampev.onSendGiveDamage(id, damage, weaponid, bodypart)
if id ~= 65535 and sampGetPlayerHealth(id) - damage <= 0 and imgui_buffers.script_state[0] then
lua_thread.create(function()
wait(350)
if sampGetPlayerHealth(id) <= 0 and isCharDead(select(2, sampGetCharHandleBySampPlayerId(id))) and not script_states.antiflood then
script_states.antiflood = true
killsay(id)
script_states.antiflood = false
function sampev.onShowTextDraw(id, data)
if id == 2050 and data.text:find(".- %- .- %- KILL") then
local current_time = os.clock()
recent_textdraws[data.text] = current_time
lua_thread.create(function() wait(50)
if recent_textdraws[data.text] ~= current_time then
return
end
local current_text = sampTextdrawGetString(2050)
if current_text and current_text:match(".- %- .- %- KILL") then
local nick = current_text:match("([^%s]-) %-")
if nick and not killed_players[nick] then
killed_players[nick] = true
killsay(nick) wait(1500)
recent_textdraws[data.text] = nil
killed_players[nick] = nil
end
end
end)
end
end
function sampev.onPlayerDeathNotification(killer_id, victim_id)
if sampIsPlayerConnected(victim_id) then
local nick = sampGetPlayerNickname(victim_id)
if killer_id == select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) and not killed_players[nick] then
lua_thread.create(function()
killed_players[nick] = true
killsay(victim_id) wait(1500)
killed_players[nick] = nil
end)
end
end
end
function sampev.onSendGiveDamage(id, damage)
if sampIsPlayerConnected(id) then
local nick = sampGetPlayerNickname(id)
if id == 65535 or killed_players[nick] then return end
if sampGetPlayerHealth(id) - damage <= 0 then
lua_thread.create(function() wait(350)
local _, char = sampGetCharHandleBySampPlayerId(id)
if sampGetPlayerHealth(id) <= 0 and isCharDead(char) and not killed_players[nick] then
killed_players[nick] = true
killsay(id) wait(1500)
killed_players[nick] = nil
end
end)
end
end
end
-- <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
function sampev.onServerMessage(color, text)
if imgui_buffers.script_state[0] and imgui_buffers.use_mark[0] and text:find("^.+%[.*%]% {FFFFFF%}(.*)%[(.*)%]: DCHECKSEALKPOSX.+Y.+Z.+") then