Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!   (92,973 visits to this link)

    2. News

    1. GTA Online

      1. Find Lobbies & Players
      2. Guides & Strategies
      3. Vehicles
      4. Content Creator
      5. Help & Support
    2. Crews

      1. Events
      2. Recruitment
    1. Grand Theft Auto Series

    2. GTA Next

    3. GTA V

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

      1. Episodes from Liberty City
      2. Multiplayer
      3. Guides & Strategies
      4. Help & Support
      5. GTA Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    12. Wiki

      1. Merchandising
    1. GTA Modding

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Mod Showroom

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

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Red Dead Redemption 2

    2. Red Dead Redemption

    3. Rockstar Games

    1. Off-Topic

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

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

    2. Site Suggestions

Sign in to follow this  
skatefilter5

Enter in a passager seat and the driver drives random anywhere

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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
Veryzon

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 Veryzon

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
deltaCJ

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.

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

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