[SNIPPET] ForAllObjects

Example
PHP:
{$CLEO .cs}

0000:

REPEAT
IF 8256:   player $PLAYER_CHAR defined
THEN 0A93: end_custom_thread
END
WAIT 1500
UNTIL 0256:   player $PLAYER_CHAR defined    

WHILE TRUE
WAIT 0

IF 0256:   player $PLAYER_CHAR defined
THEN  
    0A8D: 29@ = read_memory 0xB7449C size 4 virtual_protect 0
    000A: 29@ += 0x4
    0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
    FOR 30@ = 0 TO 89344 step 0x100
        0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
        000A: 29@ += 0x1
        IF AND
            0029:  31@ >= 0x00
            001B:  0x80 > 31@
        THEN
            005A: 31@ += 30@    
            IF AND
            03CA:   object 31@ exists
            02CC:   object 31@ bounding_sphere_visible
            THEN    
                01BB: store_object 31@ position_to 1@ 2@ 3@
                0984: 30@ = object 31@ model
                0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 1@ Y 2@ Z 3@ store_screen_X_to 3@ Y_to 4@
                03F0: enable_text_draw 1
                0342: set_text_draw_centered 1 
                081C: draw_text_outline 1 RGBA 0 0 0 255 
                033F: set_text_draw_letter_size 0.3 1.0 
                0340: set_text_draw_RGBA 0 255 0 255 
                045A: draw_text_1number 3@ 4@ GXT 'NUMBER' number 0@
            END
        END
    END
END

END 

//0AB1: call_scm_func @getScreenXYFrom3DCoords 3 3D_coords_X 0@ Y 1@ Z 2@ store_screen_X_to 3@ Y_to 4@
:getScreenXYFrom3DCoords
0AA7: call_function 0x70CE30 num_params 6 pop 6 clipNear 1 clipFar 1 yMult 7@s xMult 6@s outVector 2@s inVector 0@s result 29@
0073: 2@ /= 6@
0073: 2@ /= 4@
0073: 3@ /= 7@
0073: 3@ /= 4@
2@ *= 640.0
3@ *= 448.0
0AB2: ret 2 2@ 3@

Snippet
PHP:
0AB1: @GetClosestObject 0 XYZ 0@ 1@ 2@ Model 3@
PHP:
:GetClosestObject
// 0AB1: @GetClosestObject 0 XYZ 0@ 1@ 2@ Model 3@
20@ = 9999.0
0A8D: 29@ = read_memory 0xB7449C size 4 virtual_protect 0
000A: 29@ += 0x4
0A8D: 29@ = read_memory 29@ size 4 virtual_protect 0
for 30@ = 0 to 89344 step 0x100
    0A8D: 31@ = read_memory 29@ size 1 virtual_protect 0
    000A: 29@ += 0x1
    if and
        0029:  31@ >= 0x00
        001B:  0x80 > 31@
    then
        005A: 31@ += 30@    
        if and
        03CA:   object 31@ exists
        02CC:   object 31@ bounding_sphere_visible
        then    
            0400: store_coords_to 4@ 5@ 6@ from_object 31@ with_offset 0.0 0.0 0.0
            if
            00DF:   actor $PLAYER_ACTOR driving
            then
                03C0: 1@ = actor $PLAYER_ACTOR car
                0407: store_coords_to 7@ 8@ 9@ from_car 1@ with_offset 0.0 0.0 0.0
            else
                04C4: store_coords_to 7@ 8@ 9@ from_actor $PLAYER_ACTOR with_offset 0.0 0.0 0.0
            end
            0509: 10@ = distance_between_XY 4@ 5@ and_XY 7@ 8@
            if
            0025:   20@ > 10@  // (float)
            then
                0087: 20@ = 10@ // (float)
                0984: 18@ = object 31@ model
                0400: store_coords_to 12@ 13@ 14@ from_object 31@ with_offset 0.0 0.0 0.0
                0087: 15@ = 12@ // (float)
                0087: 16@ = 13@ // (float)
                0087: 17@ = 14@ // (float)
                0085: 19@ = 18@ // (int)
            end
        end
    end
end 
0AB2: ret 4 15@ 16@ 17@ 19@
 
Last edited:
Top