lindsayslorach Posted August 6, 2010 Share Posted August 6, 2010 Hey guys, I've got a bit of a problem with a script I'm making. It doesnt seem to want to work. It compiles fine and i dont get any errors in the log, so i don't know what's going on. Heres the code I've come up with: using System;using System.Windows.Forms;using GTA;namespace DisabledAutoReverse{ public class DisabledReverse : Script { bool bEnabled = false; Vehicle vMyVehicle; public DisabledReverse() { Interval = 100; this.KeyDown += new GTA.KeyEventHandler(DisabledReverse_KeyDown); this.KeyUp += new GTA.KeyEventHandler(DisabledReverse_KeyUp); this.Tick += new EventHandler(DisabledReverse_Tick); } public void DisabledReverse_Tick(object sender, EventArgs e) { if (bEnabled) { vMyVehicle.Speed = 0.0f; } } public void DisabledReverse_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.S) { if (Player.Character.isInVehicle()) { vMyVehicle = Player.Character.CurrentVehicle; if (Exists(vMyVehicle)) { if (vMyVehicle.Speed < 1.0f) { vMyVehicle.Speed = 0.0f; bEnabled = true; } } } } } public void DisabledReverse_KeyUp(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.S) { bEnabled = false; } } }} And could someone possibly explain to me how to use GameKey please? Thanks. Link to comment Share on other sites More sharing options...
Donny78 Posted August 6, 2010 Share Posted August 6, 2010 It probably just jumps past 1f, try raising this limit or set it up different: using System;using System.Windows.Forms;using GTA;namespace DisabledAutoReverse{ public class DisabledReverse : Script { bool bEnabled = false; public DisabledReverse() { Interval = 100; Tick += new EventHandler(DisabledReverse_Tick); } public void DisabledReverse_Tick(object sender, EventArgs e) { if (isKeyPressed(Keys.S)) bEnabled = true; else bEnabled = false; // or use here >> .Speed = 0f; if (Player.Character.isInVehicle()) Player.Character.CurrentVehicle.FreezePosition = bEnabled; else bEnabled = false; } }}; The above way you don't need the Key*** events etc, just the tick and AFAIK it should stop you reversing. Link to comment Share on other sites More sharing options...
lindsayslorach Posted August 6, 2010 Author Share Posted August 6, 2010 (edited) 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. Edited August 6, 2010 by lindsayslorach Link to comment Share on other sites More sharing options...
Symbiote Posted August 6, 2010 Share Posted August 6, 2010 Good luck with the script. I'd be interested in something like this, although I would prefer to have a dedicated button for switching from 'drive' to 'reverse'. That would be cool. Link to comment Share on other sites More sharing options...
lindsayslorach Posted August 7, 2010 Author Share Posted August 7, 2010 Thats a very good idea, I might try to impliment that when i get this code running properly. I've been testing a car mod, and I've noticed that when i get in a car, and try to reverse, it tries to stop me, so the script kinda works, just not in the intended way. Link to comment Share on other sites More sharing options...
Symbiote Posted August 7, 2010 Share Posted August 7, 2010 Perhaps using isKeyPressed like in Donny's code would work better. It seems the vMyVehicle.Speed lines in the KeyDown procedure won't run if your speed is above 1.0f when you press S. Link to comment Share on other sites More sharing options...
Donny78 Posted August 8, 2010 Share Posted August 8, 2010 I didn't even think of the breaking, I can see what you mean now and yes that would be a problem. What about checking the velocity of the vehicle, if it's relative to it's angle then the y axis would have a positive value for driving forward and a negative for reversing so you could check the value and respond to it. // bound keypress S custom{ Vector3 vel = Player.Character.CurrentVehicle.Velocity; if (vel.Y < 0) { if (!DoublePressed) { Player.Character.CurrentVehicle.FreezePosition = true; DoublePressed = true; } else { Player.Character.CurrentVehicle.FreezePosition = false; DoublePressed = false; } } else DoublePressed = false;} Again that could be buggy though, if you get into a crash or something and try correcting it by reversing like when you're spinning out then it would freeze it but it's a base to work on. Link to comment Share on other sites More sharing options...
Symbiote Posted August 8, 2010 Share Posted August 8, 2010 (edited) I thought of a way you might be able to implement a button to switch gears between drive and reverse. I don't know the language you guys used (is it C#?), but I tried to put my idea into code. There might be syntax mistakes and that kind of thing... and I'm sure this could be optimized. See below for updated code. Edited August 9, 2010 by AngryAmoeba Link to comment Share on other sites More sharing options...
Donny78 Posted August 8, 2010 Share Posted August 8, 2010 I like the idea of having a gear effect dude and yes it's c#. Edit: Is that on purpose the "== 0f" so it only works when you're static ? Link to comment Share on other sites More sharing options...
Symbiote Posted August 8, 2010 Share Posted August 8, 2010 (edited) Yeah that's on purpose. If the car is moving and you press S, you don't want the car to be frozen. Instead, S will brake until the car stops, then it will freeze the car. I also realize now that you should only be able to switch gears when the car is stopped. EDIT: And now I've realized that this will probably break boats and helicopters. Edited August 8, 2010 by AngryAmoeba Link to comment Share on other sites More sharing options...
Donny78 Posted August 8, 2010 Share Posted August 8, 2010 Yeah that's on purpose. If the car is moving and you press S, you don't want the car to be frozen. Instead, S will brake until the car stops, then it will freeze the car. I also realize now that you should only be able to switch gears when the car is stopped. EDIT: And now I've realized that this will probably break boats and helicopters. Yeah good point, damn my brain isn't turned on today. I'm not on my main computer so no IV to check it out but I do think the velocity check would be better as then you could directly check if it's reversing, this is ofcourse if it works how I think it does (negative velocity for reversing, y-), it would be much easier to code then: public bool IsVehicleReversing(Vehicle vehicle){ if (vehicle != null && vehicle.Exists()) { if (vehicle.Velocity.Y < 0) return true; } return false;} Then you can do stuff like: // tickif (IsVehicleReversing(Player.Character.CurrentVehicle)){ if (!isKeyPressed(Keys.Tab)) Player.Character.CurrentVehicle.FreezePosition = true; else Player.Character.CurrentVehicle.FreezePosition = false;}else Player.Character.CurrentVehicle.FreezePosition = false; Link to comment Share on other sites More sharing options...
Symbiote Posted August 9, 2010 Share Posted August 9, 2010 (edited) 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. 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; }} Edited August 31, 2011 by AngryAmoeba Link to comment Share on other sites More sharing options...
lindsayslorach Posted August 9, 2010 Author Share Posted August 9, 2010 (edited) Hey, thanks for the replies guys! Thanks for the code, AngryAmoeba! I'll give it a test soon. Cheers. Edit: Just tried the script, works like a charm, thanks! Edited August 10, 2010 by lindsayslorach Link to comment Share on other sites More sharing options...
Accountclosed Posted August 24, 2010 Share Posted August 24, 2010 Could one of you guys build the script for me (us)? I can't seem to make it work when I try to make the dll file from the script in Visual Studio 2010? Link to comment Share on other sites More sharing options...
Symbiote Posted August 24, 2010 Share Posted August 24, 2010 Hi, you can just copy the script code into Notepad and save it as ManualReverse.cs in the 'scripts' folder of the .NET scripthook. No compiling necessary. Link to comment Share on other sites More sharing options...
Accountclosed Posted August 24, 2010 Share Posted August 24, 2010 Hi, you can just copy the script code into Notepad and save it as ManualReverse.cs in the 'scripts' folder of the .NET scripthook. No compiling necessary. Thx AngryAmoeba. I thought that method was only possible with VB scripts. Link to comment Share on other sites More sharing options...
Accountclosed Posted August 25, 2010 Share Posted August 25, 2010 (edited) I can't seem to make it work. I use Scripthookdotnet v1.7.1.4 + GTA Version 1.0.6.0 I created a file "Reversescript.cs", put it in the "Scripts" folder for .NET scripts and loaded it with this: 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; 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; Player.CanControlCharacter = true; bFrozen = false; }} My Scripthookdotnet log: 2010-08-25 21:04:25 - Initializing ScriptHookDotNet v1.7.1.4 BETA (GTA IV version 1.0.6.0) 2010-08-25 21:05:54 - Direct3D device created! 2010-08-25 21:05:54 - SEARCHING FOR SCRIPTS... 2010-08-25 21:05:54 - Loading scripts in Assembly 'scripts\FirstResponse.net.dll' ... 2010-08-25 21:05:54 - ...found script 'FirstResponse.Main.EmergencyLights'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.Main.Start'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCMD.Main'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCMD.Functions'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.DeletionList'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.Callouts'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.TextDraw'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.HQ'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Arrest'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Backup'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Carboot'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Chase'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Disarm'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Frisk'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.PullOver'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Actions'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Debug'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Flashlight'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Functions'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Partner'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.inputSimulator'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Start'! 2010-08-25 21:05:54 - ...found script 'FirstResponse.LCPD.Various'! 2010-08-25 21:05:54 - Loading scripts in Assembly 'scripts\gkFuelMod.net.dll' ... 2010-08-25 21:05:54 - ...found script 'gkFuelMod.fuelMod'! 2010-08-25 21:05:54 - Loading scripts in Assembly 'scripts\Speed Limit.net.dll' ... 2010-08-25 21:05:54 - ...found script 'Speedlimit'! 2010-08-25 21:05:54 - ...found script 'Speedlimit+SpeedDisplay'! 2010-08-25 21:05:54 - Loading scripts in Assembly 'scripts\TrafficFix.net.dll' ... 2010-08-25 21:05:54 - ...found script 'TrainerMenuScript.TrafficCorrect'! 2010-08-25 21:05:54 - Loading dynamic scriptfile 'scripts\Stop script.vb' ... 2010-08-25 21:05:54 - ...found script 'HaltBehindScript'! 2010-08-25 21:05:54 - DONE! 28 valid scripts found! 2010-08-25 21:05:54 - STARTING SCRIPTS... 2010-08-25 21:05:54 - Error during GetPhoneNumber (Phone checks will be disabled): System.Exception: Accessing Globals failed! Invalid Memory Address! at unmanaged.MemoryAccess.GetGlobalAddress(Int32 index) at unmanaged.MemoryAccess.GetPhoneNumber() at GTA.NetHook.CheckPhone() 2010-08-25 21:05:54 - ...successfully started script 'HaltBehindScript'! 2010-08-25 21:05:54 - ...successfully started script 'TrainerMenuScript.TrafficCorrect'! 2010-08-25 21:05:54 - ...successfully started script 'Speedlimit+SpeedDisplay'! 2010-08-25 21:05:54 - ...successfully started script 'Speedlimit'! 2010-08-25 21:05:54 - ...successfully started script 'gkFuelMod.fuelMod'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Various'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Start'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.inputSimulator'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Partner'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Functions'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Flashlight'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Debug'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Actions'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.PullOver'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Frisk'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Disarm'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Chase'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Carboot'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Backup'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.Arrest'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCPD.HQ'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.TextDraw'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.Callouts'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.DeletionList'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCMD.Functions'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.LCMD.Main'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.Main.Start'! 2010-08-25 21:05:54 - ...successfully started script 'FirstResponse.Main.EmergencyLights'! Edited August 25, 2010 by Hypertenzion Link to comment Share on other sites More sharing options...
Symbiote Posted August 25, 2010 Share Posted August 25, 2010 Hmm strange, I don't see the reverse script anywhere in your log. Are you absolutely sure the file is named and located correctly? If so, I'm not sure what the problem could be... All I can think of is some kind of version conflict. I use version 1.7.1.6 of the scripthook and GTA4 1.0.4.0. Link to comment Share on other sites More sharing options...
Accountclosed Posted August 26, 2010 Share Posted August 26, 2010 Hmm strange, I don't see the reverse script anywhere in your log. Are you absolutely sure the file is named and located correctly? If so, I'm not sure what the problem could be... All I can think of is some kind of version conflict. I use version 1.7.1.6 of the scripthook and GTA4 1.0.4.0. Neither do I?! I am absolutely sure that I named it correctly and put it in the right folder. The version conflict would be the best suggestion I use 1.7.1.6, but Scripthook states that the version is 1.7.1.4. The author of Scripthook probably missed the "version" part in the output of the log Link to comment Share on other sites More sharing options...
Symbiote Posted August 26, 2010 Share Posted August 26, 2010 Well, I'm not so sure about that. Here's my log file. You'll notice that it says version 1.7.1.6. 2010-08-25 22:23:20 - Initializing ScriptHookDotNet v1.7.1.6 BETA (GTA IV version 1.0.4.0)2010-08-25 22:24:23 - Direct3D device created! 2010-08-25 22:24:24 - SEARCHING FOR SCRIPTS... 2010-08-25 22:24:24 - Loading dynamic scriptfile 'scripts\HaltBehindScript.vb' ... 2010-08-25 22:24:26 - ...found script 'HaltBehindScript'! 2010-08-25 22:24:26 - Loading dynamic scriptfile 'scripts\HurryUp.vb' ... 2010-08-25 22:24:26 - ...found script 'HurryUp'! 2010-08-25 22:24:26 - Loading dynamic scriptfile 'scripts\NearDeath.vb' ... 2010-08-25 22:24:26 - ...found script 'NearDeath'! 2010-08-25 22:24:26 - Loading dynamic scriptfile 'scripts\RemoveArmor.vb' ... 2010-08-25 22:24:26 - ...found script 'RemoveArmor'! 2010-08-25 22:24:26 - Loading dynamic scriptfile 'scripts\RemoveRadar.vb' ... 2010-08-25 22:24:27 - ...found script 'RemoveRadar'! 2010-08-25 22:24:27 - Loading dynamic scriptfile 'scripts\SmokeWeed.vb' ... 2010-08-25 22:24:27 - ...found script 'SmokeWeed'! 2010-08-25 22:24:27 - Loading dynamic scriptfile 'scripts\DamageInCar.cs' ... 2010-08-25 22:24:27 - ...found script 'DamageInCar'! 2010-08-25 22:24:27 - Loading dynamic scriptfile 'scripts\ManualReverse.cs' ... 2010-08-25 22:24:27 - ...found script 'ManualReverse'! 2010-08-25 22:24:27 - DONE! 8 valid scripts found! 2010-08-25 22:24:27 - STARTING SCRIPTS... 2010-08-25 22:24:28 - ...successfully started script 'ManualReverse'! 2010-08-25 22:24:28 - ...successfully started script 'DamageInCar'! 2010-08-25 22:24:28 - ...successfully started script 'SmokeWeed'! 2010-08-25 22:24:28 - ...successfully started script 'RemoveRadar'! 2010-08-25 22:24:28 - ...successfully started script 'RemoveArmor'! 2010-08-25 22:24:28 - ...successfully started script 'NearDeath'! 2010-08-25 22:24:28 - ...successfully started script 'HurryUp'! 2010-08-25 22:24:28 - ...successfully started script 'HaltBehindScript'! Link to comment Share on other sites More sharing options...
Accountclosed Posted September 6, 2010 Share Posted September 6, 2010 (edited) Got the script working (Almost) When I stop a car (using "S"), the car stops as expected and the picture somehow freezes (Normal, I presume) But how do I make the car go into reverse? EDIT: Just read the script through and I saw that by using "e", you switch between reverse and forward. Edited September 6, 2010 by Hypertenzion Link to comment Share on other sites More sharing options...
Symbiote Posted September 6, 2010 Share Posted September 6, 2010 I'm glad you got it working. Yes, unfortunately the camera freezing is normal. I don't know how to fix that. The key to switch gears is actually Tab. You can change it by editing this part of the script: "e.Key == Keys.Tab". Just replace Tab with any key in this list: http://msdn.microsoft.com/en-us/library/sy...forms.keys.aspx Link to comment Share on other sites More sharing options...
Accountclosed Posted September 6, 2010 Share Posted September 6, 2010 I'm glad you got it working. Yes, unfortunately the camera freezing is normal. I don't know how to fix that. The key to switch gears is actually Tab. You can change it by editing this part of the script: "e.Key == Keys.Tab". Just replace Tab with any key in this list: http://msdn.microsoft.com/en-us/library/sy...forms.keys.aspx Ah okay. Thx! Btw. Is it possible to make this script compatible with an XBOX 360 controller? Link to comment Share on other sites More sharing options...
Symbiote Posted September 7, 2010 Share Posted September 7, 2010 It may be possible, but I personally don't know how to do it. Link to comment Share on other sites More sharing options...
Symbiote Posted April 24, 2011 Share Posted April 24, 2011 ULTRA BUMP. I just learned how to fix that camera freezing bug. A simple native function: SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS I've updated the code that I posted on page 1, and below are just the two functions that were updated: 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; } Link to comment Share on other sites More sharing options...
ginebra Posted November 30, 2011 Share Posted November 30, 2011 can i ask if there is a fix for this script? a fix that can make the AI cars move with freedom near me because when i continously press the brake button the AI cars neaby stops aswell.... or is there any script that contains auto brake light feature? like in mafia 2 wherein when the car is fully stopped the brake light is automatically turned on... it does not disappear... unlike in IV, it disappears, unless you use this script but nearby AI will stop as well.... Link to comment Share on other sites More sharing options...
Symbiote Posted December 2, 2011 Share Posted December 2, 2011 Yeah, that's a very unfortunate side-effect of taking control away from the player — the police are also forced to stop. That's just how the CanControlCharacter and SET_PLAYER_CONTROL functions work... Physically freezing the player's vehicle looks strange, since it doesn't rock on its suspension when you stop, but it would allow the police to move normally. If you'd like to try that, I think you can just replace these two things: GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", 0);Player.CanControlCharacter = false; GTA.Native.Function.Call("SET_CAMERA_CONTROLS_DISABLED_WITH_PLAYER_CONTROLS", 1);Player.CanControlCharacter = true; with these: Player.Character.CurrentVehicle.FreezePosition = true; Player.Character.CurrentVehicle.FreezePosition = false; Link to comment Share on other sites More sharing options...
ginebra Posted December 3, 2011 Share Posted December 3, 2011 thats better... thx for the help..... Link to comment Share on other sites More sharing options...
thelaststikshipht Posted May 26, 2012 Share Posted May 26, 2012 (edited) First off, if any of you are still willing to respond to this tread, I would like to request permission from the owner/creator to use the code you have posted (as a mod). Secondly, I would like to request your permission to modify it. Thirdly, I would like to know how I can mod it for the game controller controls, rather than the keyboard. I do not know C#, and I don't know how to write mods either. If you would be so kind, could you possibly re-code your mod to include the Xbox 360 Left trigger for brake, Right Trigger for throttle, and Right Bumper for shifting gears? Or tell me how I kind find a tutorial on doing that, or something? Thank you all very much for any responses I get back to this outdated thread. I appreciate it. Edited May 26, 2012 by thelaststikshipht Link to comment Share on other sites More sharing options...
thelaststikshipht Posted August 8, 2012 Share Posted August 8, 2012 I'm glad you got it working. Yes, unfortunately the camera freezing is normal. I don't know how to fix that. The key to switch gears is actually Tab. You can change it by editing this part of the script: "e.Key == Keys.Tab". Just replace Tab with any key in this list: http://msdn.microsoft.com/en-us/library/sy...forms.keys.aspx To make it compatible with XBOX 360 controller, somehow you have to implement the keystrokes as <code>if (GTA.Game.isGameKeyPressed(GTA.GameKey.MoveForward))</code> or something like that. You can find a list of those codeNames in the documentation for the latest scripthook. I'm not sure exactly which button name you would use for the triggers, but I'm sure some one of any intelligence could figure it out through trial and error if they only knew how to impliment the code for the game controller instead of the keyboard. I am trying to work this out myself, but I am very, very new to C#... I only really have any experience in JavaScript... If somebody would be willing to help out, that would be great. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now