local sampev = require 'samp.events'
local weapon = require 'game.weapons'
local bodyparts = {"Торс", "Пах", "Левая рука", "Правая рука", "Левая нога", "Правая нога", "Голова"}
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(100) end
while true do wait(0)
if last_damage then
if isKeyDown(18) and isKeyJustPressed(88) and not sampIsChatInputActive() and not sampIsDialogActive() then -- Alt + X
sampAddChatMessage(string.format("Последнее попадание: {CCCCCC}%s[%d] | %s | -%d HP | %s | %s", sampGetPlayerNickname(last_damage.playerid), last_damage.playerid, weapon.get_name(last_damage.weapon), math.round(last_damage.damage, 2), bodyparts[last_damage.bodypart - 2], os.date("%X")), 0xFF9000)
last_damage = nil
end
end
end
end
function sampev.onSendTakeDamage(playerid, damage, weapon, bodypart)
if sampIsPlayerConnected(playerid) then -- если урон получен от игрока
last_damage = {playerid = playerid, damage = damage, weapon = weapon, bodypart = bodypart}
end
end
math.round = function(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end