Quantcast

Jump to content

» «
Photo

[H?] Actor $player_actor wont enter car >.>

9 replies to this topic
runedog48
  • runedog48

    Player Hater

  • Members
  • Joined: 31 May 2010

#1

Posted 22 February 2011 - 01:37 AM

Enter car

CODE
:gmoh_8
05CA: AS_actor $player_actor enter_car 10@ passenger_seat 0 -1 ms
Player.CanMove($PLAYER_CHAR) = False


Car Model

CODE
10@ = Car.Create(#JESTER, 7@, 8@, 9@)


Loading model

CODE
Model.Load(#MALE01)
Model.Load(#JESTER)
038B: load_requested_models
:gmoh_2
wait 100
if
Model.Available(#MALE01)
Model.Available(#JESTER)

spaceeinstein
  • spaceeinstein

    Chocolate

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

#2

Posted 22 February 2011 - 01:40 AM

Ok, so put those together and what should the full code look like?

runedog48
  • runedog48

    Player Hater

  • Members
  • Joined: 31 May 2010

#3

Posted 22 February 2011 - 01:42 AM

QUOTE (spaceeinstein @ Feb 22 2011, 01:40)
Ok, so put those together and what should the code look like?

????

Src:
CODE
{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'gmoh'

:gmoh_1
wait 100
if
0AB0:   key_pressed 186
else_jump @gmoh_1
Actor.StorePos($player_actor, 1@, 2@, 3@)
Model.Load(#MALE01)
Model.Load(#JESTER)
038B: load_requested_models
:gmoh_2
wait 100
if
Model.Available(#MALE01)
Model.Available(#JESTER)
else_jump @gmoh_2
04C4: store_coords_to 4@ 5@ 6@ from_actor $player_actor with_offset 200.0 0.0 0.0
02C1: store_to 7@ 8@ 9@ car_path_coords_closest_to 4@ 5@ 6@
10@ = Car.Create(#JESTER, 7@, 8@, 9@)
0129: 11@ = create_actor_pedtype 4 model #MALE01 in_car 10@ driverseat
00AE: set_car 10@ traffic_behaviour_to 2
Car.SetMaxSpeed(10@, 30.0)
Car.DriveTo(10@, 1@, 2@, 3@)
jump @gmoh_3

:gmoh_3
wait 0
if
01AD:   car 10@ sphere 0 near_point 1@ 2@ radius 5.0 5.0
else_jump @gmoh_4
jump @gmoh_8

:gmoh_4
if
Actor.Dead(11@)
else_jump @gmoh_6
01C2: remove_references_to_actor 11@
01C3: remove_references_to_car 10@
009B: destroy_actor 11@
00A6: destroy_car 10@
jump @gmoh_1

:gmoh_6
Car.Wrecked(10@)
else_jump @gmoh_3
01C2: remove_references_to_actor 11@
01C3: remove_references_to_car 10@
009B: destroy_actor 11@
00A6: destroy_car 10@
jump @gmoh_1

:gmoh_8
05CA: AS_actor $player_actor enter_car 10@ passenger_seat 0 -1 ms
Player.CanMove($PLAYER_CHAR) = False
:gmoh_5
wait 0
if
00DB:   actor $PLAYER_ACTOR in_car 10@
else_jump @gmoh_5
00AE: set_car 10@ traffic_behaviour_to 2
Car.SetMaxSpeed(10@, 60.0)

:gmoh_7
Car.DriveTo(10@, 2497.1631, -1678.0889, 13.3459)
if
01AD:   car 10@ sphere 0 near_point 2497.1631 -1678.0889 radius 5.0 5.0
else_jump @gmoh_7
05CD: AS_actor $player_actor exit_car 10@
04C4: store_coords_to 12@ 13@ 14@ from_actor $player_actor with_offset 200.0 0.0 0.0
02C1: store_to 15@ 16@ 17@ car_path_coords_closest_to 12@ 13@ 14@
00AE: set_car 10@ traffic_behaviour_to 2
Car.SetMaxSpeed(10@, 60.0)
Car.DriveTo(10@, 1@, 2@, 3@)
073E: get_car_in_sphere 15@ 16@ 17@ radius 5.0 model -1 handle_as 18@
wait 10000
01C2: remove_references_to_actor 11@
01C3: remove_references_to_car 10@
009B: destroy_actor 11@
00A6: destroy_car 10@
jump @gmoh_1


The player just sits there and does nothing...

spaceeinstein
  • spaceeinstein

    Chocolate

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

#4

Posted 22 February 2011 - 01:49 AM Edited by spaceeinstein, 22 February 2011 - 01:52 AM.

Some mistakes I saw.

CODE
if
Model.Available(#MALE01)
Model.Available(#JESTER)
else_jump @gmoh_2

should be
CODE
if and
Model.Available(#MALE01)
Model.Available(#JESTER)
else_jump @gmoh_2

because you are checking more than one conditions.

--

When you use
CODE
Player.CanMove($PLAYER_CHAR) = False

make sure
CODE
Player.CanMove($PLAYER_CHAR) = True

is somewhere in the code so that you can still roam freely if the code is finished or if there are problems.

--

CODE
:gmoh_7
Car.DriveTo(10@, 2497.1631, -1678.0889, 13.3459)
if
01AD:   car 10@ sphere 0 near_point 2497.1631 -1678.0889 radius 5.0 5.0
else_jump @gmoh_7

A loop without "wait" will crash the game.
CODE
:gmoh_7
wait 0 (or other values) ms
Car.DriveTo(10@, 2497.1631, -1678.0889, 13.3459)
if
01AD:   car 10@ sphere 0 near_point 2497.1631 -1678.0889 radius 5.0 5.0
else_jump @gmoh_7


--

Other than that, I don't see anymore glaring problems. The car should be moving after the player enters the car.

runedog48
  • runedog48

    Player Hater

  • Members
  • Joined: 31 May 2010

#5

Posted 22 February 2011 - 01:54 AM

QUOTE (spaceeinstein @ Feb 22 2011, 01:49)
Some mistakes I saw.

CODE
if
Model.Available(#MALE01)
Model.Available(#JESTER)
else_jump @gmoh_2

should be
CODE
if and
Model.Available(#MALE01)
Model.Available(#JESTER)
else_jump @gmoh_2

because you are checking more than one conditions.

--

When you use
CODE
Player.CanMove($PLAYER_CHAR) = False

make sure
CODE
Player.CanMove($PLAYER_CHAR) = True

is somewhere in the code so that you can still roam freely if the code is finished or if there are problems.

--

CODE
:gmoh_7
Car.DriveTo(10@, 2497.1631, -1678.0889, 13.3459)
if
01AD:   car 10@ sphere 0 near_point 2497.1631 -1678.0889 radius 5.0 5.0
else_jump @gmoh_7

A loop without "wait" will crash the game.
CODE
:gmoh_7
wait 0 (or other values) ms
Car.DriveTo(10@, 2497.1631, -1678.0889, 13.3459)
if
01AD:   car 10@ sphere 0 near_point 2497.1631 -1678.0889 radius 5.0 5.0
else_jump @gmoh_7


--

Other than that, I don't see anymore glaring problems. The car should be moving after the player enters the car.

Thanks. I'm still a newbie.

runedog48
  • runedog48

    Player Hater

  • Members
  • Joined: 31 May 2010

#6

Posted 22 February 2011 - 01:58 AM

ARRG...... I fixed all of those mistakes and CJ still didin't enter the car. Hmmm.... might have to make a 4 door car.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None
  • Contribution Award [Mods]

#7

Posted 22 February 2011 - 02:44 AM

QUOTE (runedog48 @ Feb 22 2011, 01:58)
ARRG...... I fixed all of those mistakes and CJ still didin't enter the car. Hmmm.... might have to make a 4 door car.

What's your current, modified code?

Some nitpicks:
CODE
Model.Load(#MALE01)  // not required, #MALE01 is always loaded

CODE
038B: load_requested_models  // not required in SA

Nahiyan
  • Nahiyan

    I'm awesome, and I'm a scripter

  • Members
  • Joined: 15 Oct 2010

#8

Posted 26 February 2011 - 08:07 PM

CODE
:gmoh_4
Actor.Dead(11@)
else_jump @gmoh_6
01C2: remove_references_to_actor 11@
01C3: remove_references_to_car 10@
009B: destroy_actor 11@
00A6: destroy_car 10@
jump @gmoh_1

:gmoh_6
Car.Wrecked(10@)
else_jump @gmoh_3
01C2: remove_references_to_actor 11@
01C3: remove_references_to_car 10@
009B: destroy_actor 11@
00A6: destroy_car 10@
jump @gmoh_1


OK umm..

Instead of that you could do..

CODE
:Somewhere
if or
  DriverNoMoreHead
  CarNoEngineWtf
jf @nowhere
DoSomeStuff
jump @BigBangAKAStartOfEverything


And umm..

CODE
jump @gmoh_3

:gmoh_3


The game reads the script and goes down, no need to jump to the next label.

And..

CODE
if
01AD:   car 10@ sphere 0 near_point 1@ 2@ radius 5.0 5.0
else_jump @gmoh_4


Maybe the car can't get there, try increasing the radius.

Again,

CODE
Player.CanMove($PLAYER_CHAR) = False


I think this is the problem. Try -

CODE
Player.Controllable($PLAYER_CHAR) = False


It should be something like Controllable.

Good luck!

Silent
  • Silent

    Chief Vision™ Alterer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#9

Posted 26 February 2011 - 08:26 PM

QUOTE (Nahiyan @ Feb 26 2011, 21:07)
CODE
Player.CanMove($PLAYER_CHAR) = False


I think this is the problem. Try -

CODE
Player.Controllable($PLAYER_CHAR) = False


It should be something like Controllable.

Player.Controllable is a check, not a set opcode.

yair1221
  • yair1221

    Homie

  • Members
  • Joined: 18 Feb 2010

#10

Posted 27 February 2011 - 01:28 PM

CODE
05CA: AS_actor $player_actor enter_car 10@ passenger_seat 0 -1 ms
Player.CanMove($PLAYER_CHAR) = False


maybe the actor cant move
try putting a // before Player.CanMove($PLAYER_CHAR) = False
just give it a try, couldn't hurt




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users