Help what i do wrong here?

andrei345

New member
Joined
Aug 24, 2025
Messages
2
Reaction score
0
// CLEO + SAMPFUNCS 0.3.7 R1
// Toggle cu Z

{$CLEO .cs}
0000: NOP

// Variabile
10@ = 0 // AutoDrive ON/OFF
11@ = 0 // car handle
12@ = 0 // checkpoint activ
13@ = 0 // distanță
14@ = 0 // speed
15@ = 0 // timer pentru task

:MAIN
wait 0
if
0ADC: test_cheat "Z" // Toggle cu Z
then
if 10@ == 0
then
10@ = 1
0AF8: "AutoDrive ~g~ON" -1
else
10@ = 0
0AF8: "AutoDrive ~r~OFF" -1
05C9: clear_actor $PLAYER_ACTOR tasks
end
end

if
10@ == 1
then
// Verificăm dacă SAMPFUNCS e gata
if 0B2E: samp is_ready
then
if 00DF: actor $PLAYER_ACTOR driving
then
03C0: 11@ = actor $PLAYER_ACTOR car
0B2B: samp 12@ = is_current_checkpoint_active
if 12@ == 1
then
0B2C: samp get_current_checkpoint_pos_to 20@ 21@ 22@
00A0: store_actor $PLAYER_ACTOR position_to 30@ 31@ 32@
0509: 13@ = distance_between_XYZ 30@ 31@ 32@ and_XYZ 20@ 21@ 22@

// setăm viteză în funcție de distanță
if 13@ > 100.0
then 14@ = 22.2 // 80 km/h
else
if 13@ > 40.0
then 14@ = 16.6 // 60 km/h
else 14@ = 8.3 // 30 km/h
end

// dăm comanda de condus o dată la 2 secunde
if 15@ == 0
then
05D3: AS_actor $PLAYER_ACTOR drive_car 11@ to 20@ 21@ 22@ speed 14@ model_flags 0 0 0
15@ = 2000
end
end
end
end
end

if 15@ > 0
then
15@ -= 1
end

jump @MAIN
 

blvck0v

Active member
Joined
Feb 23, 2019
Messages
99
Reaction score
51
Location
ugbase.eu
An end was missing, i added a quote.
Also please take this example to learn a minimum of code formatting.

PHP:
// CLEO + SAMPFUNCS 0.3.7 R1
// Toggle cu Z

{$CLEO .cs}
0000: NOP

//variabiles
10@ = 0 // AutoDrive ON/OFF
11@ = 0 // car handle
12@ = 0 // checkpoint activ
13@ = 0 // distan?a
14@ = 0 // speed
15@ = 0 // timer pentru task

:MAIN
wait 0
if 0ADC: test_cheat "Z" // Toggle cu Z
then
    if 10@ == 0
    then
        10@ = 1
        0AF8: "AutoDrive ~g~ON" -1
    else
        10@ = 0
        0AF8: "AutoDrive ~r~OFF" -1
        05C9: clear_actor $PLAYER_ACTOR tasks
    end
end

if 10@ == 1
then
    // Verificam daca SAMPFUNCS e gata
    if 0B2E: samp is_ready
    then
        if 00DF: actor $PLAYER_ACTOR driving
        then
            
            03C0: 11@ = actor $PLAYER_ACTOR car
            0B2B: samp 12@ = is_current_checkpoint_active
            
            if 12@ == 1
            then
            
                0B2C: samp get_current_checkpoint_pos_to 20@ 21@ 22@
                00A0: store_actor $PLAYER_ACTOR position_to 30@ 31@ 32@
                0509: 13@ = distance_between_XYZ 30@ 31@ 32@ and_XYZ 20@ 21@ 22@
            
                // setam viteza în func?ie de distan?a
                if 13@ > 100.0
                then
                    14@ = 22.2 // 80 km/h
                else
                    if 13@ > 40.0
                    then
                        14@ = 16.6 // 60 km/h
                    else
                        14@ = 8.3 // 30 km/h
                    end
                end//this end was missing
            
                // dam comanda de condus o data la 2 secunde
                if 15@ == 0
                then
                    05D3: AS_actor $PLAYER_ACTOR drive_car 11@ to 20@ 21@ 22@ speed 14@ model_flags 0 0 0
                    15@ = 2000
                end
            end
        end
    end
end

if 15@ > 0
then
    15@ -= 1
end

jump @MAIN
 
Top