CLEO Help HELP CHECKPOINT

CLEO related

curraco

Active member
Joined
Aug 3, 2020
Messages
39
Reaction score
3
Location
colombia
Hello, I took this cleo and changed it to go to the checkpoint but it has an error that sometimes goes crazy and starts to crash some solution?
Code:
{$CLEO .cs}

0000:



REPEAT
WAIT 0
UNTIL 0AFA:


WHILE TRUE
WAIT 0

IF 
00DF:   actor $PLAYER_ACTOR driving // i'm driving
THEN
    IF
    call @is_cp_active 0 
    THEN
        call @get_cp_pos 0 X 1@ Y 2@ Z 3@ // get the coords
        03C0: 4@ = actor $PLAYER_ACTOR car
        00AE: set_car 4@ traffic_behaviour_to 2 // AVOID CARS
        0423: set_car 4@ improved_handling_to 2.0
        00AD: set_car 4@ max_speed_to 76.0
        02C2: car 4@ drive_to 1@ 2@ 3@
        IF
        00EE:   actor $PLAYER_ACTOR sphere 0 near_point 1@ 2@ 3@ radius 1.0 1.0 in_car // radius you must do tests and change by yourself
        THEN
            0@ = TRUE // DISABLE CP CHECKING , ENABLE TIME CHECKER , ETC..
            072A: put_actor $PLAYER_ACTOR into_car 4@ driverseat  // DISABLE DRIVING
            32@ = 0 // reset timer , make sure it starts count only from now
        END
    END
END

IF AND
0@ == TRUE // timer enabled
32@ > 3000 // 3sec
THEN // you was stopped and 3sec passed.., he can start drive to next checkpoint.
    32@ = 0 // reset timer
    0@ = FALSE // ENABLE CP CHECK CHECKING , ETC...
END        

END



:is_cp_active
if 0AA2: 0@ = loadlib "samp.dll"
then 0A8E: 1@ = 0@ + 0x21A10C
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    1@ += 0x24
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    if 1@ == true
    then 0485:  return_true
    else 059A:  return_false
    end
    0AA3: freelib 0@
end
0AB2: ret 0

:get_cp_pos
if 0AA2: 0@ = loadlib "samp.dll"
then 0A8E: 1@ = 0@ + 0x21A10C
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    1@ += 0xC
    0A8D: 2@ = readMem 1@ sz 4 vp 0
    1@ += 0x4
    0A8D: 3@ = readMem 1@ sz 4 vp 0
    1@ += 0x4
    0A8D: 4@ = readMem 1@ sz 4 vp 0
    0AA3: freelib 0@
end
0AB2: ret 3 2@ 3@ 4@
@Parazitas
 
Last edited:

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,315
Solutions
7
Reaction score
937
Location
Lithuania
PHP:
{$CLEO .cs}

0000:

REPEAT
WAIT 1000
0A8D: 31@ = readMem 0xC8D4C0 sz 4 vp 0
UNTIL 31@ == 9 // SAMP_IS_READY

WHILE TRUE
WAIT 0

IF 0AB1: @IsActorInDriverSeat 0 // i'm driving
THEN
    IF 0@ == FALSE
    THEN
        IF 0AB1: @is_cp_active 0 
        THEN
            0AB1: @get_cp_pos 0 X 1@ Y 2@ Z 3@ // get the coords
            03C0: 4@ = actor $PLAYER_ACTOR car
            00AE: set_car 4@ traffic_behaviour_to 2 // AVOID CARS
            0423: set_car 4@ improved_handling_to 2.0
            00AD: set_car 4@ max_speed_to 76.0
            02C2: car 4@ drive_to 1@ 2@ 3@
            IF 00EE:   actor $PLAYER_ACTOR sphere 0 near_point 1@ 2@ 3@ radius 1.0 1.0 in_car // radius you must do tests and change by yourself
            THEN
                0@ = TRUE // DISABLE CP CHECKING , ENABLE TIME CHECKER , ETC..
                072A: put_actor $PLAYER_ACTOR into_car 4@ driverseat  // DISABLE DRIVING
                32@ = 0 // reset timer , make sure it starts count only from now
            END
        END
    END
END

IF AND
0@ == TRUE // timer enabled
32@ > 3000 // 3sec
THEN // you was stopped and 3sec passed.., he can start drive to next checkpoint.
    32@ = 0 // reset timer
    0@ = FALSE // ENABLE CP CHECK CHECKING , ETC...
END        

END

:IsActorInDriverSeat
{
    USE WITH >> IF STATEMENT:
    0AB1: @IsActorInDriverSeat 0
}
if
00DF:   actor $PLAYER_ACTOR in_car
then
    03C0: 0@ = actor $PLAYER_ACTOR car
    046C: 1@ = car 0@ driver
    if
    003B: 1@ == $PLAYER_ACTOR
    then
        0485:  return_true
    else
        059A:  return_false
    end
end
0AB2: ret 0

:is_cp_active
if 0AA2: 0@ = loadlib "samp.dll"
then 0A8E: 1@ = 0@ + 0x21A10C
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    1@ += 0x24
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    if 1@ == true
    then 0485:  return_true
    else 059A:  return_false
    end
    0AA3: freelib 0@
end
0AB2: ret 0

:get_cp_pos
if 0AA2: 0@ = loadlib "samp.dll"
then 0A8E: 1@ = 0@ + 0x21A10C
    0A8D: 1@ = readMem 1@ sz 4 vp 0
    1@ += 0xC
    0A8D: 2@ = readMem 1@ sz 4 vp 0
    1@ += 0x4
    0A8D: 3@ = readMem 1@ sz 4 vp 0
    1@ += 0x4
    0A8D: 4@ = readMem 1@ sz 4 vp 0
    0AA3: freelib 0@
end
0AB2: ret 3 2@ 3@ 4@
 
Top