- 72
- 10
я чёто на коленке начиркал, боюсь, что это хуйня, и меня засрут как обычно
Lua:
Logs = {}
TargetId = 'nobody'
TargetPed = ''
ActiveHandDmg = false
Damage = 5.28
Delay = 400
Bypass = false
Damag = false
local ffi = require('ffi')
local sampev = require('lib.samp.events')
local sampfuncs = require('sampfuncs')
local raknet = require('samp.raknet')
local FontFlags = require('lib.moonloader').font_flag
local Font = renderCreateFont('Arial', 15, FontFlags.NONE)
function main()
while not isSampAvailable do wait(0) end
wait(1000)
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] {00B74A}Halo{FFFFFF}!', -1)
sampRegisterChatCommand('handdmg', function()
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] {00B74A}Help{FFFFFF}:', -1)
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] /handdmg.start - {00B74A}Turn off{FFFFFF}/{00B74A}on damager', -1)
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] /handdmg.setdamage - {00B74A}Set damage for damager {FFFFFF}({00B74A}Standart is {FFFFFF}5.28 {00B74A}damage{FFFFFF})', -1)
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] /handdmg.setdelay - {00B74A}Set delay for damager in milliseconds {FFFFFF}({00B74A}Standart is {FFFFFF}400{00B74A}ms{FFFFFF})', -1)
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] /handdmg.bp - {00B74A}Turn off{FFFFFF}/{00B74A}on ByPass for damager', -1)
end)
sampRegisterChatCommand('handdmg.start', function()
ActiveHandDmg = not ActiveHandDmg
end)
sampRegisterChatCommand('handdmg.bp', function()
Bypass = not Bypass
end)
sampRegisterChatCommand('handdmg.setdamage', function(dmg)
if tonumber(dmg) then
Damage = tonumber(dmg)
else
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] Incorrect float number{FFFFFF}!{00B74A} Please{FFFFFF},{00B74A} use /handdmg.setdamage {FFFFFF}<{00B74A}Float Value{FFFFFF}>!', -1)
end
end)
sampRegisterChatCommand('handdmg.setdelay', function(cd)
if tonumber(cd) then
Delay = tonumber(cd)
else
sampAddChatMessage('[{00B74A}HandDamager{FFFFFF}] Incorrect int number{FFFFFF}!{00B74A} Please{FFFFFF},{00B74A} use {FFFFFF}/handdmg.setdelay {FFFFFF}<{00B74A}Int Value{FFFFFF}>!', -1)
end
end)
lua_thread.create(function()
while true do
wait(0)
if ActiveHandDmg then
renderFontDrawText(Font, '{00B74A}Damage per {FFFFFF}'..Delay..'{00B74A}ms{FFFFFF}: '..Damage..'{00B74A}HP {FFFFFF}|| '..'{00B74A}HandDamager {FFFFFF}|| {00B74A}Discord{FFFFFF}: {00B74A}sop1 {FFFFFF}|| {00B74A}Status{FFFFFF}: {00B74A}ON '..(Bypass and '{FFFFFF}({00B74A}ByPass{FFFFFF})' or ''), 700, 230, 0xFFffffff, false)
if TargetId == 'nobody' then
renderFontDrawText(Font, '{00B74A}Target{FFFFFF}: {00B74A}nothing', 700, 255, 0xFFffffff, false)
else
renderFontDrawText(Font, '{00B74A}Target{FFFFFF}: {00B74A}'..sampGetPlayerNickname(tonumber(TargetId))..'{FFFFFF}[{00B74A}'..TargetId..'{FFFFFF}]', 700, 255, 0xFFffffff, false)
end
for v, k in pairs(Logs) do
renderFontDrawText(Font, k, 700, 270+v*25, 0xFFffffff, false)
end
end
end
end)
lua_thread.create(function()
while true do
wait(25)
if ActiveHandDmg and isKeyDown(VK_F2) and TargetId ~= 'nobody' then
local strr, peed = sampGetCharHandleBySampPlayerId(tonumber(TargetId))
if strr then
local x, y, z = getCharCoordinates(peed)
setCharCoordinates(PLAYER_PED, x, y, z-1)
end
end
end
end)
while true do
wait(0)
if #Logs > 4 then
Logs = {}
end
if ActiveHandDmg then
local xxx,yyy,zzz = getCharCoordinates(PLAYER_PED)
local res, ped = findAllRandomCharsInSphere(xxx,yyy,zzz,3,false,true)
if res then
local res, id = sampGetPlayerIdByCharHandle(ped)
if not sampIsPlayerPaused(id) and sampIsPlayerConnected(id) then
TargetId = tostring(id)
TargetPed = ped
if Bypass then
Damag = true
else
sampSendGiveDamage(tonumber(TargetId), Damage, 0, 3)
local newhp = sampGetPlayerHealth(tonumber(TargetId))
local newarm = sampGetPlayerArmor(tonumber(TargetId))
table.insert(Logs, '+ {00B74A}Sent damage request to '..sampGetPlayerNickname(tonumber(TargetId))..'{FFFFFF}[{00B74A}'..TargetId..'{FFFFFF}] {00B74A}ARM{FFFFFF}: '..newarm..'{FFFFFF}/100 {00B74A}HP{FFFFFF}: '..newhp..'{FFFFFF}/100')
end
wait(Delay)
end
else
TargetId = 'nobody'
TargetPed = nil
end
else
renderFontDrawText(Font, '{00B74A}Damage per {FFFFFF}'..Delay..'{00B74A}ms{FFFFFF}: '..Damage..'{00B74A}HP {FFFFFF}|| '..'{00B74A}HandDamager {FFFFFF}|| {00B74A}Discord{FFFFFF}: {00B74A}sop1 {FFFFFF}|| {00B74A}Status{FFFFFF}: {00B74A}OFF '..(Bypass and '{FFFFFF}({00B74A}ByPass{FFFFFF})' or ''), 700, 230, 0xFFffffff, false)
end
end
end
function sampev.onSendPlayerSync(data)
if Damag then
Damag = false
local xxx,yyy,zzz = getCharCoordinates(PLAYER_PED)
local x,y,z = getCharCoordinates(tonumber(TargetPed))
data.keys.aim = 1
data.keys.secondaryFire_shoot = 1
lua_thread.create(function()
canShoot = false
local data = ffi.new('struct BulletSyncData', {})
local data2 = tonumber(ffi.cast('uintptr_t', ffi.new('struct BulletSyncData*', data)))
local func_send = function()
local bs = raknetNewBitStream()
raknetBitStreamWriteInt8(bs, raknet.PACKET.BULLET_SYNC)
raknetBitStreamWriteBuffer(bs, data2, ffi.sizeof(data))
raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
raknetDeleteBitStream(bs)
end
local s = setmetatable({send = func_send}, {__index = function(t, i) return data[i] end})
s.targetType = 1
s.targetId = id
s.center = {x = 11, y = 12, z = 13}
s.origin = {x = xxx, y = yyy, z = zzz}
s.target = {x = x, y = y, z = z}
s.weaponId = 0
s.send()
if sampIsPlayerConnected(tonumber(TargetId)) then
sampSendGiveDamage(tonumber(TargetId), Damage, 0, 3)
local newhp = sampGetPlayerHealth(tonumber(TargetId))
local newarm = sampGetPlayerArmor(tonumber(TargetId))
table.insert(Logs, '+ [{00B74A}ByPass{FFFFFF}] {00B74A}Sent damage request to '..sampGetPlayerNickname(tonumber(TargetId))..'{FFFFFF}[{00B74A}'..TargetId..'{FFFFFF}] {00B74A}ARM{FFFFFF}: '..newarm..'{FFFFFF}/100 {00B74A}HP{FFFFFF}: '..newhp..'{FFFFFF}/100')
end
Damag = false
end)
end
end