CLEO Help Need help about car auto drive to many positions.

CLEO related
Status
Not open for further replies.

hiphopBB00

New member
Joined
Jun 14, 2013
Messages
3
Reaction score
0
Hi, i'm trying to make script that player car drive to many positions ( useful for shipment job in RP server ). You guy can test by get a boat at palomino dock and press P+0 to make it work.

Code:
{$VERSION 3.1.1000}
{$CLEO .cs}

//-------------MAIN---------------
thread 'DRVCARC'

:DRVCARC_11
wait 0
if
  Player.Defined($PLAYER_CHAR)
else_jump @DRVCARC_11

:DRVCARC_12
wait 0
if and
0AB0:   key_pressed 80
0AB0:   key_pressed 48
  Actor.Driving($PLAYER_ACTOR)
else_jump @DRVCARC_11
0@ = Actor.CurrentCar($PLAYER_ACTOR)

0615: define_action_sequences 1@
05D1: AS_actor -1 drive_car 0@ to  2103.3625 -27.2164 0.7913 speed  100.0  2  0  5 //-START-
05D1: AS_actor -1 drive_car 0@ to  2121.7729 86.3303 0.759 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  2201.7061 318.5951 0.389 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  2120.6611 484.7034 0.7261 speed  100.0  2  0  5

05D1: AS_actor -1 drive_car 0@ to  1748.7454 541.0309 0.6007 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  1108.2168 643.9203 0.2835 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  965.067 628.6064 0.7145 speed  100.0  2  0  5

05D1: AS_actor -1 drive_car 0@ to  -162.9366 416.792 0.8848 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  -941.7777 590.8659 0.7369 speed  100.0  2  0  5 //
05D1: AS_actor -1 drive_car 0@ to -1505.1461 1499.2831 0.5078  speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to -1450.7104 1507.5431 0.4977 speed  100.0  2  0  5 //-X-

05D1: AS_actor -1 drive_car 0@ to -1362.7502 1500.9033 0.902  speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to -1362.7502 1500.9033 0.902  speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to -941.7777 590.8659 0.7369  speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  -567.3588 396.2409 0.7135 speed  100.0  2  0  5 //-HOME-

05D1: AS_actor -1 drive_car 0@ to  -175.4123 315.7126 0.8042 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  536.1237 464.3447 0.8018 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  1110.3573 619.4804 0.7899 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  2019.6425 461.5696 0.8398 speed  100.0  2  0  5

05D1: AS_actor -1 drive_car 0@ to  2179.0352 358.6202 0.6808 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  2155.5881 225.571 0.8251 speed  100.0  2  0  5
05D1: AS_actor -1 drive_car 0@ to  2063.5874 -56.5608 0.7691 speed  100.0  2  0  5
0616: define_action_sequences_end 1@
0618: assign_actor $PLAYER_ACTOR to_action_sequences 1@
061B: remove_references_to_AS_pack 1@
jump @DRVCARC_11

But when i test, my boat stopped at seventh position and i don't know how to make it work... Any idea?
I've tryed to use paths ( i prefer this ), it worked perfect in single player but the game stop working in SAMP...

P/S: Sr for my crappy english...
 

0dmg

Active member
Joined
Jun 20, 2013
Messages
30
Reaction score
0
I'm not sure I understand, are you saying that those are 23 positions you need the boat to go to?
 

0dmg

Active member
Joined
Jun 20, 2013
Messages
30
Reaction score
0
Alright, I couldn't compile your code at first, so I fixed it by changing a line... Maybe this will help you?
Code:
0@ = Actor.CurrentCar($PLAYER_ACTOR)
was changed to
03C0: 0@ = actor $PLAYER_ACTOR car
Sorry I'm not very good with cleo
 

0dmg

Active member
Joined
Jun 20, 2013
Messages
30
Reaction score
0
Yes, they're waypoints to make the boat in direction. But when i test, my boat stop at seventh position
What do you mean by "stop"? I wrote some waypoints of my own, and noticed that the damn thing just keeps circling somewhere around the 7th (maybe 6th) waypoint...
 

hiphopBB00

New member
Joined
Jun 14, 2013
Messages
3
Reaction score
0
Yes, this is what i mean, my boat stopped at 7th position... and i don't know how to make the boat run to the next position...
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Your boat might try to go higher and thus not be able to reach the checkpoint which is pretty high.

Maybe try to put a lower Z coordinate.
 

0x_

Wtf I'm not new....
Staff member
Administrator
Joined
Feb 18, 2013
Messages
1,123
Reaction score
174
Is there a way to eliminate the Z coordinate?
FindGroundZ ? I don't know if it exists in CLEO but something similar exists i'm sure
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
That's not what i meant, this is what i wanted to say :

this, is the code :
05D1: AS_actor -1 drive_car 0@ to 965.067 628.6064 0.7145 speed 100.0 2 0 5

0.7145 might be too high to climb for the boat, so maybe lowering it's Z coordinate might solve the problem. Like uhm... Turning 0.7145 into 0.4326... maybe... :?: :?::?:
 

0dmg

Active member
Joined
Jun 20, 2013
Messages
30
Reaction score
0
After extensive testing with bikes and cars, I have determined that action_sequences is limited to around 7 checkpoints, has anyone found differently?
 

WestRider

Member
Joined
Feb 23, 2013
Messages
16
Reaction score
0
With this, is it possible to make the car auto drive to certain coords but also following the road otherwise this dont work properly with cars?
 

m1zg4rd_PL

Well-known member
Joined
Jul 19, 2013
Messages
222
Reaction score
0
I have determined that action_sequences is limited to around 7 checkpoints

Hmm, If that packs of AS commands are limited to 7, why don't you split that track on 3 parts and make checking system If boat is on finish of that part? I tested that and for me It was working great :D :D:D

Code:
{$VERSION 3.1.1000}
{$CLEO .cs}

//-------------MAIN---------------
thread 'DRVCARC' 

:DRVCARC_11
wait 0 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @DRVCARC_11 
wait 0 
if and
0AB0:    key_pressed 80 
0AB0:    key_pressed 48 
04A7:   actor $PLAYER_ACTOR driving_boat 
else_jump @DRVCARC_11 
03C0: 0@ = actor $PLAYER_ACTOR car 
0615: define_AS_pack_begin 1@ 
05D1: AS_actor -1 drive_car 0@ to 2103.363 -27.2164 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2121.773 86.3303 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2201.706 318.5951 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2120.661 484.7034 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 1748.745 541.0309 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 1108.217 643.9203 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 965.067 628.6064 0.0 speed 100.0 2 model #NULL 5 
0616: define_AS_pack_end 1@ 
0618: assign_actor $PLAYER_ACTOR to_AS_pack 1@ 
061B: remove_references_to_AS_pack 1@ 
jump @DRVCARC_328 

:DRVCARC_328
wait 40 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @DRVCARC_11 
if and
056E:   car 0@ defined 
00EC:   actor $PLAYER_ACTOR sphere 0 near_point 965.067 628.6064 radius 100.0 100.0 
else_jump @DRVCARC_328 
0687: clear_actor $PLAYER_ACTOR task 
wait 10 
0615: define_AS_pack_begin 2@ 
05D1: AS_actor -1 drive_car 0@ to -162.9366 416.792 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -941.7777 590.8659 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -1505.146 1499.283 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -1450.71 1507.543 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -1362.75 1500.903 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -1362.75 1500.903 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -941.7777 590.8659 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to -567.3588 396.2409 0.0 speed 100.0 2 model #NULL 5 
0616: define_AS_pack_end 2@ 
0618: assign_actor $PLAYER_ACTOR to_AS_pack 2@ 
061B: remove_references_to_AS_pack 2@ 
jump @DRVCARC_694 

:DRVCARC_694
wait 40 
if 
   Player.Defined($PLAYER_CHAR)
else_jump @DRVCARC_11 
if and
056E:   car 0@ defined 
00EC:   actor $PLAYER_ACTOR sphere 0 near_point -567.3588 396.2409 radius 100.0 100.0 
else_jump @DRVCARC_328 
0687: clear_actor $PLAYER_ACTOR task 
wait 10 
0615: define_AS_pack_begin 3@ 
05D1: AS_actor -1 drive_car 0@ to -175.4123 315.7126 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 536.1237 464.3447 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 1110.357 619.4804 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2019.642 461.5696 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2179.035 358.6202 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2155.588 225.571 0.0 speed 100.0 2 model #NULL 5 
05D1: AS_actor -1 drive_car 0@ to 2063.587 -56.5608 0.0 speed 100.0 2 model #NULL 5 
0616: define_AS_pack_end 3@ 
0618: assign_actor $PLAYER_ACTOR to_AS_pack 3@ 
061B: remove_references_to_AS_pack 3@ 
jump @DRVCARC_11

Don't forget to checking if boat exists and not wrecked (everything is possible on SA:MP :p :p:p ). If with this script boat is stopping somewhere, then split track to 4 parts, that was only for testing...
My boat has collided with red bridge and stucked in San Fierro :p :p:p (sorry for my bad English)
 
Status
Not open for further replies.
Top