CLEO Help Drive to race checkpoint

CLEO related
Status
Not open for further replies.

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
So the process of this job is the followng:
- get into bus, your checkpoint will appear
- drive to checkpoint
- when you arrive to checkpoint it says 'Please stop in the checkpoint.'
- After 2-3 sec the current checkpoint will disappear and another one will appear.
This process is repeated again and again for all checkpoints. I have tried to make this script. Everything works surprisingly perfect but there's one problem... The speed isn't right. When it's supposed to accelerate it only accelerates 0.0025 samp speed (server speed 1/2km/h). I'm not totally sure what's wrong with the code so if someone could help that'd be amazing. Thank you in advance.
 

Attachments

  • JobBOT.cs
    20.8 KB · Views: 68

Parazitas

God
Staff member
Joined
Jan 2, 2017
Messages
3,161
Solutions
5
Reaction score
894
Location
Lithuania
Modified
PHP:
{$CLEO .cs}

0000:

THREAD "JobBOT"

REPEAT
WAIT 0
UNTIL 0AFA:

0B34: "jobbot" @jobbot // on / off command
0B34: "killcs" @killcs // close script from game so i don't have to relog

WHILE TRUE
WAIT 0

IF AND
30@ == TRUE // /jobbot > on
00DF:   actor $PLAYER_ACTOR driving // i'm driving
THEN
    IF AND
    0@ == FALSE
    0AB1: @is_racecp_active 0 // is race checkpoint active
    THEN
        0AB1: @get_racecp_pos 0 1@ 2@ 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@ 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

:jobbot  // on / off command
IF 30@ == FALSE
THEN
    30@ = TRUE
    chatmsg "{cecece}[JobBot]: Mod ON!" -1
ELSE
    30@ = FALSE
    chatmsg "{cecece}[JobBot]: Mod OFF!" -1
END
SAMP.CmdRet()

:is_racecp_active
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 0x21A10C
0A8D: 1@ = readMem 1@ sz 4 vp 0
1@ += 0x49
0A8D: 1@ = readMem 1@ sz 4 vp 0
IF 1@ == TRUE
THEN 0485:  return_true
ELSE 059A:  return_false
END
0AA3: freelib 0@
0AB2: ret 0

:get_racecp_pos
0AA2: 0@ = loadlib "samp.dll"
0A8E: 1@ = 0@ + 0x21A10C
0A8D: 1@ = readMem 1@ sz 4 vp 0
1@ += 0x2C
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@
0AB2: ret 3 2@ 3@ 4@

:killcs // cancel mod from game
SAMP.IsCommandTyped(20@)
004E: end_thread
SAMP.CmdRet()
 
Last edited:

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
It works just fine but the problem is when it reaches the checkpoint, it suddenly goes right and just.. gets stuck in buildings..
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
@To OP/anyone else, sorry but I also liked this idea and I tried using this cleo.

It works so good but it only works for racing checkpoints like you said (like the checkpoints that have an arrow in them).
There also exists normal red checkpoints/markers (without any arrows), like the use in RP servers, it didn't work there (HZRP). Any idea why? Is this because its programmed only for the race race checkpoint and not red markers? Anyone can change that please?
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
@To OP/anyone else, sorry but I also liked this idea and I tried using this cleo.

It works so good but it only works for racing checkpoints like you said (like the checkpoints that have an arrow in them).
There also exists normal red checkpoints/markers (without any arrows), like the use in RP servers, it didn't work there (HZRP). Any idea why? Is this because its programmed only for the race race checkpoint and not red markers? Anyone can change that please?
Yea, i only did it for race checkpoints
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,700
Reaction score
106
How can I change it to the red markers in RP servers?
Checkpoint.cs although it doesn't actually work well as it doesn't stop even when you arrive at destination and it can't do long distances and some destinations it can't reach (like truckyards) it's just the nature of the opcodes it uses.
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
Checkpoint.cs although it doesn't actually work well as it doesn't stop even when you arrive at destination and it can't do long distances and some destinations it can't reach (like truckyards) it's just the nature of the opcodes it uses.
I guess you could hardly solve this with coords but its very difficult and hard to think..
 

Zin

Expert
Joined
Aug 1, 2013
Messages
1,700
Reaction score
106
I guess you could hardly solve this with coords but its very difficult and hard to think..
I know how you could make it stop when you get to the destination and the long distance might be possible if the drive is done in two sections so you drive halfway then drive the other half.
 

KamikazeSripterul

Well-known member
Joined
Jun 30, 2019
Messages
353
Reaction score
23
Yeah, thats what i was thinking about too.. and eventually 10-20 units before u arrive to the checkpoint to start braking so when it reaches the checkpoint it fully stops. The problem i faced was that the car would reach the checkpoint, have too much speed so it couldnt stop in the checkpoint and then it would try to turn around and go back to the checkpoint.
 

ChampaRando

Active member
Joined
Jan 17, 2020
Messages
62
Reaction score
3
Location
INDIA
Checkpoint.cs although it doesn't actually work well as it doesn't stop even when you arrive at destination and it can't do long distances and some destinations it can't reach (like truckyards) it's just the nature of the opcodes it uses.
I've seen this, it's kind of useless to be honest like you said, doesn't work as intended.
 
Status
Not open for further replies.
Top