Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

Enter in a passager seat and the driver drives random anywhere


skatefilter5
 Share

Recommended Posts

skatefilter5
When I press a key as enter passager seat to the nearest car it didn't work or it crashes, I couldn't get the car and ped from the road path, it there a better way to fix this?



{$CLEO .cs}


//-------------MAIN---------------

0000: NOP


:NONAME_2

wait 0

if

Player.Defined($PLAYER_CHAR)

else_jump @NONAME_2

jump @NONAME_45




:NONAME_45

wait 0


073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected]

08E5: get_actor_in_sphere [email protected] [email protected] [email protected] radius 10.0 handle_as [email protected]

if and

00E1: player 0 pressed_key 11

not Actor.Driving($PLAYER_ACTOR)

056E: car [email protected] defined

056D: actor [email protected] defined

else_jump @NONAME_45

Car.Health([email protected]) = 3000

039E: set_actor [email protected] locked 1 while_in_car

0982: set_actor [email protected] stay_in_car_when_dead 1

05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 2 time 6000

wait 6000


:NONAME_175

wait 0

if

Actor.InCar($PLAYER_ACTOR, [email protected])

else_jump @NONAME_175

Car.SetToNormalDriver([email protected])

wait 2000

Car.RemoveReferences([email protected])

jump @NONAME_45
Edited by skatefilter5
Link to comment
Share on other sites

spaceeinstein

"end_thread" is not allowed in a CLEO script. Why do you want to end it at all?

Edited by spaceeinstein
Link to comment
Share on other sites

skatefilter5

"end_thread" is not allowed in a CLEO script. Why do you want to end it at all?

Well, since the the game crashes when I press conversion yes key on enter as a passanger, because 073E: get_car_in_sphere [email protected] [email protected] [email protected] radius 10.0 model -1 handle_as [email protected] isn't wokring so I decide to put end_thread to block this script that crashes when I have over 1000 cleo scripts and that crashing script is hard to find sometimes

Edited by skatefilter5
Link to comment
Share on other sites

Why [email protected] and [email protected] are set to 1? This value is potentially an valid handle, consequentially handling a unexpected entity.

 

Instead of the opcodes 0x073E and 0x08E5, you can use opcode 0x0AB5 to store the closest vehicle and chara.

You can use opcode 0x046C to get the vehicle's driver instead of "try to find" them in scenario. It's a safe and accurated way to do this.

 

Of curse, only entities generated by script have references to be removed.

 

Do not fill up the code with severals WAITs, because this unnecessarily delays the curse of script. And more important: the handles should be verified after each WAIT. Others scripts, for example, can destroy the handled entity and invalidate the handle, causing crashes.

Edited by Guest
Link to comment
Share on other sites

skatefilter5

Why [email protected] and [email protected] are set to 1? This value is potentially an valid handle, consequentially handling a unexpected entity.

 

Instead of the opcodes 0x073E and 0x08E5, you can use opcode 0x0AB5 to store the closest vehicle and chara.

You can use opcode 0x046C to get the vehicle's driver instead of "try to find" them in scenario. It's a safe and accurated way to do this.

 

Of curse, only entities generated by script have references to be removed.

 

Do not fill up the code with severals WAITs, because this unnecessarily delays the curse of script. And more important: the handles should be verified after each WAITs. Others scripts, for example, can destroy the handled entity and invalidate the handle, causing crashes.

I haven't seen the alternated code but I'll try that one then

Link to comment
Share on other sites

skatefilter5

The second problem, that if i sit in car as a passenger the driver is not doing anything, not driving random or go to waypoint, he's just sitting there doing nothing, even removing actor.RemoveReferences and car.RemoveReferences also don't work because it just still stand there and do nothing.

 

{$CLEO .cs}
//-------------MAIN---------------
0000: NOP
0ACD: show_text_highpriority "Press ~n~~k~~CONVERSATION_YES~ to sit as a passanger." time 3600
//wait 1000
//0ACC: show_text_lowpriority "Near a car." time 3000
:NONAME_2
wait 0
if
//0ADC: test_cheat "passanger"
Player.Defined($PLAYER_CHAR)
else_jump @NONAME_2
jump @NONAME_45
:NONAME_45
wait 0
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to [email protected] closest_ped_to [email protected]
0AB6: store_target_marker_coords_to [email protected] [email protected] [email protected] // IF and SET
jump @CAR
:Remove
wait 0
//Car.RemoveReferences([email protected])
//actor.RemoveReferences([email protected])
jump @NONAME_45
:CAR
wait 0
if and
00E1: player 0 pressed_key 11 //Press Y or N I think
not Actor.Driving($PLAYER_ACTOR)
056E: car [email protected] defined
056D: actor [email protected] defined
else_jump @NONAME_45
Car.SetMaxSpeed([email protected], 0.0)
jf @CAR
if
0203: actor $PLAYER_ACTOR near_car [email protected] radius 5.0 5.0 flag 0 on_foot
else_jump @CAR
Car.Health([email protected]) = 3000
039E: set_actor [email protected] locked 1 while_in_car
0982: set_actor [email protected] stay_in_car_when_dead 1
05CA: AS_actor $PLAYER_ACTOR enter_car [email protected] passenger_seat 2 time 10000
wait 500
:NONAME_175
wait 0
if
Actor.InCar($PLAYER_ACTOR, [email protected])
else_jump @Remove
//jump @Cancel
car.SetSpeedInstantly([email protected], 20.0)
Car.SetMaxSpeed([email protected], 50.0)
//00AE: set_car [email protected] traffic_behaviour_to 3
//Car.SetToNormalDriver([email protected])
00A8: set_car [email protected] to_psycho_driver
00AF: set_car [email protected] driver_behaviour_to 5
wait 1000
//Car.RemoveReferences([email protected])
//actor.RemoveReferences([email protected])
jump @NONAME_45
Link to comment
Share on other sites

Um, the driver isn't going to go to a set of marker coordinates if you never placed down the marker in your map.

 

Target_Marker opcode isn't random at all. Place down a marker on your map and try this then.

Link to comment
Share on other sites

skatefilter5

Um, the driver isn't going to go to a set of marker coordinates if you never placed down the marker in your map.

 

Target_Marker opcode isn't random at all. Place down a marker on your map and try this then.

I already test that with the marker placed and the driver still not moving, well instead of taking from cars and peds on the traffic, I have create a new one then, mostly taxi, call and make him drive to the target marker.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.