require "lib.moonloader"
local memory = require 'memory'
function main()
while true do
wait(0)
if isKeyDown(VK_B) and isKeyJustPressed(VK_RBUTTON) then
RunC(50)
while isKeyDown(VK_B) do -- чтобы не спамилось куча патрон
wait(0)
end
end
end
end
function RunC(wt)
if not sampIsChatInputActive() and not isSampfuncsConsoleActive() then
if isWeaponReload() then
setVirtualKeyDown(VK_LBUTTON, true)
wait(wt)
setVirtualKeyDown(VK_LBUTTON, false)
setVirtualKeyDown(VK_RBUTTON, false)
setVirtualKeyDown(VK_C, true)
wait(wt)
setVirtualKeyDown(VK_C, false)
setVirtualKeyDown(VK_RBUTTON, true)
end
end
end
function getAmmoInClip()
local struct = getCharPointer(playerPed)
local prisv = struct + 0x0718
local prisv = memory.getint8(prisv, false)
local prisv = prisv * 0x1C
local prisv2 = struct + 0x5A0
local prisv2 = prisv2 + prisv
local prisv2 = prisv2 + 0x8
local ammo = memory.getint32(prisv2, false)
return ammo
end
function isWeaponReload()
modelId = getCharModel(PLAYER_PED)
weapon = getCurrentCharWeapon(PLAYER_PED)
ammo = getAmmoInClip()
if weapon == 24 then
if ammo == 0 then return false end
return true
end
return false
end