Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Windows.Forms;
- using GTA;
- using GTA.Native;
- public class PickPocket : Script
- {
- #region Fields
- private const float MAX_DISTANCE = 0.8F;
- private const int MESSAGE_DISPLAY_TIME = 4000; // Message milliseconds
- private const int SUCCESS_CHANCE = 80;
- private const int RAT_CHANCE = 100; //15
- private const int FIGHT_CHANCE = 51;
- private int copWitnessChance = 50;
- private Ped character = Game.LocalPlayer.Character;
- private Ped theVictim = null;
- private Ped ped = null;
- private Blip theVictimBlip;
- private Blip pedBlip;
- //private Keys keyP;
- #endregion
- #region Constructor
- public PickPocket()
- {
- //this.keyP = Settings.GetValueKey("PickPocket", Keys.R);
- this.Interval = 5000;
- this.KeyDown += new GTA.KeyEventHandler(this.PickPocket_KeyDown);
- this.Tick += new EventHandler(this.BlipEraser_Tick);
- }
- #endregion
- #region Methods
- private void BlipEraser_Tick(object sender, EventArgs e)
- {
- if (Game.Exists(this.ped) && this.ped.isDead)
- this.pedBlip.Delete();
- if (Game.Exists(this.theVictim) && this.theVictim.isDead)
- this.theVictimBlip.Delete();
- }
- private void PickPocket_KeyDown(object sender, GTA.KeyEventArgs e)
- {
- if (!Game.isGameKeyPressed(GameKey.Action) || this.character.Weapons.Current != Weapon.Unarmed)
- return;
- this.theVictim = World.GetClosestPed(this.character.GetOffsetPosition(new Vector3(0.0F, 1.5F, 0.0F)), 1.0F);
- if (!Game.Exists(this.theVictim))
- return;
- if (this.character.Position.DistanceTo(this.theVictim.Position) <= MAX_DISTANCE && !Function.Call<bool>("HAS_CHAR_SPOTTED_CHAR_IN_FRONT", this.theVictim, this.character) && this.theVictim.PedType != PedType.CivFemale && theVictim.PedType != PedType.Bum)
- {
- this.character.Animation.Play(new AnimationSet("amb@beg_standing"), "take_obj", 1.0f);
- if (this.RandomNum(1, 100) <= SUCCESS_CHANCE)
- {
- Player.Money += this.theVictim.Money;
- if (this.theVictim.Money <= 1)
- {
- Game.DisplayText("FFFFFFFFFUUUUUUUUUUUU", MESSAGE_DISPLAY_TIME);
- }
- else
- {
- if (this.RandomNum(1, 100) <= 50)
- {
- Game.DisplayText("All of your wallets are belong to us!", MESSAGE_DISPLAY_TIME);
- }
- else
- {
- if (this.RandomNum(1, 100) <= 50)
- {
- Game.DisplayText("Damn, I'm good!!!", MESSAGE_DISPLAY_TIME);
- }
- else
- {
- Game.DisplayText("Too easy!!!", MESSAGE_DISPLAY_TIME);
- }
- }
- }
- Ped[] nearbyPeds;
- try
- {
- nearbyPeds = World.GetPeds(character.Position, 20.0F);
- }
- catch (Exception ex)
- {
- Game.Console.Print("PickPocket Error: " + ex.Message);
- return; // Abort if GetPeds() failed
- }
- foreach (Ped ped in nearbyPeds)
- {
- if (!Game.Exists(ped) || ped == this.character || !Function.Call<bool>("HAS_CHAR_SPOTTED_CHAR_IN_FRONT", ped, this.character))
- continue;
- this.ped = ped;
- // If ped is a cop, check if he witnessed
- if (this.ped.PedType == PedType.Cop)
- {
- if (this.RandomNum(1, 100) <= this.copWitnessChance)
- {
- Game.DisplayText("Police saw you, GTFO!!", MESSAGE_DISPLAY_TIME);
- if (Player.WantedLevel == 0)
- Player.WantedLevel = 1;
- break;
- }
- }
- else if (this.ped.PedType != PedType.Cop && this.ped.PedType != PedType.Criminal && this.character.Position.DistanceTo(this.ped.Position) <= 5.0F) // If ped is not a cop, check if he is a rat.
- {
- if (this.RandomNum(1, 100) <= RAT_CHANCE)
- {
- this.ped.Task.FleeFromChar(this.character);
- this.Wait(2000);
- this.ped.Task.UseMobilePhone();
- Game.DisplayText("You hear somebody reporting you to the police!!", 2000);
- this.Wait(2000);
- this.ped.Task.FleeFromChar(this.character);
- Game.DisplayText("Kill the Rat quickly and get out of there!!", MESSAGE_DISPLAY_TIME);
- this.pedBlip = this.ped.AttachBlip();
- this.pedBlip.Color = BlipColor.DarkRed;
- this.Wait(2500);
- Game.DisplayText("Here come the police!! I don't know about you but I'm outta here D:", MESSAGE_DISPLAY_TIME);
- this.Wait(1500);
- if (Player.WantedLevel == 0)
- Player.WantedLevel = 1;
- break;
- }
- }
- }
- }
- else
- {
- Game.DisplayText("You were caught!!", MESSAGE_DISPLAY_TIME);
- this.Wait(4000);
- if (this.RandomNum(1, 100) <= FIGHT_CHANCE)
- {
- this.theVictim.Animation.Play(new AnimationSet("amb@bouncer_idles_a"), "crack_knucles", 1.0F);
- this.theVictimBlip = this.theVictim.AttachBlip();
- this.theVictimBlip.Color = BlipColor.DarkRed;
- Game.DisplayText("That bitch took my wallet!!");
- this.Wait(2000);
- this.theVictim.Task.FightAgainst(this.character);
- Game.DisplayText("Show this tough guy who he is messing with!", MESSAGE_DISPLAY_TIME);
- }
- else
- {
- this.theVictim.Task.FleeFromChar(this.character);
- this.theVictimBlip = this.theVictim.AttachBlip();
- this.theVictimBlip.Color = BlipColor.LightYellow;
- Game.DisplayText("MY MONEY!! That guy took my wallet!!", MESSAGE_DISPLAY_TIME);
- this.Wait(3000);
- this.theVictim.Task.UseMobilePhone();
- Game.DisplayText("He is calling the police, you better run!!", MESSAGE_DISPLAY_TIME);
- this.Wait(5000);
- if (Player.WantedLevel == 0)
- Player.WantedLevel = 1;
- }
- }
- }
- }
- private int RandomNum(int min, int max)
- {
- return new Random().Next(min, max + 1);
- }
- #endregion
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement