Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // https://www.gta5-mods.com/scripts/simple-passenger-mod
- // By: Rooft0p
- using GTA;
- using GTA.Math;
- using GTA.Native;
- using System;
- using System.Windows.Forms;
- namespace Moochaka
- {
- public class Passenger : Script
- {
- private bool ModOn;
- private bool driving;
- private bool WPactive;
- private bool MH;
- private bool Speed;
- private Keys EnterVehicle;
- private Keys ExitVehicle;
- private Keys Drive;
- private Keys Mayhem;
- private Keys skipRadio;
- public Passenger()
- {
- base.\u002Ector();
- this.EnterVehicle = Keys.E;
- this.ExitVehicle = Keys.F;
- this.Drive = Keys.Space;
- this.Mayhem = Keys.Delete;
- this.skipRadio = Keys.Q;
- this.add_KeyDown(new KeyEventHandler(this.Passenger_KeyDown));
- this.add_Tick(new EventHandler(this.Passenger_Tick));
- }
- private void Passenger_Tick(object sender, EventArgs e)
- {
- Ped character = Game.get_Player().get_Character();
- character.get_CurrentVehicle();
- this.WPactive = Function.Call<bool>((Hash) 2148768492990438821, new InputArgument[0]) != null;
- if (this.ModOn && this.driving && !this.WPactive)
- this.EndRoute();
- if (!character.IsInVehicle())
- {
- this.ModOn = false;
- this.driving = false;
- this.MH = false;
- this.Speed = false;
- }
- if (!((Entity) character).get_IsDead())
- return;
- this.ModOn = false;
- this.driving = false;
- this.MH = false;
- this.Speed = false;
- }
- private void Passenger_KeyDown(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == this.EnterVehicle)
- {
- Ped character = Game.get_Player().get_Character();
- Vehicle closestVehicle = World.GetClosestVehicle(((Entity) character).get_Position(), 12f);
- Vehicle currentVehicle = character.get_CurrentVehicle();
- if (!character.IsInVehicle() && ((Entity) closestVehicle).Exists())
- {
- character.get_Task().EnterVehicle(closestVehicle, (VehicleSeat) 0);
- character.set_CanBeDraggedOutOfVehicle(false);
- this.Print("Enter Vehicle as Passenger", 7000);
- Script.Wait(5000);
- this.Print(closestVehicle.get_DisplayName(), 3000);
- this.ModOn = true;
- }
- else
- {
- if (!this.ModOn || !((Entity) currentVehicle).Exists())
- return;
- character.get_Task().ShuffleToNextVehicleSeat(currentVehicle);
- character.set_CanBeDraggedOutOfVehicle(false);
- this.Print("Switch Seats", 5000);
- this.ModOn = false;
- this.driving = false;
- this.MH = false;
- this.Speed = false;
- }
- }
- else if (e.KeyCode == this.ExitVehicle)
- {
- Ped character = Game.get_Player().get_Character();
- Vehicle currentVehicle = character.get_CurrentVehicle();
- if (!((Entity) currentVehicle).Exists() || !character.IsInVehicle(currentVehicle) || !this.ModOn)
- return;
- this.ModOn = false;
- this.driving = false;
- this.MH = false;
- this.Speed = false;
- }
- else if (e.KeyCode == this.Drive)
- {
- Ped character = Game.get_Player().get_Character();
- Vehicle currentVehicle = character.get_CurrentVehicle();
- if (this.ModOn && character.IsInVehicle() && (Function.Call<bool>((Hash) 2148768492990438821, new InputArgument[0]) != null && !this.Speed))
- {
- Vector3 vector3 = (Vector3) Function.Call<Vector3>((Hash) 6371184173552343406, new InputArgument[1]
- {
- InputArgument.op_Implicit((int) Function.Call<int>((Hash) 2012513321047894559, new InputArgument[1]
- {
- InputArgument.op_Implicit((int) Function.Call<int>((Hash) 1760446918642962045, new InputArgument[1]
- {
- InputArgument.op_Implicit(true)
- }))
- }))
- });
- Ped[] nearbyPeds = World.GetNearbyPeds(Game.get_Player().get_Character(), 10f);
- for (int index = 0; index <= 0; ++index)
- {
- if (((Entity) nearbyPeds[index]).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle))
- {
- nearbyPeds[index].get_Task().ParkVehicle(currentVehicle, vector3, ((Entity) character).get_Heading());
- this.Print("Drive To Waypoint", 4000);
- Function.Call((Hash) 7477453855356397301, new InputArgument[4]
- {
- InputArgument.op_Implicit(-1),
- InputArgument.op_Implicit("NAV_UP_DOWN"),
- InputArgument.op_Implicit("HUD_FRONTEND_DEFAULT_SOUNDSET"),
- InputArgument.op_Implicit(0)
- });
- this.driving = true;
- this.Speed = true;
- }
- }
- }
- else
- {
- if (!this.ModOn || !character.IsInVehicle() || (Function.Call<bool>((Hash) 2148768492990438821, new InputArgument[0]) == null || !this.Speed))
- return;
- Vector3 vector3 = (Vector3) Function.Call<Vector3>((Hash) 6371184173552343406, new InputArgument[1]
- {
- InputArgument.op_Implicit((int) Function.Call<int>((Hash) 2012513321047894559, new InputArgument[1]
- {
- InputArgument.op_Implicit((int) Function.Call<int>((Hash) 1760446918642962045, new InputArgument[1]
- {
- InputArgument.op_Implicit(true)
- }))
- }))
- });
- Ped[] nearbyPeds = World.GetNearbyPeds(Game.get_Player().get_Character(), 10f);
- for (int index = 0; index <= 0; ++index)
- {
- if (((Entity) nearbyPeds[index]).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle))
- {
- nearbyPeds[index].get_Task().DriveTo(currentVehicle, vector3, 10f, 23f, 7);
- this.Print("Drive To Waypoint (Fast)", 4000);
- Function.Call((Hash) 7477453855356397301, new InputArgument[4]
- {
- InputArgument.op_Implicit(-1),
- InputArgument.op_Implicit("NAV_UP_DOWN"),
- InputArgument.op_Implicit("HUD_FRONTEND_DEFAULT_SOUNDSET"),
- InputArgument.op_Implicit(0)
- });
- this.driving = true;
- this.Speed = false;
- }
- }
- }
- }
- else if (e.KeyCode == this.Mayhem)
- {
- Vehicle currentVehicle = Game.get_Player().get_Character().get_CurrentVehicle();
- Ped[] nearbyPeds = World.GetNearbyPeds(Game.get_Player().get_Character(), 10f);
- for (int index = 0; index <= 0; ++index)
- {
- if (((Entity) currentVehicle).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle) && (this.ModOn && !this.MH))
- {
- nearbyPeds[index].set_BlockPermanentEvents(true);
- nearbyPeds[index].get_Task().CruiseWithVehicle(currentVehicle, 38f, 6);
- this.MH = true;
- this.driving = false;
- this.Speed = false;
- Function.Call((Hash) 7477453855356397301, new InputArgument[4]
- {
- InputArgument.op_Implicit(-1),
- InputArgument.op_Implicit("NAV_UP_DOWN"),
- InputArgument.op_Implicit("HUD_FRONTEND_DEFAULT_SOUNDSET"),
- InputArgument.op_Implicit(0)
- });
- this.Print("Drive By Enabled", 4000);
- }
- else if (((Entity) currentVehicle).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle) && (this.ModOn && this.MH))
- {
- nearbyPeds[index].set_BlockPermanentEvents(false);
- nearbyPeds[index].get_Task().CruiseWithVehicle(currentVehicle, 16f, 1);
- this.MH = false;
- this.driving = false;
- this.Speed = false;
- Function.Call((Hash) 7477453855356397301, new InputArgument[4]
- {
- InputArgument.op_Implicit(-1),
- InputArgument.op_Implicit("NAV_UP_DOWN"),
- InputArgument.op_Implicit("HUD_FRONTEND_DEFAULT_SOUNDSET"),
- InputArgument.op_Implicit(0)
- });
- this.Print("Drive By Disabled", 4000);
- }
- }
- }
- else
- {
- if (e.KeyCode != this.skipRadio)
- return;
- Vehicle currentVehicle = Game.get_Player().get_Character().get_CurrentVehicle();
- Ped[] nearbyPeds = World.GetNearbyPeds(Game.get_Player().get_Character(), 4f);
- for (int index = 0; index <= 0; ++index)
- {
- if (this.ModOn && ((Entity) nearbyPeds[index]).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle))
- {
- Function.Call((Hash) 7916129512124750885, new InputArgument[0]);
- this.Print("Skip Radio", 2000);
- }
- }
- }
- }
- private void EndRoute()
- {
- Vehicle currentVehicle = Game.get_Player().get_Character().get_CurrentVehicle();
- Ped[] nearbyPeds = World.GetNearbyPeds(Game.get_Player().get_Character(), 4f);
- for (int index = 0; index <= 0; ++index)
- {
- if (((Entity) nearbyPeds[index]).Exists() && nearbyPeds[index].IsInVehicle(currentVehicle))
- {
- this.driving = false;
- this.MH = false;
- this.Speed = false;
- Script.Wait(10000);
- nearbyPeds[index].get_Task().CruiseWithVehicle(currentVehicle, 16f, 1);
- }
- }
- }
- private void Print(string text, int time = 2000)
- {
- Function.Call((Hash) -5153745325143710083, new InputArgument[1]
- {
- InputArgument.op_Implicit("STRING")
- });
- Function.Call((Hash) 7789129354908300458, new InputArgument[1]
- {
- InputArgument.op_Implicit(text)
- });
- Function.Call((Hash) -7100200333308705802, new InputArgument[2]
- {
- InputArgument.op_Implicit(time),
- InputArgument.op_Implicit(1)
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement