|
 |
|
|
|
|
|
GTA Modification Forums
Disable auto-reverse. Disable the auto reverse in cars - .NET.
 |
|
 |
| |
lindsayslorach  |
|
Rat

Group: Members
Joined: Dec 26, 2006


|
Thanks for the reply, but my understanding of the code you've given, is that when i press S it will freeze the car in its current position?
I'm just having a bit of fun making this, but i was really after, when braking, it would brake like normal, and then come to a complete stop. Then to reverse you would have to take your finger off S and press it again.
I know I probably should have specified that in the first post, sorry.
I'll try raising the check from < 1.0f to something higher.
Thanks.
This post has been edited by lindsayslorach on Friday, Aug 6 2010, 18:28
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
AngryAmoeba  |
|
Symbiont

Group: Members
Joined: Jan 12, 2009


|
I did some testing, but I couldn't get .Velocity to work. I encountered several problems using .Speed as well. Here's the best thing I could come up with. I discovered that using Player.CanControlCharacter = false instead of FreezePosition works better. But unfortunately, this conflicts with C06alt's First Person mod. When playing with that mod and CanControlCharacter is set to false, the camera switches from first-person to the hood cam. If you don't play in First Person, this script is almost fully functional now. However, if you drive backwards and then spin around 180º, you don't have to switch gears to drive forward because your speed never drops below 1.0f. So a velocity check would be better, if I could just figure out how to get it to work right. | CODE | using System; using System.Windows.Forms; using GTA;
public class ManualReverse : Script { bool bFrozen = false; bool bReverse = false;
public ManualReverse() { Interval = 100; Tick += new EventHandler(ManualReverse_Tick); KeyDown += new GTA.KeyEventHandler(ManualReverse_KeyDown); }
public void ManualReverse_Tick(object sender, EventArgs e) { if (Player.Character.isSittingInVehicle()) { if (Player.Character.CurrentVehicle.Speed < 1.0f) { if (bReverse) { if (isKeyPressed(Keys.W)) freezeCar(); else unfreezeCar(); } else { if (isKeyPressed(Keys.S)) freezeCar(); else unfreezeCar(); } } } else if (bReverse) bReverse = false; }
public void ManualReverse_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.Tab && Player.Character.isSittingInVehicle()) { if (Player.Character.CurrentVehicle.Speed > 1.0f) { Game.DisplayText("Stop car to switch gears"); } else { bReverse = !bReverse; if (bReverse) Game.DisplayText("Switched gears: REVERSE"); else Game.DisplayText("Switched gears: DRIVE"); } } }
public void freezeCar() { if (bFrozen) return; GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", 0); Player.CanControlCharacter = false; bFrozen = true; if (bReverse) Game.DisplayText("Switch gears to drive forward"); else Game.DisplayText("Switch gears to reverse"); }
public void unfreezeCar() { if (!bFrozen) return; GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", 1); Player.CanControlCharacter = true; bFrozen = false; } } | This post has been edited by AngryAmoeba on Wednesday, Aug 31 2011, 20:01
|
|
|
|
|
 |
|
 |
 |
|
 |
| |
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
Pages:
(2) [1] 2
Track this topic
Receive email notification when a reply has been made to this topic and you are not active on the board.
Subscribe to this forum
Receive email notification when a new topic is posted in this forum and you are not active on the board.
Download / Print this Topic
Download this topic in different formats or view a printer friendly version.
| |
 |
|
 |
|
|
|
|