Quantcast

Jump to content

» «
Photo

Enter in a passager seat and the driver drives random anywhere

7 replies to this topic
skatefilter5
  • skatefilter5

    Controlling Both Players

  • Members
  • Joined: 30 Apr 2016
  • Canada

#1

Posted 08 August 2017 - 07:40 PM Edited by skatefilter5, 09 August 2017 - 06:20 PM.

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 

spaceeinstein
  • spaceeinstein

    Chocolate

  • GTA Mods Staff
  • Joined: 17 Jul 2003
  • Hong-Kong
  • Major Contribution Award [Mods]
    Helpfulness Awards [Mods]

#2

Posted 08 August 2017 - 11:23 PM Edited by spaceeinstein, 08 August 2017 - 11:25 PM.

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

skatefilter5
  • skatefilter5

    Controlling Both Players

  • Members
  • Joined: 30 Apr 2016
  • Canada

#3

Posted 09 August 2017 - 06:17 PM Edited by skatefilter5, 09 August 2017 - 06:20 PM.

"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


Veryzon
  • Veryzon

    Player Hater

  • Members
  • Joined: 15 Jun 2017
  • Brazil

#4

Posted 12 August 2017 - 07:31 AM Edited by Veryzon, 12 August 2017 - 10:27 PM.

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.


skatefilter5
  • skatefilter5

    Controlling Both Players

  • Members
  • Joined: 30 Apr 2016
  • Canada

#5

Posted 12 August 2017 - 08:46 PM

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


skatefilter5
  • skatefilter5

    Controlling Both Players

  • Members
  • Joined: 30 Apr 2016
  • Canada

#6

Posted 18 August 2017 - 02:52 PM

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 

deltaCJ
  • deltaCJ

    BUSTED!

  • Members
  • Joined: 27 Dec 2013
  • None

#7

Posted 18 August 2017 - 06:26 PM

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.


skatefilter5
  • skatefilter5

    Controlling Both Players

  • Members
  • Joined: 30 Apr 2016
  • Canada

#8

Posted 19 August 2017 - 07:46 PM

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.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users