IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Post mod/code requests in the Mod Requests topic

Post mod releases in the Mod Showroom

Read the Modding Rules BEFORE posting!

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Need help with a simple bodyguard script (in C#)..

 Tiny bit more adv. than .net scripthook.
 
ThePlague1988  
Posted: Thursday, Sep 13 2012, 17:50
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Nov 1, 2010

us.gif

XXXXX



EDIT: The description isn't complete, it was supposed to be.. "A Tiny bit more advanced than the bodyguard script in .net scripthook."

I would like to know why this isn't working, I tried everything I could think of. I'm an excellant programmer, but just started writing scripts in C# for GTA IV... hope someone could help me out on this. Seriously I have no clue, but I'm close to getting it to work the way I want it. Just can't figure out how to make you guys stop shooting if you don't target anyone.. and press NumPad1 again. That's supposed to cancel it, but no luck. All it does is cause an error saying, something like

CODE
2012-09-13 13:19:36 - STARTING SCRIPTS...
2012-09-13 13:19:36 - INFO: Phone number checks are not available!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.ConfigurableTeleportScript'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.AnyTaxiScript'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.TextureDrawingExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.ScriptCommunicationExample2'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.ScriptCommunicationExample1'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.BodyguardScript'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.NativeCallExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.EuphoriaExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.TaskSequenceExample2'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.TaskSequenceExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.DrawingExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.InfoAndBindExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.BindKeyExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.PoliceScript'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.InvincibilityScript'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.BasicTickExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.BasicKeyExample'!
2012-09-13 13:19:36 -  ...successfully started script 'TestScriptCS.WindowExapleScript'!
2012-09-13 13:20:10 - Error during Tick in script 'TestScriptCS.BodyguardScript':
                     System.NullReferenceException: Object reference not set to an instance of an object.
                        at GTA.value.Tasks.FightAgainst(Ped target)
                        at TestScriptCS.BodyguardScript.MyTicker(Object sender, EventArgs e)
                        at GTA.Script.TryTick()
                        at GTA.Script.DoTick()
                        at GTA.ScriptThread.OnTick()
2012-09-13 13:20:20 - Direct3D device lost!
2012-09-13 13:20:21 - SCRIPTS TERMINATED!


By the way it would help you to help me if you had my script I'm working on...
It's below:

CODE
using System;
using System.Windows.Forms;
using GTA;

namespace TestScriptCS {


  // ### Spawn Bodyguards with the INSERT key, and kill them with the DELETE key ###
  public class BodyguardScript : Script {

     Group group;
     Ped Target;
     Model PedModel = "M_Y_BOUNCER_02";
     Boolean bKillTarget = false;

     public BodyguardScript() {
        Interval = 250;
        group = Player.Group;

        this.Tick += new EventHandler(MyTicker);
        this.KeyDown += new GTA.KeyEventHandler(this.BodyguardScript_KeyDown);
     }

     private void BodyguardScript_KeyDown(object sender, GTA.KeyEventArgs e) {
        switch (e.Key) {

           case Keys.Insert:
              if (group.MemberCount < 3) { // limit to 3 members, to make sure that all fit in a car
                 Ped p = World.CreatePed(PedModel, Player.Character.Position.Around(3.0F), RelationshipGroup.Player);
                 AddToGroup(p);
              }
              break;

           case Keys.NumPad1:
              if (group.Exists()) {
                  bKillTarget = !bKillTarget;
                 
                  if (bKillTarget) {
                      Target = Player.GetTargetedPed();
                      if (!Exists(Target)) return;
                      Game.DisplayText("Kill task assigned to group...");
                  }
                  else
                  {
                      foreach (Ped member in group)
                      {
                          member.Task.ClearAll();
                          member.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
                      }
                      Game.DisplayText("Kill task canceled for group...");
                  }
              }
              break;

           case Keys.Delete:
              foreach (Ped member in group) {
                 member.Weapons.RemoveAll();
                 member.Die();
              }
              group.RemoveAllMembers();
              break;
        }
     }

     private void MyTicker(object sender, EventArgs e) {
         if (group.Exists()) {
             if (bKillTarget) {
                 bKillTarget = false;
                 foreach (Ped member in group) {
                     member.Task.FightAgainst(Target);
                 }

                 if (!Target.Exists()) {
                     foreach (Ped member in group) {
                         member.Task.ClearSecondary();
                     }
                 }

                 if (Target.isDead) {
                     foreach (Ped member in group) {
                         member.Task.ClearSecondary();
                     }
                 }
             }
             Wait(250);
         }
     }

     private void AddToGroup(Ped p) {
        if (!Exists(p)) return; // check if the ped is valid

        p.CurrentRoom = Player.Character.CurrentRoom; // required, or ped won't be visible when spawned inside a building
        p.Accuracy = 200;
        p.WillDoDrivebys = true;
        p.PriorityTargetForEnemies = true;
        p.DuckWhenAimedAtByGroupMember = false;
        p.AlwaysDiesOnLowHealth = true;
        p.SetPathfinding(true, true, true);

        Weapon weap = Player.Character.Weapons.CurrentType;
        p.Weapons.FromType(weap).Ammo = 30000;
        p.Weapons.MP5.Ammo = 30000;
        p.Weapons.Select(weap); // activate same weapon as the one the player carries

        p.RelationshipGroup = RelationshipGroup.Player;
        p.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
        p.CantBeDamagedByRelationshipGroup(RelationshipGroup.Player, true);

        group.AddMember(p);
        Game.DisplayText(group.MemberCount + " members in gang");
     }

  }

}


This post has been edited by ThePlague1988 on Thursday, Sep 13 2012, 21:00
PMMSNPlayStation Network
  Top
 

 
ch3y3zze  
Posted: Friday, Sep 14 2012, 02:33
Quote Post


ni**erKILLER
Group Icon
Group: BUSTED!
Joined: Aug 30, 2012

us.gif

XXXXX



target is probably null

do this instead

CODE
if (Game.Exists(target))
{
   member.Task.FightAgainst(Target);
}


also and i havent read the entire thing the target should be made a mission character

This post has been edited by ch3y3zze on Friday, Sep 14 2012, 02:37
PM
  Top
 

 
ThePlague1988  
Posted: Friday, Sep 14 2012, 18:15
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Nov 1, 2010

us.gif

XXXXX



Okay I tried it but, it still doesn't work.. maybe I'm putting it in the wrong spot could you perhaps tell me. Thanks in advance.
PMMSNPlayStation Network
  Top
 

 
ch3y3zze  
Posted: Friday, Sep 14 2012, 19:21
Quote Post


ni**erKILLER
Group Icon
Group: BUSTED!
Joined: Aug 30, 2012

us.gif

XXXXX



just replace
CODE
member.Task.FightAgainst(Target);

with what i wrote above

to be safe u can also make sure member exists

CODE
if (Game.Exists(Target) && Game.Exists(member))
{
  member.Task.FightAgainst(Target);
}


also make sure Target is capital, before i wrote target which was wrong (actually capitalizing Target is bad practice, should be camelCase like member but whatever), if u install visual studio u can easily avoid those errors

This post has been edited by ch3y3zze on Friday, Sep 14 2012, 19:25
PM
  Top
 

 
ThePlague1988  
Posted: Saturday, Sep 15 2012, 00:31
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Nov 1, 2010

us.gif

XXXXX



Everything works perfectly until I press Numpad1 without aiming at someone first... It's somewhere in the canceling of the target and i can't figure it out... hmmm here is the
updated code.

CODE
using System;
using System.Windows.Forms;
using GTA;

namespace TestScriptCS {


  // ### Spawn Bodyguards with the INSERT key, and kill them with the DELETE key ###
  public class BodyguardScript : Script {

     Group group;
     Ped Target;
     Model PedModel = "M_Y_BOUNCER_02";
     Boolean bKillTarget = false;

     public BodyguardScript() {
        Interval = 250;
        group = Player.Group;

        this.Tick += new EventHandler(MyTicker);
        this.KeyDown += new GTA.KeyEventHandler(this.BodyguardScript_KeyDown);
     }

     private void BodyguardScript_KeyDown(object sender, GTA.KeyEventArgs e) {
        switch (e.Key) {

           case Keys.Insert:
              if (group.MemberCount < 3) { // limit to 3 members, to make sure that all fit in a car
                 Ped p = World.CreatePed(PedModel, Player.Character.Position.Around(3.0F), RelationshipGroup.Player);
                 AddToGroup(p);
              }
              break;

           case Keys.NumPad1:
              if (group.Exists()) {
                  bKillTarget = !bKillTarget;
                 
                  if (bKillTarget) {
                      Target = Player.GetTargetedPed();
                      if (!Exists(Target)) return;
                      Game.DisplayText("Kill task assigned to group...");
                  }
                  else {
                      foreach (Ped member in group) {
                          if (Exists(member)) {
                              member.Task.ClearSecondary();
                          }
                      }
                      Game.DisplayText("Kill task canceled for group...");
                  }
              }
              break;

           case Keys.Delete:
              foreach (Ped member in group) {
                 member.Weapons.RemoveAll();
                 member.Die();
              }
              group.RemoveAllMembers();
              break;
        }
     }

     private void MyTicker(object sender, EventArgs e) {
         if (group.Exists()) {
             if (bKillTarget) {
                 bKillTarget = false;
                 if (Exists(Target)) {
                     Target.BecomeMissionCharacter();

                     foreach (Ped member in group) {
                         if (Exists(member)) {
                             member.Task.FightAgainst(Target);
                         }
                     }
                 }

                 if (!Target.Exists()) {
                     foreach (Ped member in group) {
                         if (Exists(member)) {
                             member.Task.ClearSecondary();
                         }
                     }
                     if (Exists(Target)) Target.NoLongerNeeded();
                 }

                 if (Target.isDead) {
                     foreach (Ped member in group) {
                         if (Exists(member)) {
                             member.Task.ClearSecondary();
                         }
                     }
                     if (Exists(Target)) Target.NoLongerNeeded();
                 }
             }
             Wait(250);
         }
     }

     private void AddToGroup(Ped p) {
        if (!Exists(p)) return; // check if the ped is valid

        p.CurrentRoom = Player.Character.CurrentRoom; // required, or ped won't be visible when spawned inside a building
        p.Accuracy = 200;
        p.WillDoDrivebys = true;
        p.PriorityTargetForEnemies = true;
        p.DuckWhenAimedAtByGroupMember = false;
        p.AlwaysDiesOnLowHealth = true;
        p.SetPathfinding(true, true, true);

        Weapon weap = Player.Character.Weapons.CurrentType;
        p.Weapons.FromType(weap).Ammo = 30000;
        p.Weapons.MP5.Ammo = 30000;
        p.Weapons.Select(weap); // activate same weapon as the one the player carries

        p.RelationshipGroup = RelationshipGroup.Player;
        p.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
        p.CantBeDamagedByRelationshipGroup(RelationshipGroup.Player, true);

        group.AddMember(p);
        Game.DisplayText(group.MemberCount + " members in gang");
     }

  }

}
PMMSNPlayStation Network
  Top
 

 
ch3y3zze  
Posted: Saturday, Sep 15 2012, 02:15
Quote Post


ni**erKILLER
Group Icon
Group: BUSTED!
Joined: Aug 30, 2012

us.gif

XXXXX



if u want to see how to tell a ped to attack a targeted ped look at my bodyguard script, Friends Mod v3. I do it crash free, this script here is just badly programmed sorry to say

http://www.gta4-mods.com/script/friends-mod-v3-f16821

aim at a ped when your "friends" around and press T

This post has been edited by ch3y3zze on Saturday, Sep 15 2012, 02:18
PM
  Top
 

 
ThePlague1988  
Posted: Saturday, Sep 15 2012, 03:06
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Nov 1, 2010

us.gif

XXXXX



Thanks man I will study your script to find out how to do it...
PMMSNPlayStation Network
  Top
 

 
ThePlague1988  
Posted: Saturday, Sep 15 2012, 18:44
Quote Post


Square Civilian
Group Icon
Group: Members
Joined: Nov 1, 2010

us.gif

XXXXX



Hey man I studied your script and tried to add one more bodyguard, but failed... just on the part where if you're in a two-door car or on a two-seated bike. She doesn't want to jump in another vehicle with Johnny as the driver. Also Johnny won't jump in if she is the driver.. what is wrong please help I got everything else right. Please tell me what I'm doing wrong so I can fix it and learn.. Thanks in advance.

By the way: The Script (Your script Modded by Me)... to make it clear to you what you're looking for (that needs to be gone over) is.
The
CODE
DontJustSitThere (Ped friend, Ped friend2, Ped friendWithRide)

Method

Again I can't thank you enough for what little I learned so far from just you man.. Love ya like a bro.

CODE
namespace Friends
{
   //driver timer autostart
   using System;
   using System.Windows.Forms;
   using System.Drawing;
   using GTA;
   using GTA.Native;

   public class Main : Script
   {
       GTA.Timer drivefromBarTimer, followInRideTimer, lookinTimer;

       Ped f*cked, Luis, Johnny, Karen, driver, looker;
       Vehicle backupVeh;
       GTA.Font LuisFont, JohnnyFont, KarenFont;
       bool displayOn, dontJustSit, lookin;

       Blip vehBlip;
       Vehicle ride;
       float driverDistance;
       float[] headingArray = { 90, -90, 90, -90, -170, 180, 90, 0 };
       Vector3[] barArray = new Vector3[]
       {
           new Vector3(-438.69F, 464.31F, 11F),
           new Vector3(1470, 71, 25),
           new Vector3(957, -300, 20),
           new Vector3(1149, 758, 35),
           new Vector3(1215, 1718, 17),
           new Vector3(35, 980, 15.65F),
           new Vector3(-238, 31, 15.71F),
           new Vector3(-1603, 17, 10.02F)
       };

       bool AllFriendsExist()
       {
           return (Game.Exists(Luis) && Game.Exists(Johnny) && Game.Exists(Karen));
       }
       bool NoFriendsExist()
       {
           return (!Game.Exists(Luis) || !Game.Exists(Johnny) || !Game.Exists(Karen));
       }
       bool OneFriendsExist()
       {
           return (Game.Exists(Luis) || Game.Exists(Johnny) || Game.Exists(Karen));
       }
       bool SeatsAreAvaialble(Vehicle vehicle)
       {
           if (vehicle.PassengerSeats > 1)
           {
               VehicleSeat[] seats = { VehicleSeat.RightFront, VehicleSeat.LeftRear, VehicleSeat.RightRear };
               foreach (VehicleSeat seat in seats)
               {
                   if ((Game.Exists(vehicle.GetPedOnSeat(seat)) && vehicle.GetPedOnSeat(seat).isDead) || vehicle.isSeatFree(seat))
                   {
                       return true;
                   }
               }
               return false;
           }
           else
           {
               VehicleSeat seat = VehicleSeat.RightFront;
               return (Game.Exists(vehicle.GetPedOnSeat(seat)) && vehicle.GetPedOnSeat(seat).isDead) || vehicle.isSeatFree(seat);
           }
       }

       Keys callFriendsKey, toggleDisplayKey, orderAttackKey;
       HealthWithChangedEvents LuisHealthEventHandler, JohnnyHealthEventHandler, KarenHealthEventHandler;

       int carModel;

       GTA.Font indicatorFont;
#if DEBUG
       GTA.Timer debugTimer;
#endif
       public Main()
       {
#if DEBUG
           debugTimer = new GTA.Timer(0);
           debugTimer.Tick += new EventHandler(debugTimer_Tick);
           debugTimer.Start();
#endif
           dontJustSit = true;
           callFriendsKey = Settings.GetValueKey("CALL_FRIENDS_KEY", Keys.F12);
           toggleDisplayKey = Settings.GetValueKey("TOGGLE_HEALTH_DISPLAY_KEY", Keys.OemBackslash);
           orderAttackKey = Settings.GetValueKey("ORDER_ATTACK_TARGETED", Keys.Y);
           carModel = Settings.GetValueInteger("FRIENDS_CAR_MODEL", 2006918058);

           BindKey(callFriendsKey, SpawnBackUp);
           BindKey(toggleDisplayKey, ToggleDisplay);
           BindKey(orderAttackKey, OrderAttackTarget);

           indicatorFont = new GTA.Font(30, FontScaling.Pixel);
           LuisFont = new GTA.Font(26.0F, FontScaling.Pixel);
           LuisFont.Color = Color.WhiteSmoke;
           JohnnyFont = new GTA.Font(26.0F, FontScaling.Pixel);
           JohnnyFont.Color = Color.WhiteSmoke;
           KarenFont = new GTA.Font(26.0F, FontScaling.Pixel);
           KarenFont.Color = Color.WhiteSmoke;
           drivefromBarTimer = new GTA.Timer(5000);
           drivefromBarTimer.Tick += new EventHandler(driveFromBarTimer_Tick);
       }

#if DEBUG
       void debugTimer_Tick(object sender, EventArgs e)
       {
           Game.DisplayText(string.Format("dontJustSit = {0} driverAITimer.IsRunning = {1} driveFromBarTimer.isRunning = {2} lookin = {3} lookinTimer.isRunning = {4} looker exist = {5}", dontJustSit.ToString(), followInRideTimer != null ? followInRideTimer.isRunning : false, drivefromBarTimer != null ? drivefromBarTimer.isRunning : false, lookin, lookinTimer != null ? lookinTimer.isRunning : false, Game.Exists(looker)));
       }
#endif
       void Main_Tick(object sender, EventArgs e)
       {
           if (dontJustSit && AllFriendsExist()) { DontJustSitThere(Luis, Karen, Johnny); }
           if (dontJustSit && AllFriendsExist()) { DontJustSitThere(Karen, Luis, Johnny); }
           if (dontJustSit && AllFriendsExist()) { DontJustSitThere(Johnny, Karen, Luis); }

           if (followInRideTimer != null && Game.Exists(ride) && Game.Exists(driver) && driver.isInVehicle() && driver.CurrentVehicle == ride && !followInRideTimer.isRunning)
           {
               followInRideTimer.Start();
           }

           if (Game.Exists(Luis))
               LuisHealthEventHandler.Health = Luis.Health;
           if (Game.Exists(Johnny))
               JohnnyHealthEventHandler.Health = Johnny.Health;
           if (Game.Exists(Karen))
               KarenHealthEventHandler.Health = Karen.Health;

           CallGangToCar();
           GroupThreatResponse();
           ProtectPlayer();
           CleanUpDead();
       }

       //Other
       void Text(string text, int duration = 2000)
       {
           Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", text, duration, 1);
       }
       void ShuffleSeat(Ped ped)
       {
           Function.Call("TASK_SHUFFLE_TO_NEXT_CAR_SEAT", ped, ped.CurrentVehicle);
       }

       //driver stuff
       void driveFromBarTimer_Tick(object sender, EventArgs e)
       {
           //check for death and abort
           if (!OneFriendsExist() || (!Luis.isAliveAndWell || !Johnny.isAliveAndWell || !Karen.isAliveAndWell))
           {
               ReleaseResources();
               return;
           }
           if (Game.Exists(Luis)) { DriverDrivingAI(Luis); }
           if (backupVeh.Position.DistanceTo(Game.LocalPlayer.Character.Position) < 50)
           {
               backupVeh.MakeProofTo(false, false, false, false, false);
           }

           if (backupVeh.Position.DistanceTo(Game.LocalPlayer.Character.Position) < 10)
           {
               Text("HELLO FRIENDS!!!");

               backupVeh.NoLongerNeeded();
               if (Game.Exists(vehBlip))
                   vehBlip.Delete();

               backupVeh = null; Luis.Task.ClearAll(); Johnny.Task.ClearAll(); Karen.Task.ClearAll();
               PerFrameDrawing += new GraphicsEventHandler(Main_PerFrameDrawing);
               Tick += new EventHandler(Main_Tick); displayOn = true;
               Game.LocalPlayer.Group.AddMember(Luis);
               Game.LocalPlayer.Group.AddMember(Johnny);
               Game.LocalPlayer.Group.AddMember(Karen);
               drivefromBarTimer.Stop();
           }
       }
       void followInRideTimer_Tick(object sender, EventArgs e)
       {
           if (!Game.Exists(driver))
           {
               Game.LocalPlayer.Group.SeparationRange = 75;
               driver = null; ride = null; dontJustSit = true;
               followInRideTimer.Stop();
               return;
           }

           if (!driver.isInGroup || !driver.isAliveAndWell || !driver.isInVehicle())
           {
               Game.LocalPlayer.Group.SeparationRange = 75;
               driver = null; ride = null; dontJustSit = true;
               followInRideTimer.Stop();
               return;
           }
           if (!Game.LocalPlayer.Character.isInVehicle())
           {
               if (Game.Exists(driver))
               {
                   if (driver.Position.DistanceTo(Game.LocalPlayer.Character.Position) > 10)
                   {
                       DriverDrivingAI(driver);
                       return;
                   }
                   driver.Task.GoTo(Game.LocalPlayer.Character);
               }
               Game.LocalPlayer.Group.SeparationRange = 75;
               driver = null; ride = null; dontJustSit = true;
               followInRideTimer.Stop();
               return;
           }
           DriverDrivingAI(driver);
       }
       void lookinTimer_Tick(object sender, EventArgs e)
       {
           if ((followInRideTimer != null && followInRideTimer.isRunning) || !Game.LocalPlayer.Character.isInVehicle())
           {
               looker = null; lookinTimer.Stop(); lookin = false;
               return;
           }
           if (Game.Exists(looker))
           {
               if (looker.isInVehicle() || looker.isGettingIntoAVehicle)
               {
                   looker = null; lookinTimer.Stop(); lookin = false;
               }
               else// if (looker.Velocity.X > 1 && looker.Velocity.Y > 1)
               {
                   ride = FindARide(looker);
               }
           }
       }
       void DriverDrivingAI(Ped driver)
       {
           if (Game.Exists(driver) && Game.Exists(driver.CurrentVehicle))
           {
               if (driver.CurrentVehicle.Speed < 1.0F)
               {
                   driver.CurrentVehicle.Repair();
               }

               driverDistance = driver.Position.DistanceTo(Game.LocalPlayer.Character.Position);
               if (driverDistance > 40)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 55, false);
               }
               else if (driverDistance > 30)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 45, false);
               }
               else if (driverDistance > 20)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 35, false);
               }
               else if (driverDistance > 18)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 25, false);
               }
               else if (driverDistance > 14)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 20, false);
               }
               else if (driverDistance > 12)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 15, false);
               }
               else if (driverDistance > 10)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 10, true);
               }
               else if (driverDistance > 8)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 5, true);
               }
               else if (driverDistance > 6)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 2, true);
               }
               else if (driverDistance > 4)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.Position, 1, true);
               }
               else if (driverDistance > 3)
               {
                   driver.Task.DriveTo(Game.LocalPlayer.Character.GetOffsetPosition(new Vector3(0, 5, 0)), 0, true);
               }
           }
       }
       void CallGangToCar()
       {
           if (Game.LocalPlayer.isPressingHorn)
           {
               if (Game.Exists(Luis))
               {
                   if (!Luis.isInGroup) { Game.LocalPlayer.Group.AddMember(Luis); }
                   if (Luis.CurrentVehicle != Game.LocalPlayer.Character.CurrentVehicle && Luis.Velocity.X < 1 && Luis.Velocity.Y < 1)
                   {
                       if (SeatsAreAvaialble(Game.LocalPlayer.Character.CurrentVehicle))
                       {
                           Luis.Task.EnterVehicle(Game.LocalPlayer.Character.CurrentVehicle, VehicleSeat.AnyPassengerSeat);
                           Text("Get in the motherf*cking CAR!!!!!");
                       }
                       else
                       {
                           StartDriverTimer(Luis);
                       }
                   }
               }
               if (Game.Exists(Johnny))
               {
                   if (!Johnny.isInGroup) { Game.LocalPlayer.Group.AddMember(Johnny); }
                   if (Johnny.CurrentVehicle != Game.LocalPlayer.Character.CurrentVehicle && Johnny.Velocity.X < 1 && Johnny.Velocity.Y < 1)
                   {
                       if (SeatsAreAvaialble(Game.LocalPlayer.Character.CurrentVehicle))
                       {
                           Johnny.Task.EnterVehicle(Game.LocalPlayer.Character.CurrentVehicle, VehicleSeat.AnyPassengerSeat);
                           Text("Get in the motherf*cking CAR!!!!!");
                       }
                       else
                       {
                           StartDriverTimer(Johnny);
                       }
                   }
               }
               if (Game.Exists(Karen))
               {
                   if (!Karen.isInGroup) { Game.LocalPlayer.Group.AddMember(Karen); }
                   if (Karen.CurrentVehicle != Game.LocalPlayer.Character.CurrentVehicle && Karen.Velocity.X < 1 && Karen.Velocity.Y < 1)
                   {
                       if (SeatsAreAvaialble(Game.LocalPlayer.Character.CurrentVehicle))
                       {
                           Karen.Task.EnterVehicle(Game.LocalPlayer.Character.CurrentVehicle, VehicleSeat.AnyPassengerSeat);
                           Text("Get in the motherf*cking CAR!!!!!");
                       }
                       else
                       {
                           StartDriverTimer(Karen);
                       }
                   }
               }
           }
           Wait(1000);
       }
       void DontJustSitThere(Ped friend, Ped friend2, Ped friendWithRide)
       {
           if (friend.isInVehicle() && Game.LocalPlayer.Character.isInVehicle() && friend.CurrentVehicle != Game.LocalPlayer.Character.CurrentVehicle && !friendWithRide.isInVehicle(friend.CurrentVehicle))
           {
               /*if (friend.CurrentVehicle.GetPedOnSeat(VehicleSeat.Driver) == friend && !followInRideTimer.isRunning)
               {
                   StartDriverTimer(friend); dontJustSit = false;
               }
               else */
               if (friend.CurrentVehicle.GetPedOnSeat(VehicleSeat.RightFront) == friend)
               {
                   ShuffleSeat(friend); dontJustSit = false; StartDriverTimer(friend);
                   Wait(500);
               }
               else
               {
                   if (Game.LocalPlayer.Character.CurrentVehicle.isSeatFree(VehicleSeat.None))
                   {
                       if (friend2.isInVehicle() && !friend.isGettingIntoAVehicle && !friend.isInVehicle()) { friend.Task.EnterVehicle(friend2.CurrentVehicle, VehicleSeat.AnyPassengerSeat); }
                       else { friend.Task.EnterVehicle(friend.CurrentVehicle, VehicleSeat.Driver); }
                   }
                   dontJustSit = false; StartDriverTimer(friend);
               }
           }
           else if (Game.LocalPlayer.Character.isInVehicle() && friendWithRide.isInVehicle(Game.LocalPlayer.Character.CurrentVehicle))
           {
               if (!lookin)
               {
                   lookin = true; looker = friend;
                   lookinTimer = new GTA.Timer(1000);
                   lookinTimer.Tick += new EventHandler(lookinTimer_Tick);
                   lookinTimer.Start();
               }
           }
           if (friend2.isInVehicle() && Game.LocalPlayer.Character.isInVehicle() && friend2.CurrentVehicle != Game.LocalPlayer.Character.CurrentVehicle && !friendWithRide.isInVehicle(friend2.CurrentVehicle))
           {
               /*if (friend.CurrentVehicle.GetPedOnSeat(VehicleSeat.Driver) == friend && !followInRideTimer.isRunning)
               {
                   StartDriverTimer(friend); dontJustSit = false;
               }
               else */
               if (friend2.CurrentVehicle.GetPedOnSeat(VehicleSeat.RightFront) == friend2)
               {
                   ShuffleSeat(friend2); dontJustSit = false; StartDriverTimer(friend2);
                   Wait(500);
               }
               else
               {
                   if (Game.LocalPlayer.Character.CurrentVehicle.isSeatFree(VehicleSeat.None))
                   {
                       if (friend.isInVehicle() && !friend2.isGettingIntoAVehicle && !friend2.isInVehicle()) { friend2.Task.EnterVehicle(friend.CurrentVehicle, VehicleSeat.AnyPassengerSeat); }
                       else { friend2.Task.EnterVehicle(friend2.CurrentVehicle, VehicleSeat.Driver); }
                   }
                   dontJustSit = false; StartDriverTimer(friend2);
               }
           }
           else if (Game.LocalPlayer.Character.isInVehicle() && friendWithRide.isInVehicle(Game.LocalPlayer.Character.CurrentVehicle))
           {
               if (!lookin)
               {
                   lookin = true; looker = friend2;
                   lookinTimer = new GTA.Timer(1000);
                   lookinTimer.Tick += new EventHandler(lookinTimer_Tick);
                   lookinTimer.Start();
               }
           }
       }
       void StartDriverTimer(Ped friend)
       {
           ride = Game.Exists(ride) ? ride : FindARide(friend);
           driver = friend;
           followInRideTimer = new GTA.Timer(1000);
           followInRideTimer.Tick += new EventHandler(followInRideTimer_Tick);
       }
       Vehicle FindARide(Ped ped)
       {
           Text("Find A Ride"); Game.LocalPlayer.Group.SeparationRange = 200;
           if (Game.Exists(ped.CurrentVehicle))
           {
               if (ped.CurrentVehicle.GetPedOnSeat(VehicleSeat.RightFront) == ped)
               {
                   ShuffleSeat(ped);
                   return ped.CurrentVehicle;
               }
               else if (ped.CurrentVehicle.GetPedOnSeat(VehicleSeat.LeftRear) == ped || ped.CurrentVehicle.GetPedOnSeat(VehicleSeat.RightRear) == ped)
               {
                   if (!ped.isGettingIntoAVehicle) { ped.Task.EnterVehicle(ped.CurrentVehicle, VehicleSeat.Driver); }
                   return ped.CurrentVehicle;
               }
               return ped.CurrentVehicle;
           }
           /*Vehicle skip = null;
           for (int i = 0; i < 3; i++)
           {
               Vehicle vehicle = World.GetClosestVehicle(ped.Position, 5);

               if (!Game.Exists(vehicle))
                   continue;

               if (vehicle == Game.LocalPlayer.Character.CurrentVehicle)
               {
                   skip = vehicle;
                   continue;
               }
               if (!vehicle.isDriveable || !vehicle.isUpright || !vehicle.isOnAllWheels)
               {
                   skip = vehicle;
                   continue;
               }

               if (vehicle == skip)
                   continue;

               ped.Task.EnterVehicle(vehicle, VehicleSeat.Driver); lookin = false;
               return vehicle;
           }*/
           Vehicle[] vehicleArray = World.GetVehicles(ped.Position, 10);
           foreach (Vehicle vehicle in vehicleArray)
           {
               if (vehicle == Game.LocalPlayer.Character.CurrentVehicle)
                   continue;

               if (!vehicle.isDriveable || !vehicle.isUpright || !vehicle.isOnAllWheels)
                   continue;

               ped.Task.EnterVehicle(vehicle, VehicleSeat.Driver);
               return vehicle;
           }
           Text("No Ride Found");
           return null;
       }


       //Combat
       void OrderAttackTarget()
       {
           Ped ped = Game.LocalPlayer.GetTargetedPed();

           if (!Game.Exists(ped))
               return;

           Text("Kill that bitch!");
           Game.LocalPlayer.WantedLevel = ped.PedType == PedType.Cop && Game.LocalPlayer.WantedLevel < 2 ? 2 : Game.LocalPlayer.WantedLevel;
           foreach (Ped groupMember in Game.LocalPlayer.Group)
           {
               if (groupMember == Game.LocalPlayer.Character)
                   continue;

               groupMember.Task.FightAgainst(ped);
           }
       }
       void PedAttackTarget(Ped ped, Ped target)
       {
           ped.WantedByPolice = true;
           ped.Task.FightAgainst(target);
       }
       void GroupThreatResponse()
       {
           if (Game.LocalPlayer.Group.MemberCount > 0)
           {
               Ped[] group = Game.LocalPlayer.Group.ToArray(false);
               foreach (Ped ped in group)
               {
                   if (ped.Metadata.attacking == null) { ped.Metadata.attacking = false; }
                   Ped[] attackerArray = World.GetPeds(Game.LocalPlayer.Character.Position, 20);
                   foreach (Ped attacker in attackerArray)
                   {
                       if (attacker == Game.LocalPlayer.Character)
                           continue;

                       if (Function.Call<bool>("HAS_CHAR_BEEN_DAMAGED_BY_CHAR", Game.LocalPlayer.Character, attacker))// && !ped.Metadata.attacking && attacker.RelationshipGroup != ped.RelationshipGroup && attacker.isAlive)
                       {
                           ped.Metadata.attacking = true;
                           PedAttackTarget(ped, attacker);
                           f*cked = attacker;
                       }
                   }
                   if (Game.Exists(f*cked))
                   {
                       PedAttackTarget(f*cked, ped);
                   }
               }
           }
           if (Game.Exists(f*cked) && f*cked.isDead)
           {
               f*cked = null;
               Ped[] group = Game.LocalPlayer.Group.ToArray(false);
               foreach (Ped ped in group)
               {
                   ped.Metadata.attacking = false;
               }
           }
       }
       void ProtectPlayer()
       {
           Ped deadMotherf*cker = Game.LocalPlayer.GetTargetedPed();
           if (!Game.Exists(deadMotherf*cker) || !Game.LocalPlayer.Character.isShooting)
               return;

           foreach (Ped ped in Game.LocalPlayer.Group)
           {
               if (ped == Game.LocalPlayer.Character)
                   continue;

               PedAttackTarget(ped, deadMotherf*cker);
           }
       }

       //Spawn
       void SpawnBackUp()
       {
           if (OneFriendsExist())
           {
               Text("BYE BYE FRIENDS!!");
               ReleaseResources();
               return;
           }

           Game.LocalPlayer.Character.Task.UseMobilePhone(3000);
           Wait(1500);

           if (Game.LocalPlayer.Character.Model == "PLAYER")
           {
               if (new Random().Next(0, 2) == 0)
               {
                   Game.LocalPlayer.Character.SayAmbientSpeech("THANKS");
               }
               else
               {
                   Game.LocalPlayer.Character.SayAmbientSpeech("POOL_PLAYER_POTS_MANY");
               }
           }
           else
           {
               Game.LocalPlayer.Character.SayAmbientSpeech("GENERIC_HI");
           }

           float shortestDistance = 999; int index = -1;
           for (int i = 0; i < barArray.Length; i++)
           {
               float distance = barArray[i].DistanceTo(Game.LocalPlayer.Character.Position);

               if (distance < 50)
                   continue;

               index = distance < shortestDistance ? i : index;
               shortestDistance = distance < shortestDistance ? distance : shortestDistance;
           }

           try
           {
               backupVeh = World.CreateVehicle(new Model(carModel), barArray[index]);
               backupVeh.Heading = headingArray[index];
               backupVeh.isRequiredForMission = true;
               vehBlip = backupVeh.AttachBlip();
               vehBlip.Color = BlipColor.Yellow;
               vehBlip.Name = "Friends";
               backupVeh.MakeProofTo(true, true, true, true, true);
           }
           catch (Exception ex) { Game.Console.Print("Backup Vehicle Spawn Failed: " + ex.ToString()); Text("Vehicle Failed"); return; }

           try
           {
               Luis = SpawnBackup("IG_LUIS", backupVeh, VehicleSeat.Driver);
           }
           catch (Exception ex) { Game.Console.Print("Luis Spawn Failed: " + ex.ToString()); Text("Luis Failed"); backupVeh.Delete(); return; }
           try
           {
               Johnny = SpawnBackup("IG_JOHNNYBIKER", backupVeh, VehicleSeat.RightFront);
           }
           catch (Exception ex) { Game.Console.Print("Johnny Spawn Failed: " + ex.ToString()); Text("Jonnhy Failed"); backupVeh.Delete(); Luis.Delete(); return; }
           try
           {
               Karen = SpawnBackup("IG_MICHELLE", backupVeh, VehicleSeat.LeftRear);
           }
           catch (Exception ex) { Game.Console.Print("Michelle Spawn Failed: " + ex.ToString()); Text("Michelle Failed"); backupVeh.Delete(); Luis.Delete(); Johnny.Delete(); return; }

           if (AllFriendsExist())
           {
               Text("FRIENDS ON THE WAY!!");
               drivefromBarTimer.Start();
               LuisHealthEventHandler = new HealthWithChangedEvents(Luis);
               LuisHealthEventHandler.HealthDecreased += new HealthChangedHandler(LuisHealthEventHandler_HealthDecreased);
               JohnnyHealthEventHandler = new HealthWithChangedEvents(Johnny);
               JohnnyHealthEventHandler.HealthDecreased += new HealthChangedHandler(JohnnyHealthEventHandler_HealthDecreased);
               KarenHealthEventHandler = new HealthWithChangedEvents(Karen);
               KarenHealthEventHandler.HealthDecreased += new HealthChangedHandler(KarenHealthEventHandler_HealthDecreased);
           }
       }
       Ped SpawnBackup(string model, Vehicle vehicle, VehicleSeat seat)
       {
           Ped ped = vehicle.CreatePedOnSeat(seat, model);
           ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);

           ped.Armor = 100;
           ped.BecomeMissionCharacter();
           ped.CanSwitchWeapons = true;
           ped.RelationshipGroup = RelationshipGroup.Player;
           ped.Heading = Game.LocalPlayer.Character.Heading > 180 ? Game.LocalPlayer.Character.Heading - 180 : Game.LocalPlayer.Character.Heading + 180;
           ped.RandomizeOutfit();
           ped.SetDefaultVoice();
           ped.SetPathfinding(true, true, true);
           ped.WillDoDrivebys = true;
           ped.WillUseCarsInCombat = true;
           ped.WillFlyThroughWindscreen = true;

           ped.Task.AlwaysKeepTask = true;

           ped.Weapons.AssaultRifle_M4.Ammo = 1000;
           ped.Weapons.BarettaShotgun.Ammo = 1000;
           ped.Weapons.DesertEagle.Ammo = 1000;
           ped.Weapons.BaseballBat.Ammo = 1;
           return ped;
       }

       //Graphics
       void ToggleDisplay()
       {
           if (OneFriendsExist() && !drivefromBarTimer.isRunning)
           {
               displayOn = !displayOn;
               if (displayOn)
               {
                   Text("Friends Display On");
                   //PerFrameDrawing += new GraphicsEventHandler(Main_PerFrameDrawing);
               }
               else
               {
                   Text("Friends Display Off");
                   //PerFrameDrawing -= Main_PerFrameDrawing;
               }
           }
       }
       void Main_PerFrameDrawing(object sender, GraphicsEventArgs e)
       {
           if (displayOn)
           {
               int barXPos = 25;
               int barYPos = 60, barYPos2 = barYPos + 85, barYPos3 = barYPos - 25, barYPos4 = barYPos3 + 85, barYPos5 = (barYPos + barYPos3) + 130, barYPos6 = barYPos5 - 25;
               int barWidth = 210;
               int barHeight = 25;

               if (followInRideTimer != null && followInRideTimer.isRunning && Game.Exists(driver))
               {
                   RectangleF driverRangeIndicator = new RectangleF(775, barYPos, 250, 50);
                   RectangleF driverRangeIndicatorBR = new RectangleF(767, barYPos - 8, 266, 66);
                   Color color; string text; string friend = string.Empty;
                   if (driver == Luis) { friend = "Luis"; }
                   else if (driver == Johnny) { friend = "Johnny"; }
                   else if (driver == Karen) { friend = "Michelle"; }
                   if (this.driver.Position.DistanceTo(Game.LocalPlayer.Character.Position) > 100)
                   {
                       color = Color.Red; text = string.Format("{0} losing you!", friend);
                   }
                   else if ((this.driver.Position.DistanceTo(Game.LocalPlayer.Character.Position) > 50))
                   {
                       color = Color.Yellow; text = string.Format("{0} is far away.", friend);
                   }
                   else
                   {
                       color = Color.Green; text = string.Format("{0} can see you.", friend);
                   }
                   e.Graphics.DrawRectangle(driverRangeIndicatorBR, Color.WhiteSmoke);
                   e.Graphics.DrawRectangle(driverRangeIndicator, color);
                   e.Graphics.DrawText(text, driverRangeIndicator, TextAlignment.Center | TextAlignment.VerticalCenter, indicatorFont);
               }

               if (Game.Exists(Luis))
               {
                   RectangleF LuisName = new RectangleF(barXPos - 15, barYPos3, 100, 26);
                   if (Luis.isShooting) { LuisFont.Color = Color.Red; } else { LuisFont.Color = Color.WhiteSmoke; }
                   if (Luis.Health > 0)
                   {
                       Color color = Luis.Health > 20 ? Color.LightGreen : Color.Red;
                       e.Graphics.DrawText("LUIS", LuisName, TextAlignment.Left | TextAlignment.Center, LuisFont);
                       RectangleF rect1 = new RectangleF(barXPos, barYPos, barWidth, barHeight);
                       RectangleF rect2 = new RectangleF((barXPos + 5), (barYPos + 5), Luis.Health * 2, (barHeight - 10));//health_bar

                       e.Graphics.DrawRectangle(rect1, Color.Black);
                       e.Graphics.DrawRectangle(rect2, color);
                   }

                   if (Luis.Armor > 0 && Luis.Health > 0)
                   {
                       RectangleF rect3 = new RectangleF(barXPos, (barYPos + 30), barWidth, barHeight);
                       RectangleF rect4 = new RectangleF((barXPos + 5), (barYPos + 35), Luis.Armor * 2, (barHeight - 10));///armor_bar

                       e.Graphics.DrawRectangle(rect3, Color.Black);
                       e.Graphics.DrawRectangle(rect4, Color.LightBlue);
                   }
               }
               if (Game.Exists(Johnny))
               {
                   RectangleF JohnnyName = new RectangleF(barXPos, barYPos4, 100, 26);
                   if (Johnny.isShooting) { JohnnyFont.Color = Color.Red; } else { JohnnyFont.Color = Color.WhiteSmoke; }
                   if (Johnny.Health > 0)
                   {
                       Color color = Johnny.Health > 30 ? Color.LightGreen : Color.Red;
                       e.Graphics.DrawText("JOHNNY", JohnnyName, TextAlignment.Left | TextAlignment.Center, JohnnyFont);
                       RectangleF rect1 = new RectangleF(barXPos, barYPos2, barWidth, barHeight);
                       RectangleF rect2 = new RectangleF((barXPos + 5), (barYPos2 + 5), Johnny.Health * 2, (barHeight - 10));//health_bar

                       e.Graphics.DrawRectangle(rect1, Color.Black);
                       e.Graphics.DrawRectangle(rect2, color);
                   }

                   if (Johnny.Armor > 0 && Johnny.Health > 0)
                   {
                       RectangleF rect3 = new RectangleF(barXPos, (barYPos2 + 30), barWidth, barHeight);
                       RectangleF rect4 = new RectangleF((barXPos + 5), (barYPos2 + 35), Johnny.Armor * 2, (barHeight - 10));///armor_bar

                       e.Graphics.DrawRectangle(rect3, Color.Black);
                       e.Graphics.DrawRectangle(rect4, Color.LightBlue);
                   }
               }
               if (Game.Exists(Karen))
               {
                   RectangleF KarenName = new RectangleF(barXPos, barYPos6, 110, 26);
                   if (Karen.isShooting) { KarenFont.Color = Color.Red; } else { KarenFont.Color = Color.WhiteSmoke; }
                   if (Karen.Health > 0)
                   {
                       Color color = Karen.Health > 30 ? Color.LightGreen : Color.Red;
                       e.Graphics.DrawText("MICHELLE", KarenName, TextAlignment.Left | TextAlignment.Center, KarenFont);
                       RectangleF rect1 = new RectangleF(barXPos, barYPos5, barWidth, barHeight);
                       RectangleF rect2 = new RectangleF((barXPos + 5), (barYPos5 + 5), Karen.Health * 2, (barHeight - 10));//health_bar

                       e.Graphics.DrawRectangle(rect1, Color.Black);
                       e.Graphics.DrawRectangle(rect2, color);
                   }

                   if (Karen.Armor > 0 && Karen.Health > 0)
                   {
                       RectangleF rect3 = new RectangleF(barXPos, (barYPos5 + 30), barWidth, barHeight);
                       RectangleF rect4 = new RectangleF((barXPos + 5), (barYPos5 + 35), Karen.Armor * 2, (barHeight - 10));///armor_bar

                       e.Graphics.DrawRectangle(rect3, Color.Black);
                       e.Graphics.DrawRectangle(rect4, Color.LightBlue);
                   }
               }
           }
       }

       //Cleanup
       void CleanUpDead()
       {
           if (Game.Exists(Luis) && Luis.isDead && !Luis.isOnScreen) { Luis.Delete(); }
           if (Game.Exists(Luis) && !Luis.isInGroup && Game.LocalPlayer.Character.Position.DistanceTo(Luis.Position) > 100 && !Luis.isOnScreen) { Luis.Delete(); }
           if (Game.Exists(Johnny) && Johnny.isDead && !Johnny.isOnScreen) { Johnny.Delete(); }
           if (Game.Exists(Johnny) && !Johnny.isInGroup && Game.LocalPlayer.Character.Position.DistanceTo(Johnny.Position) > 100 && !Johnny.isOnScreen) { Johnny.Delete(); }
           if (Game.Exists(Karen) && Karen.isDead && !Karen.isOnScreen) { Karen.Delete(); }
           if (Game.Exists(Karen) && !Karen.isInGroup && Game.LocalPlayer.Character.Position.DistanceTo(Karen.Position) > 100 && !Karen.isOnScreen) { Karen.Delete(); }
           if (!Game.Exists(Luis) && !Game.Exists(Johnny) && !Game.Exists(Karen)) { PerFrameDrawing -= Main_PerFrameDrawing; Tick -= Main_Tick; displayOn = false; }
       }
       void ReleaseFriends(Ped ped)
       {
           if (ped.CurrentVehicle == Game.LocalPlayer.Character.CurrentVehicle) { ped.LeaveVehicle(); }
           ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Respect);
           ped.NoLongerNeeded();
           Game.LocalPlayer.Group.RemoveMember(ped);
       }
       void ReleaseResources()
       {
           if (drivefromBarTimer.isRunning) { drivefromBarTimer.Stop(); }
           if (Game.Exists(Luis)) { ReleaseFriends(Luis); }
           if (Game.Exists(Johnny)) { ReleaseFriends(Johnny); }
           if (Game.Exists(Karen)) { ReleaseFriends(Karen); }
           if (Game.Exists(vehBlip)) { vehBlip.Delete(); }
           if (Game.Exists(backupVeh)) { backupVeh.NoLongerNeeded(); }
           if (LuisHealthEventHandler != null)
           {
               LuisHealthEventHandler.HealthDecreased -= LuisHealthEventHandler_HealthDecreased;
           }
           if (JohnnyHealthEventHandler != null)
           {
               JohnnyHealthEventHandler.HealthDecreased -= JohnnyHealthEventHandler_HealthDecreased;
           }
           if (KarenHealthEventHandler != null)
           {
               KarenHealthEventHandler.HealthDecreased -= KarenHealthEventHandler_HealthDecreased;
           }
           backupVeh = null;
           PerFrameDrawing -= Main_PerFrameDrawing;
           Tick -= Main_Tick;
           displayOn = false;
       }

       //Health Events
       void JohnnyHealthEventHandler_HealthDecreased(object sender, HealthChangedEventArgs e)
       {
           if (e.NewHealth < 1)
           {
               Text("Johnny Died");
               JohnnyHealthEventHandler.HealthDecreased -= JohnnyHealthEventHandler_HealthDecreased;
           }
       }
       void LuisHealthEventHandler_HealthDecreased(object sender, HealthChangedEventArgs e)
       {
           if (e.NewHealth < 1)
           {
               Text("Luis Died");
               LuisHealthEventHandler.HealthDecreased -= LuisHealthEventHandler_HealthDecreased;
           }
       }
       void KarenHealthEventHandler_HealthDecreased(object sender, HealthChangedEventArgs e)
       {
           if (e.NewHealth < 1)
           {
               Text("Michelle Died");
               KarenHealthEventHandler.HealthDecreased -= KarenHealthEventHandler_HealthDecreased;
           }
       }
   }
}
PMMSNPlayStation Network
  Top
 

 

1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG