script_name("Bones WallHack")
script_version("1.0")
script_author("Нейросеть")
local mem = require("memory")
local ffi = require("ffi")
local vkeys = require("vkeys")
local getBonePosition = ffi.cast("int (__thiscall*)(void*, float*, int, bool)", 0x5E4280)
local wh_active = false
local bones_active = true
local pref = "wh{ff0000} » {ffffff}"
function log(text) sampAddChatMessage(pref..tostring(text), -1) end
local BONE_IDS = {
{3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8},
{4, 51}, {51, 52}, {52, 53}, {53, 54},
{4, 41}, {41, 42}, {42, 43}, {43, 44},
{5, 31}, {31, 32}, {32, 33}, {33, 34},
{5, 21}, {21, 22}, {22, 23}, {23, 24}
}
local bone_colors = {
[1] = 0xFFFF0000,
[2] = 0xFFFF7F00,
[3] = 0xFFFFFF00,
[4] = 0xFF00FF00,
[5] = 0xFF00FFFF,
[6] = 0xFF0000FF,
[7] = 0xFF8B00FF,
[8] = 0xFFFF00FF,
[0] = 0xFFFFFFFF
}
function renderDrawPoint(x, y, size, color)
renderDrawBox(x - size/2, y - size/2, size, size, color)
end
function getBodyPartCoordinates(id, handle)
local pedptr = getCharPointer(handle)
if pedptr ~= 0 then
local bone_pos = ffi.new("float[3]")
local res = getBonePosition(ffi.cast("void*", pedptr), bone_pos, id, true)
if res then
return bone_pos[0], bone_pos[1], bone_pos[2]
end
end
return 0, 0, 0
end
function getDistanceBetweenPoints3D(x1, y1, z1, x2, y2, z2)
return math.sqrt((x2 - x1) ^ 2 + (y2 - y1) ^ 2 + (z2 - z1) ^ 2)
end
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then return end
while not isSampAvailable() do
wait(100)
end
sampRegisterChatCommand("wh", function()
wh_active = not wh_active
sSp = sampGetServerSettingsPtr()
if wh_active then
mem.setfloat(sSp + 39, 1200)
mem.setint8(sSp + 47, 0)
mem.setint8(sSp + 56, 1)
log("Включён")
else
mem.setfloat(sSp + 39, 25.5)
mem.setint8(sSp + 47, 1)
mem.setint8(sSp + 56, 1)
log("Выключен")
end
end)
sampRegisterChatCommand("bones", function()
bones_active = not bones_active
if bones_active then
log("Каркас игроков включён")
else
log("Каркас игроков выключен")
end
end)
log("Скрипт загружен | /wh - переключить ВХ | /bones - переключить каркас")
renderFont = renderCreateFont("Arial", 10, 4)
while true do
wait(0)
if wh_active and bones_active then
for i = 0, sampGetMaxPlayerId() do
if sampIsPlayerConnected(i) and i ~= select(2, sampGetPlayerIdByCharHandle(PLAYER_PED)) then
local result, ped = sampGetCharHandleBySampPlayerId(i)
if result and doesCharExist(ped) and isCharOnScreen(ped) then
local blueColor = 0x9000FFFF
local myX, myY, myZ = getCharCoordinates(PLAYER_PED)
local pedX, pedY, pedZ = getCharCoordinates(ped)
local processedPoints = {}
local extremityBones = {8, 24, 34, 44, 54}
for _, bonePair in ipairs(BONE_IDS) do
local bone1, bone2 = bonePair[1], bonePair[2]
local x1, y1, z1 = getBodyPartCoordinates(bone1, ped)
local x2, y2, z2 = getBodyPartCoordinates(bone2, ped)
local sx1, sy1 = convert3DCoordsToScreen(x1, y1, z1)
local sx2, sy2 = convert3DCoordsToScreen(x2, y2, z2)
if sx1 and sy1 and sx2 and sy2 then
renderDrawLine(sx1, sy1, sx2, sy2, 1.5, blueColor)
for _, extremityBone in ipairs(extremityBones) do
if bone1 == extremityBone and not processedPoints[bone1] then
renderDrawPoint(sx1, sy1, 4, blueColor)
processedPoints[bone1] = true
end
if bone2 == extremityBone and not processedPoints[bone2] then
renderDrawPoint(sx2, sy2, 4, blueColor)
processedPoints[bone2] = true
end
end
end
end
end
end
end
end
end
end
function onScriptTerminate(script, quitGame)
if script == thisScript() then
local sSp = sampGetServerSettingsPtr()
mem.setfloat(sSp + 39, 25.5)
mem.setint8(sSp + 47, 1)
mem.setint8(sSp + 56, 1)
end
end
function join_argb(a, r, g, b)
local argb = b
argb = bit.bor(argb, bit.lshift(g, 8))
argb = bit.bor(argb, bit.lshift(r, 16))
argb = bit.bor(argb, bit.lshift(a, 24))
return argb
end
function explode_argb(argb)
local a = bit.band(bit.rshift(argb, 24), 0xFF)
local r = bit.band(bit.rshift(argb, 16), 0xFF)
local g = bit.band(bit.rshift(argb, 8), 0xFF)
local b = bit.band(argb, 0xFF)
return a, r, g, b
end