private void MOD_Tick(object sender, EventArgs e) { if (ActiveFlag) { V = GTA.World.CreateVehicle("BLISTA", Player.Character.Position.Around(5.0f)); if (!Exists(V)) { return; } if (Exists(V)) { V.NoLongerNeeded(); } V.CreatePedOnSeat(VehicleSeat.Driver); V.CreatePedOnSeat(VehicleSeat.RightFront); peds[0] = V.GetPedOnSeat(VehicleSeat.Driver); peds[1] = V.GetPedOnSeat(VehicleSeat.RightFront); for (int i = 0; i < 2; i++) { if (Exists(peds[i])) { peds[i].NoLongerNeeded(); } } V = null; ActiveFlag = false; } }
public void OnKeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.F2) foreach (var v in World.GetNearbyVehicles(Game.Player.Character.Position, 10)) v.Delete(); if (e.KeyCode == Keys.K) Function.Call(Hash.SET_TIME_SCALE, 1.0f); if (e.KeyCode == Keys.F3) Game.Player.Character.Position = _busPosition; if (e.KeyCode == Keys.J && _isTransitioning) { _driver.Delete(); Game.Player.Character.SetIntoVehicle(Game.Player.Character.CurrentVehicle, VehicleSeat.Driver); Function.Call(Hash.SET_TIME_SCALE, 1f); _isTransitioning = false; } if (e.KeyCode == Keys.F && World.GetDistance(Game.Player.Character.Position, _startPosition) < 2f && !_activateMod) { //Check for previous spawned busses foreach (var b in World.GetActiveBlips().Where(b => (b.Color == BlipColor.Blue))) b.Remove(); foreach ( var v in World.GetAllVehicles().Where(v => (v.GetPedOnSeat(VehicleSeat.Driver).Model == "A_C_Chimp"))) v.Delete(); _activateMod = true; _bus = World.CreateVehicle("Bus", _busPosition); _driver =_bus.CreatePedOnSeat(VehicleSeat.Driver, new Model("A_C_Chimp")); _busBlip = _bus.AddBlip(); _busBlip.Color = BlipColor.Blue; _busBlip.Name = "Bus"; _busBlip.ShowRoute = _busBlip.IsFriendly = true; } }
//ヘリを生成して、市民を中に乗せる private void CreateHeli() { heli = GTA.World.CreateVehicle("MAVERICK",Player.Character.Position + new Vector3(0,0,100)); if (Exists(heli)) { //ヘリ生成に成功したら heli.MakeProofTo(false, true, true, true, true); heli.EngineHealth = 3000; heli.PetrolTankHealth = 3000; if (Exists(driver)) { driver.NoLongerNeeded(); } driver = heli.CreatePedOnSeat(VehicleSeat.Driver); if (Exists(driver)) { driver.Money = 500; driver.Invincible = true; } if (Exists(p[0])) { p[0].NoLongerNeeded(); } if (Exists(p[1])) { p[1].NoLongerNeeded(); } if (Exists(p[2])) { p[2].NoLongerNeeded(); } p[0] = heli.CreatePedOnSeat(VehicleSeat.LeftRear); p[1] = heli.CreatePedOnSeat(VehicleSeat.RightFront); p[2] = heli.CreatePedOnSeat(VehicleSeat.RightRear); for (int i = 0; i < 3; i++) { if (Exists(p[i])) { p[i].MaxHealth = 500; p[i].Health = 500; } } Timer = 40 * 2; } }
private void Bombat_Tick(object sender, EventArgs e) { if (AllF == true) { if (!Player.Character.isAlive) { Reset(); AllF = false; return; } Vector3 Pos = Player.Character.Position; if (!Exists(heli)) { heli = GTA.World.CreateVehicle("MAVERICK",Pos.Around(5.0f)); if (Exists(driver)) { driver.Delete(); } driver = heli.CreatePedOnSeat(VehicleSeat.Driver); return; } else { if (Player.Character.isInVehicle(heli) || Pos.DistanceTo(heli.Position)>50.0f || !heli.isAlive) { Reset(); AllF = false; } if (Exists(driver)) { if (driver.isInVehicle(heli)) { driver.Money = 500; driver.Invincible = true; } else { driver.WarpIntoVehicle(heli, VehicleSeat.Driver); } } else { driver = heli.CreatePedOnSeat(VehicleSeat.Driver); return; } Blip tar = GTA.Game.GetWaypoint(); if (Exists(tar)) { if (tar.Position.DistanceTo(tar.Position) > 50) { driver.Task.DriveTo(tar.Position+new Vector3(0,0,20), 50, false); } else { driver.Task.DriveTo(tar.Position, 30, false); } } else { Reset(); AllF = false; } } } }