Quantcast

Jump to content

» «
Photo

Enter in a passager seat and the driver drives random anywhere

5 replies to this topic
skatefilter5
  • skatefilter5

    It's all about things to do in any games

  • Members
  • Joined: 30 Apr 2016
  • Canada

#1

Posted A week ago Edited by skatefilter5, A week ago.

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 
0@ = 1 
10@ = 1 
 
:NONAME_45
wait 0 
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
073E: get_car_in_sphere 1@ 2@ 3@ radius 10.0 model -1 handle_as 0@ 
08E5: get_actor_in_sphere 1@ 2@ 3@ radius 10.0 handle_as 10@ 
if and
00E1:   player 0 pressed_key 11 
   not Actor.Driving($PLAYER_ACTOR)
056E:   car 0@ defined 
056D:   actor 10@ defined 
else_jump @NONAME_45 
Car.Health(0@) = 3000
039E: set_actor 10@ locked 1 while_in_car 
0982: set_actor 10@ stay_in_car_when_dead 1 
05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat 2 time 6000 
wait 6000 
 
:NONAME_175
wait 0 
if 
   Actor.InCar($PLAYER_ACTOR, 0@)
else_jump @NONAME_175 
Car.SetToNormalDriver(0@)
wait 2000 
Car.RemoveReferences(0@)
jump @NONAME_45 

spaceeinstein
  • spaceeinstein

    Chocolate

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

#2

Posted A week ago Edited by spaceeinstein, A week ago.

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

skatefilter5
  • skatefilter5

    It's all about things to do in any games

  • Members
  • Joined: 30 Apr 2016
  • Canada

#3

Posted A week ago Edited by skatefilter5, A week ago.

"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 1@ 2@ 3@ radius 10.0 model -1 handle_as 0@  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 6 days ago Edited by Veryzon, 5 days ago.

Why 0@ and 10@ 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

    It's all about things to do in any games

  • Members
  • Joined: 30 Apr 2016
  • Canada

#5

Posted 5 days ago

Why 0@ and 10@ 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

    It's all about things to do in any games

  • Members
  • Joined: 30 Apr 2016
  • Canada

#6

Posted 2 hours ago

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 
0@ = 1 
10@ = 1 
 
:NONAME_45
wait 0 
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@  closest_ped_to 10@ 
0AB6: store_target_marker_coords_to 15@ 16@ 17@ // IF and SET 
jump @CAR
:Remove
 
wait 0
//Car.RemoveReferences(0@)
//actor.RemoveReferences(10@)
 
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 0@ defined 
056D:   actor 10@ defined 
else_jump @NONAME_45 
Car.SetMaxSpeed(0@, 0.0)
 
jf @CAR
if
0203:   actor $PLAYER_ACTOR near_car 0@ radius 5.0 5.0 flag 0 on_foot
else_jump @CAR
Car.Health(0@) = 3000
039E: set_actor 10@ locked 1 while_in_car 
0982: set_actor 10@ stay_in_car_when_dead 1 
05CA: AS_actor $PLAYER_ACTOR enter_car 0@ passenger_seat 2 time 10000 
wait 500 
 
:NONAME_175
wait 0
if 
   Actor.InCar($PLAYER_ACTOR, 0@)
else_jump @Remove
//jump @Cancel
car.SetSpeedInstantly(0@, 20.0)
Car.SetMaxSpeed(0@, 50.0)
car.DriveTo(0@, 15@, 16@, 17@)
//00AE: set_car 0@ traffic_behaviour_to 3 
//Car.SetToNormalDriver(0@)
00A8: set_car 0@ to_psycho_driver
00AF: set_car 0@ driver_behaviour_to 5
 
 
wait 1000 
//Car.RemoveReferences(0@)
//actor.RemoveReferences(10@)
jump @NONAME_45 




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users