ronxs Posted August 23, 2009 Share Posted August 23, 2009 Can someone make a script that u be able to turn flash lights with no siren and if u want with siren too. That will be awsome. or i can try to do that by myself i just need to know what script i need to start with. Link to comment Share on other sites More sharing options...
Wheezle Posted August 24, 2009 Share Posted August 24, 2009 That will be in this mod when it is finished. Link to comment Share on other sites More sharing options...
ech3lon Posted August 27, 2009 Share Posted August 27, 2009 This C# script will flash lights without siren, when CONTROL+K is pressed in a car. If you dont want certain lights (like hazard lights or headlights) to flash then just comment out the corrosponding native calls. Have fun. public class VehicleSiren : Script {Keys key_specialSiren = Keys.K; Keys key_modifier = Keys.ControlKey; // vars bool specialSiren; bool specialSirenLight; bool hazardLights; Vehicle playerCarSiren; public VehicleSiren() { this.KeyDown += new GTA.KeyEventHandler(this.toggleSirenSpecial_KeyDown); this.Tick += new EventHandler(this.specialSirenTick); specialSiren = false; specialSirenLight = false; hazardLights = false; } //toggle specialSiren public void toggleSirenSpecial_KeyDown(object sender, GTA.KeyEventArgs e) { if ((e.Key != key_specialSiren) || !Game.isKeyPressed(key_modifier)) return; Vehicle car = Player.Character.CurrentVehicle; if (Exists(car)) { if (specialSiren) { GTA.Native.Function.Call("SWITCH_CAR_SIREN", car, 0); car.HazardLightsOn = false; GTA.Native.Function.Call("FORCE_CAR_LIGHTS", car, 0); specialSiren = false; } else { specialSiren = true; } } } // tick method specialSiren public void specialSirenTick(object sender, EventArgs e) { if (!specialSiren) return; if (Player.Character.isInVehicle()) { //Vehicle car = Player.Character.CurrentVehicle; this.playerCarSiren = Player.Character.CurrentVehicle; if (playerCarSiren.Exists()) { hazardLights = !hazardLights; playerCarSiren.HazardLightsOn = hazardLights; if (specialSirenLight) { GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 0); GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 0); specialSirenLight = false; } else { GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 1); GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 1); specialSirenLight = true; } } } else { if (playerCarSiren != null && playerCarSiren.Exists()) { hazardLights = !hazardLights; GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 1); playerCarSiren.HazardLightsOn = hazardLights; if (specialSirenLight) { GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 0); specialSirenLight = false; } else { GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 1); specialSirenLight = true; } } } } } Link to comment Share on other sites More sharing options...
KingBulleT 8747 Posted August 28, 2009 Share Posted August 28, 2009 This C# script will flash lights without siren, when CONTROL+K is pressed in a car.If you dont want certain lights (like hazard lights or headlights) to flash then just comment out the corrosponding native calls. Have fun. public class VehicleSiren : Script {Keys key_specialSiren = Keys.K; Keys key_modifier = Keys.ControlKey; // vars bool specialSiren; bool specialSirenLight; bool hazardLights; Vehicle playerCarSiren; public VehicleSiren() { this.KeyDown += new GTA.KeyEventHandler(this.toggleSirenSpecial_KeyDown); this.Tick += new EventHandler(this.specialSirenTick); specialSiren = false; specialSirenLight = false; hazardLights = false; } //toggle specialSiren public void toggleSirenSpecial_KeyDown(object sender, GTA.KeyEventArgs e) { if ((e.Key != key_specialSiren) || !Game.isKeyPressed(key_modifier)) return; Vehicle car = Player.Character.CurrentVehicle; if (Exists(car)) { if (specialSiren) { GTA.Native.Function.Call("SWITCH_CAR_SIREN", car, 0); car.HazardLightsOn = false; GTA.Native.Function.Call("FORCE_CAR_LIGHTS", car, 0); specialSiren = false; } else { specialSiren = true; } } } // tick method specialSiren public void specialSirenTick(object sender, EventArgs e) { if (!specialSiren) return; if (Player.Character.isInVehicle()) { //Vehicle car = Player.Character.CurrentVehicle; this.playerCarSiren = Player.Character.CurrentVehicle; if (playerCarSiren.Exists()) { hazardLights = !hazardLights; playerCarSiren.HazardLightsOn = hazardLights; if (specialSirenLight) { GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 0); GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 0); specialSirenLight = false; } else { GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 1); GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 1); specialSirenLight = true; } } } else { if (playerCarSiren != null && playerCarSiren.Exists()) { hazardLights = !hazardLights; GTA.Native.Function.Call("SWITCH_CAR_SIREN", playerCarSiren, 1); playerCarSiren.HazardLightsOn = hazardLights; if (specialSirenLight) { GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 0); specialSirenLight = false; } else { GTA.Native.Function.Call("FORCE_CAR_LIGHTS", playerCarSiren, 1); specialSirenLight = true; } } } } } Can you give a download for this mod as ready file? (Asi is C# i think) Link to comment Share on other sites More sharing options...
ronxs Posted August 28, 2009 Author Share Posted August 28, 2009 I tried building it in Visual C# 2008 and i had thouse errors: http://img216.imageshack.us/img216/5616/errors.png Please help. or build it and upload please Link to comment Share on other sites More sharing options...
ech3lon Posted August 28, 2009 Share Posted August 28, 2009 I compiled a .net.dll for you. Instructions on how to use, as well as the source code, if you want to modify the script, are in the archive. Download Link: http://rapidshare.com/files/272788995/flashlights.zip Link to comment Share on other sites More sharing options...
ronxs Posted August 28, 2009 Author Share Posted August 28, 2009 (edited) Thank you very much ill try it right now. p.s. i did wat u said in the private massage and i solved the problem with the system.windows.forms but now i still have 1 error with using GTA; how do i add it? Edited August 29, 2009 by ronxs Link to comment Share on other sites More sharing options...
FilRip Posted August 29, 2009 Share Posted August 29, 2009 Add a "reference" to your project to ScriptHookDotNet.dll. I suppose it was what you missing. (as it write in the official thread of the creator of the dot net script for gta4 : http://www.gtaforums.com/index.php?showtopic=392325) Link to comment Share on other sites More sharing options...
ronxs Posted August 29, 2009 Author Share Posted August 29, 2009 Add a "reference" to your project to ScriptHookDotNet.dll. I suppose it was what you missing. (as it write in the official thread of the creator of the dot net script for gta4 : http://www.gtaforums.com/index.php?showtopic=392325) i did that and it sloved some errors but now i have 1 error left. how do i solve this one? Link to comment Share on other sites More sharing options...
ech3lon Posted August 29, 2009 Share Posted August 29, 2009 (edited) I'm not sure. What is the _exact_ error you have? Maybe copy and paste it from visual studio. And also paste your includes. (using xxxxx), so I can see what the problem is. Edited August 29, 2009 by ech3lon 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