Quantcast

Jump to content

» «
Photo

[SA] Moonloader Code Help

1 reply to this topic
jayd00
  • jayd00

    Rat

  • Members
  • Joined: 24 May 2008

#1

Posted 17 October 2017 - 02:28 AM

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 ..


guru_guru
  • guru_guru

    pajaro culiao

  • Members
  • Joined: 22 Jul 2017
  • Chile

#2

Posted 17 October 2017 - 04:05 AM

table<Ped> chars = get_all_characters(float x, float y, float z, [float radius, bool skip_dead, bool sphere]) 

source





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users