ajom
Well-known member
When I want to get all peds in a loop, I always loop through the Ped Pool using this FAMOUS method since they claim it to be faster than "looping opcode 0AE1":
This script uses a CPed bytemap with size of 140(0x0 upto 139*256)
But I sometime encounter an issue when after taking a 30 minutes playtime with a total of 300 players on my current server, not all peds can be detectd, until the time that the script fails to get any ped.
So I suspected that maybe the constant bytemap of 140 is the issue.
That is why I was wondering How we can calculate the exact bytemap size of the cped. I read this and this which says that 0xB74498 actually holds the maximum allowable ped count. But I believe this fact was wrong since 0xB74498 holds the Building Pool's Pointer.
Any thoughts how to get the exact bytemap size? I appreciate if anybody can demonstrate or share some memory offsets.
Code:
0A8D: 0@ = read_memory 0xB74490 size 4 virtual_protect 0
0@ += 4
0A8D: 0@ = read_memory 0@ size 4 virtual_protect 0
for 1@ = 0x0 to 8B00 step 0x100
0A8D: 2@ = read_memory 0@ size 1 virtual_protect 0
0@++
if and
2@ >= 0x00
2@ < 0x80
then
005A: 2@ += 1@ // got the ped
// do something...
end
end
But I sometime encounter an issue when after taking a 30 minutes playtime with a total of 300 players on my current server, not all peds can be detectd, until the time that the script fails to get any ped.
So I suspected that maybe the constant bytemap of 140 is the issue.
That is why I was wondering How we can calculate the exact bytemap size of the cped. I read this and this which says that 0xB74498 actually holds the maximum allowable ped count. But I believe this fact was wrong since 0xB74498 holds the Building Pool's Pointer.
Any thoughts how to get the exact bytemap size? I appreciate if anybody can demonstrate or share some memory offsets.