require "lib.moonloader"
function main()
if not isSampLoaded() or not isSampfuncsLoaded() then return end
while not isSampAvailable() do wait(2000) end
sampRegisterChatCommand('rheal', rheal)
while true do
wait(0)
end
end
function rheal()
local peds = getAllChars()
for _, v in pairs(peds) do
local result, myid = sampGetPlayerIdByCharHandle(playerPed)
local mx, my, mz = getCharCoordinates(playerPed)
local x, y, z = getCharCoordinates(v)
local distance = getDistanceBetweenCoords3d(mx, my, mz, x, y, z)
local result, id = sampGetPlayerIdByCharHandle(v)
if result and id ~= sampGetPlayerIdByCharHandle(PLAYER_PED) and distance < 12.0 then
if id ~= myid then
sampSendChat('/heal '..tonumber(id))
end
end
end
end