Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Math;
- using GTA.Native;
- using System;
- using System.IO;
- using System.Windows.Forms;
- public class ScriptTest : Script
- {
- string ScriptName = "Bait Car";
- string ScriptVer = "1.0";
- Vehicle StolenVeh;
- Vector3 StolenPos;
- public ScriptTest()
- {
- Tick += OnTick;
- Interval = 500;
- }
- void OnTick(object sender, EventArgs e)
- {
- Vehicle veh = Game.Player.Character.GetVehicleIsTryingToEnter();
- if (CanWeUse(StolenVeh) && Game.Player.WantedLevel > 0) StolenVeh = null;
- if (IsPlayerInThecity() && !CanWeUse(StolenVeh))
- {
- if (Game.Player.WantedLevel == 0 && CanWeUse(veh) && veh.NeedsToBeHotwired && !veh.EngineRunning && !CanWeUse(veh.GetPedOnSeat(VehicleSeat.Driver)))
- {
- Ped propietary = Function.Call<Ped>(GTA.Native.Hash.GET_LAST_PED_IN_VEHICLE_SEAT, veh, -1);
- if(propietary != Game.Player.Character)
- {
- StolenVeh = veh;
- StolenPos = veh.Position;
- }
- }
- }
- else if (!Game.Player.Character.IsInRangeOf(StolenPos, 100f))
- {
- if (Game.Player.Character.IsInVehicle(StolenVeh))
- {
- int baseprob = 10;
- if (IsNightTime()) baseprob += 20;
- if (StolenVeh.ClassType == VehicleClass.Super) baseprob += 30;
- if (StolenVeh.ClassType == VehicleClass.SportsClassics) baseprob += 20;
- if (StolenVeh.ClassType == VehicleClass.Sports) baseprob += 10;
- if (RandomInt(0,100) < baseprob)
- {
- Function.Call(Hash.SET_MAX_WANTED_LEVEL, 5);
- Game.Player.WantedLevel = 1;
- Vehicle police = World.CreateVehicle("police4", World.GetNextPositionOnStreet(Game.Player.Character.Position + (Game.Player.Character.ForwardVector * -50)));
- Ped cop = police.CreatePedOnSeat(VehicleSeat.Driver, "s_m_y_cop_01");
- police.IsPersistent = false;
- cop.IsPersistent = false;
- police.Heading = Game.Player.Character.Heading;
- if (RandomInt(0, 100) > 60) Function.Call(Hash.SET_VEHICLE_UNDRIVEABLE, StolenVeh, true);
- }
- }
- StolenVeh = null;
- StolenPos = Vector3.Zero;
- }
- }
- public static int RandomInt(int min, int max)
- {
- max++;
- return Function.Call<int>(Hash.GET_RANDOM_INT_IN_RANGE, min, max);
- }
- bool CanWeUse(Entity entity)
- {
- return entity != null && entity.Exists();
- }
- bool IsPlayerInThecity()
- {
- return Game.Player.Character.IsInRangeOf(new Vector3(-217, -1285, 40), 3000);
- }
- public static bool IsNightTime()
- {
- int hour = Function.Call<int>(Hash.GET_CLOCK_HOURS);
- return (hour > 20 || hour < 7);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement