how to catch random ped, car or object with a LUA code?
for example, in CLEO we can use this,
const ped = [email protected] end 0A8D: [email protected] = read_memory 0xB74490 size 4 virtual_protect 0 000A: [email protected] += 0x4 0A8D: [email protected] = read_memory [email protected] size 4 virtual_protect 0 for [email protected] = 0 to 35584 step 0x100 0A8D: ped = read_memory [email protected] size 1 virtual_protect 0 000A: [email protected] += 0x1 if and 0029: ped >= 0x00 001B: 0x80 > ped then 005A: ped += [email protected] if and 056D: actor ped defined 803C: not $PLAYER_ACTOR == ped // (int) then /// do something with ped end end end
and doing the same in LUA;
local mem = readMemory(0xB74490, 4, false) mem = mem + 0x4 mem = readMemory(mem, 4, false) local i for i = 0, 0x8B00, 0x100 do local ped = readMemory(mem, 1, false) mem = mem + 1 if ped >= 0x0 and ped < 0x80 then ped = ped + i if doesCharExist(ped) and playerPed ~= ped and ped ~= nil then -- Do something with ped end end end
it works fine ... but ... I do not know ... I think LUA must have another way of it, probably an easiest or better way ...
Can someone help me with that? thanks ..