The original was posted in Russian (on my PC) and also in Japanese on another site.
When getting actors, objects, cars, or whatever, there is a investing way of obtaining them. Usually the "simple" coder will use opcode 08E5 to get actors, but what about objects, etc? Here is a interesting way to get things.
Array index structure (ID) and the value stored in the SCM (Handle) in comparison with the rules,
the following equation remains true.
- Code:
Handle = ID * 256 + N (128> N ≧ 0)
This code gets the handle of all actors,
- Code:
for 28@ = 0 to 35584 step 256
0085: 26@ = 28@ // (int)
for 29@ = 0 to 127
if and
056D: actor 26@ defined
803C: not $PLAYER_ACTOR == 26@ // (int)
then
0321: kill_actor 26@
break
end
000A: 26@ += 1
end
end
it may require a little wait, because it's a big task for the game engine.
For example use this code:
- Code:
0A8D: 27@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 27@ += 0x4
0A8D: 27@ = read_memory 27@ size 4 virtual_protect 0
for 28@ = 0 to 35584 step 0x100
0A8D: 26@ = read_memory 27@ size 1 virtual_protect 0
000A: 27@ += 0x1
if and
0029: 26@ >= 0x00
001B: 0x80 > 26@
then
005A: 26@ += 28@ // (int)
if
803C: not $PLAYER_ACTOR == 26@ // (int)
then
0321: kill_actor 26@
end
end
end
This code will kill everyone, other than CJ. This included Carl's friends, peds walking the street, and scripted actors.
Here are some values, you may need to use, depending if you're getting a actor, vehicle or object.
- Code:
Peds: 35,584 = (maximum number of people (140) -1) * 0x100 · 0xB74490
Cars: 27,904 = (maximum number of vehicles (110) -1) * 0x100 · 0xB74494
Objects: 89,344 = (maximum number of objects (350) -1) * 0x100 · 0xB7449C
Here is an example script, this code will check if any vehicle is touching CJ's car, if it is, then that persons car who damaged CJ's new paint job gets blown up in his/her car.
- Code:
{$CLEO}
0000:
:Start
while true
wait 250
if
Player.Defined($PLAYER_CHAR)
then
if
Actor.Driving($PLAYER_ACTOR)
then
break
end
end
end
03C0: 30@ = actor $PLAYER_ACTOR car
:MainCheck
wait 0
0A8D: 4@ = read_memory 0xB74494 size 4 virtual_protect 0
000A: 4@ += 0x4
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
for 5@ = 0 to 27904 step 0x100
0A8D: 3@ = read_memory 4@ size 1 virtual_protect 0
000A: 4@ += 0x1
if and
0029: 3@ >= 0x00
001B: 0x80 > 3@
then
005A: 3@ += 5@ // (int)
if
8119: not car 3@ wrecked
then
for 31@ = 0 to 3
if
09CB: vehicle 3@ colliding_with_vehicle 30@
then
02AC: set_car 30@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
020B: explode_car 3@ // versionA
wait 200
02AC: set_car 30@ immunities BP 0 FP 0 EP 0 CP 0 MP 0
break
end
end
end
end
end
if
Actor.Driving($PLAYER_ACTOR)
then
jump @MainCheck
end
jump @Start
Also another one, if anyone touches CJ then they die (when if Death was to touch you), they do not even need to hit him. Type "CJDESTROYS" on your keyboard like a cheat code to activate.
- Code:
{$CLEO}
0000:
:Script01
wait 0
0006: 30@ = -229906
008B: 30@ = &0(30@,1i) // (int)
0085: 31@ = 30@ // (int)
0016: 31@ /= 65536
0012: 31@ *= 65536
0062: 30@ -= 31@ // (int)
if
0039: 30@ == 0x434A // CJ
jf @Script01
0006: 30@ = -229907
if
0038: &0(30@,1i) == 0x44455354 // DEST
jf @Script01
0006: 30@ = -229908
if
0038: &0(30@,1i) == 0x524F5953 // ROYS
jf @Script01
0004: &0(30@,1i) = 0x524F5900
03E5: show_text_box 'CHEAT1'
:Script03
wait 0
0006: 30@ = -229906
008B: 30@ = &0(30@,1i) // (int)
0085: 31@ = 30@ // (int)
0016: 31@ /= 65536
0012: 31@ *= 65536
0062: 30@ -= 31@ // (int)
if
0039: 30@ == 0x434A // CJ
jf @Script02
0006: 30@ = -229907
if
0038: &0(30@,1i) == 0x44455354 // DEST
jf @Script02
0006: 30@ = -229908
if
0038: &0(30@,1i) == 0x524F5953 // ROYS
jf @Script02
0004: &0(30@,1i) = 0x524F5900
03E5: show_text_box 'CHEAT8'
jump @Script01
:Script02
0A8D: 4@ = read_memory 0xB74490 size 4 virtual_protect 0
000A: 4@ += 0x4
0A8D: 4@ = read_memory 4@ size 4 virtual_protect 0
for 5@ = 0 to 35584 step 0x100
0A8D: 3@ = read_memory 4@ size 1 virtual_protect 0
000A: 4@ += 0x1
if and
0029: 3@ >= 0x00
001B: 0x80 > 3@
then
005A: 3@ += 5@ // (int)
if and
8118: not actor 3@ dead
803C: not $PLAYER_ACTOR == 3@ // (int)
then
for 31@ = 0 to 3
if
0A1B: actor 3@ colliding_with_actor $PLAYER_ACTOR
then
0223: set_actor 3@ health_to 0
break
end
end
end
end
end
jump @Script03