Quantcast

Jump to content

» «
Photo

Attaching a car to a car

1 reply to this topic
Pie015
  • Pie015

    6 STAR VETERAN

  • Members
  • Joined: 11 Jun 2010

#1

Posted 13 April 2013 - 03:46 PM

Hey guys, its been a while since I went back to SA coding so try not to complain about the code's tidyness :3

CODE

{$CLEO .cs}

//-------------MAIN---------------
0000: NOP

:1
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  Actor.Driving($PLAYER_ACTOR)
  0AB0: key_pressed 49
jf @1
0AB5: store_actor $PLAYER_ACTOR closest_vehicle_to 0@ closest_ped_to 1@
Actor.RemoveReferences(1@)
if
056E:   car 0@ defined
jf @1
03C0: 2@ = actor $PLAYER_ACTOR car
if
056E: car 2@ defined
jf @1
3@ = Car.Angle(0@)
0683: attach_car 2@ to_car 0@ with_offset 0.0 0.0 0.0 rotation 0.0 0.0 0.0

:2
wait 5000
if and
Player.Defined($PLAYER_CHAR)
Actor.InCar($PLAYER_ACTOR, 2@)
jf @1
if
0AB0: key_pressed 50
jf @2
0684: detach_car 2@ 0.0 0.0 0.0 collision_detection 1
Car.RemoveReferences(0@)
Car.RemoveReferences(2@)
wait 1000
jump @1


So when you press '1' it will attach your car to the car close to you. And '2' will detach it. But when I press '1' my car will start to float and a few seconds later it will be thrown. What is wrong with my code? Thanks in advance.

aStiffSausage
  • aStiffSausage

    Formerly Oksu

  • Members
  • Joined: 30 Sep 2010
  • Finland

#2

Posted 13 April 2013 - 06:42 PM

I'd say it's because you are attaching the car into player's car with zero offset, meaning they both will be at exact position.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users