Advertisement
Guest User

Arrest & Cpr

a guest
Jan 26th, 2014
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 12.37 KB | None | 0 0
  1. using GTA;
  2. using GTA.Native;
  3. using System;
  4. using System.Windows.Forms;
  5. namespace CPR
  6. {
  7.     public class CPR : Script
  8.     {
  9.         public CPR()
  10.         {
  11.             base.Tick += new EventHandler(this.ScriptCommunicationExample1_Tick);
  12.         }
  13.         private void ScriptCommunicationExample1_Tick(object sender, EventArgs e)
  14.         {
  15.             if (base.isKeyPressed(base.Settings.GetValueKey("CPRKey", Keys.B)))
  16.             {
  17.                 //Ped targetedPed = this.Player.GetTargetedPed();
  18.                 //targetedPed.WantedByPolice = true;
  19.                 //Ped[] peds = World.GetPeds(targetedPed.Position, 100f);
  20.                 AnimationSet animationSet = new AnimationSet("cop");
  21.                 new AnimationSet("move_m@h_cuffed");
  22.                 Weapon currentType = base.Player.Character.Weapons.CurrentType;
  23.                 Group arg_54_0 = base.Player.Group;
  24.                 int num = 250;
  25.                 Ped[] peds = World.GetPeds(base.Player.Character.Position, 2.35f, 2);
  26.                 Ped[] array = peds;
  27.                 for (int i = 0; i < array.Length; i++)
  28.                 {
  29.                     Ped ped = array[i];
  30.                     if (!base.Player.Group.isMember(ped) && !(ped == base.Player.Character) && !ped.isRagdoll)
  31.                     {
  32.                         if (ped.isAliveAndWell)
  33.                         {
  34.                            
  35.                                 if (ped.Animation.isPlaying(animationSet, "armsup_loop") && !base.Player.Character.isSittingInVehicle() && !ped.isSittingInVehicle())
  36.                                 {
  37.                                     ped.Task.ClearAll();
  38.                                     Function.Call("SET_COLLIDE_WITH_PEDS", new Parameter[]
  39.                                     {
  40.                                         0
  41.                                     });
  42.                                     Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  43.                                     {
  44.                                         ped,
  45.                                         1
  46.                                     });
  47.                                     ped.PreventRagdoll = true;
  48.                                     base.Player.Character.PreventRagdoll = true;
  49.                                     Game.DisplayText("LCPD: Hands on your head...");
  50.                                     base.Wait(100);
  51.                                     base.Player.Character.Task.ClearAll();
  52.                                     base.Wait(10);
  53.                                     base.Player.Character.Task.ClearAll();
  54.                                     base.Wait(10);
  55.                                     base.Player.Character.Task.ClearAll();
  56.                                     base.Wait(10);
  57.                                     Function.Call("TASK_PLAY_ANIM", new Parameter[]
  58.                                     {
  59.                                         ped,
  60.                                         "searched_pose",
  61.                                         "cop",
  62.                                         4.0,
  63.                                         1,
  64.                                         0,
  65.                                         0,
  66.                                         1,
  67.                                         8000
  68.                                     });
  69.                                     ped.Animation.WaitUntilFinished(animationSet, "searched_pose");
  70.                                     base.Player.Character.Task.GoTo(ped.Position, true);
  71.                                     base.Wait(900);
  72.                                     base.Player.Character.Task.TurnTo(ped);
  73.                                     base.Wait(100);
  74.                                     base.Player.Character.Task.TurnTo(ped);
  75.                                     base.Wait(100);
  76.                                     base.Player.Character.Task.TurnTo(ped);
  77.                                     base.Wait(100);
  78.                                     base.Player.Character.Task.ClearAll();
  79.                                     base.Player.Character.Task.TurnTo(ped);
  80.                                     base.Wait(200);
  81.                                     base.Player.Character.Task.TurnTo(ped);
  82.                                     base.Wait(200);
  83.                                     float heading = base.Player.Character.Heading;
  84.                                     Function.Call("REQUEST_ANIMS", new Parameter[]
  85.                                     {
  86.                                         "move_m@h_cuffed"
  87.                                     });
  88.                                     Function.Call("SET_CHAR_HEADING", new Parameter[]
  89.                                     {
  90.                                         ped,
  91.                                         heading
  92.                                     });
  93.                                     Function.Call("TASK_PLAY_ANIM", new Parameter[]
  94.                                     {
  95.                                         base.Player.Character,
  96.                                         "cop_cuff",
  97.                                         "cop",
  98.                                         4.0,
  99.                                         0,
  100.                                         1,
  101.                                         1,
  102.                                         0,
  103.                                         -2
  104.                                     });
  105.                                     Function.Call("TASK_PLAY_ANIM", new Parameter[]
  106.                                     {
  107.                                         ped,
  108.                                         "crim_cuffed",
  109.                                         "cop",
  110.                                         4.0,
  111.                                         0,
  112.                                         0,
  113.                                         0,
  114.                                         0,
  115.                                         -2
  116.                                     });
  117.                                     base.Wait(500);
  118.                                     Game.DisplayText("LCPD: you are under arrest.");
  119.                                     ped.Animation.WaitUntilFinished(animationSet, "crim_cuffed");
  120.                                     //ped.RelationshipGroup = RelationshipGroup.Player;
  121.                                     ped.RelationshipGroup = RelationshipGroup.Criminal;
  122.                                     //ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
  123.                                     //ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate);
  124.                                     ped.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
  125.                                     //ped.ChangeRelationship(RelationshipGroup.Prostitute, Relationship.Hate);
  126.                                     //ped.ChangeRelationship(RelationshipGroup.Bum, Relationship.Hate);
  127.                                     //ped.ChangeRelationship(RelationshipGroup.Civillian_Male, Relationship.Hate);
  128.                                     //ped.ChangeRelationship(RelationshipGroup.Civillian_Female, Relationship.Hate);
  129.                                     base.Wait(0);
  130.                                     if (base.Player.Character.HasBeenDamagedBy(ped))
  131.                                     {
  132.                                         base.Player.Money += num;
  133.                                         Game.DisplayText("Enemy arrest bonus +" + num + "$");
  134.                                     }
  135.                                     Function.Call("SET_ANIM_GROUP_FOR_CHAR", new Parameter[]
  136.                                     {
  137.                                         ped,
  138.                                         "move_m@h_cuffed"
  139.                                     });
  140.                                     ped.WantedByPolice = true;
  141.                                 ped.PreventRagdoll = false;
  142.                                 base.Player.Character.PreventRagdoll = false;
  143.                                 ped.Task.ClearAllImmediately();
  144.                                 base.Player.Character.Task.ClearAll();
  145.                                 //ped.Task.Wait(1000);
  146.                                 //ped.Task.GoTo(base.Player.Character);
  147.                                 //ped.Task.AimAt(base.Player.Character, 2.0F);
  148.                                 //ped.Task.StandStill();
  149.                                 base.Wait(500);
  150.                                 base.Player.Character.Task.ClearAll();
  151.                                 //ped.Task.FightAgainstHatedTargets();
  152.                                 //ped.Task.FleeFromChar(base.Player.Character);
  153.                                 ped.Task.StandStill(4000);
  154.                                 base.Wait(800);
  155.                                 ped.Task.ClearAllImmediately();
  156.                                 Function.Call("CLEAR_CHAR_SECONDARY_TASK", ped);
  157.                                     Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  158.                                     {
  159.                                         ped,
  160.                                         1   //0 default
  161.                                     });
  162.                                     Function.Call("SET_CHAR_KEEP_TASK", new Parameter[]
  163.                                     {
  164.                                         ped,
  165.                                         1
  166.                                     });
  167.                                     base.Wait(100);
  168.                                     Function.Call("SET_COLLIDE_WITH_PEDS", new Parameter[]
  169.                                     {
  170.                                         1
  171.                                     });
  172.                                     //ped.NoLongerNeeded();
  173.                                 }
  174.                                 else
  175.                                 {
  176.                                     Function.Call("REQUEST_ANIMS", new Parameter[]
  177.                                     {
  178.                                         "cop"
  179.                                     });
  180.                                     Function.Call("CLEAR_CONVERSATION_FOR_CHAR", new Parameter[]
  181.                                     {
  182.                                         ped
  183.                                     });
  184.                                     Function.Call("CLEAR_CHAR_SECONDARY_TASK", new Parameter[]
  185.                                     {
  186.                                         ped
  187.                                     });
  188.                                     Function.Call("SWITCH_PED_TO_ANIMATED", new Parameter[]
  189.                                     {
  190.                                         ped,
  191.                                         0
  192.                                     });
  193.                                     base.Player.Character.Task.ClearAll();
  194.                                     base.Player.Character.Task.AimAt(ped.GetBonePosition(Bone.LeftClavicle), 1500);
  195.                                     if (ped.isSittingInVehicle())
  196.                                     {
  197.                                         base.Wait(300);
  198.                                         ped.Task.LeaveVehicleImmediately(ped.CurrentVehicle);
  199.                                         base.Player.Character.Task.AimAt(ped.GetBonePosition(Bone.LeftClavicle), 1800);
  200.                                         Game.DisplayText("Step away from the vehicle and put your hands up!");
  201.                                         base.Wait(550);
  202.                                         Function.Call("TASK_PLAY_ANIM", new Parameter[]
  203.                                         {
  204.                                             ped,
  205.                                             "armsup_loop",
  206.                                             "cop",
  207.                                             4.0,
  208.                                             1,
  209.                                             0,
  210.                                             0,
  211.                                             1,
  212.                                             12000
  213.                                         });
  214.                                         ped.Animation.WaitUntilFinished(animationSet, "armsup_loop");
  215.                                         Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  216.                                         {
  217.                                             ped,
  218.                                             1
  219.                                         });
  220.                                     }
  221.                                     else
  222.                                     {
  223.                                         ped.Task.ClearAll();
  224.                                         base.Wait(150);
  225.                                         ped.Task.TurnTo(base.Player.Character);
  226.                                         base.Wait(150);
  227.                                         Game.DisplayText("LCPD: Put your hands up!");
  228.                                         ped.Task.ClearAllImmediately();
  229.                                         Function.Call("TASK_PLAY_ANIM", new Parameter[]
  230.                                         {
  231.                                             ped,
  232.                                             "armsup_loop",
  233.                                             "cop",
  234.                                             4.0,
  235.                                             1,
  236.                                             0,
  237.                                             0,
  238.                                             1,
  239.                                             12000
  240.                                         });
  241.                                         ped.Animation.WaitUntilFinished(animationSet, "armsup_loop");
  242.                                         Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  243.                                         {
  244.                                             ped,
  245.                                             1
  246.                                         });
  247.                                         ped.DropCurrentWeapon();
  248.                                         ped.DropCurrentWeapon();
  249.                                         ped.DropCurrentWeapon();
  250.                                     }
  251.                                     base.Wait(600);
  252.                                     Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  253.                                     {
  254.                                         ped,
  255.                                         0
  256.                                     });
  257.                                     //ped.NoLongerNeeded();
  258.                                
  259.                             }
  260.                         }
  261.                         else
  262.                         {
  263.                             if (!base.Player.Character.isInCombat)
  264.                             {
  265.                                 Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  266.                                 {
  267.                                     ped,
  268.                                     1
  269.                                 });
  270.                                 base.Player.Character.PreventRagdoll = true;
  271.                                 base.Player.Character.Task.ClearAll();
  272.                                 base.Wait(10);
  273.                                 base.Player.Character.Task.ClearAll();
  274.                                 base.Wait(10);
  275.                                 base.Player.Character.Task.ClearAll();
  276.                                 base.Wait(50);
  277.                                 base.Player.Character.Task.GoTo(ped.GetBonePosition(Bone.Spine), true);
  278.                                 base.Wait(1100);
  279.                                 base.Player.Character.Task.GoTo(ped.GetBonePosition(Bone.RightUpperarm), true);
  280.                                 base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
  281.                                 base.Wait(200);
  282.                                 base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
  283.                                 base.Wait(200);
  284.                                 base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
  285.                                 base.Wait(200);
  286.                                 base.Player.Character.Task.ClearAll();
  287.                                 base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
  288.                                 base.Wait(300);
  289.                                 base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
  290.                                 Function.Call("REQUEST_ANIMS", new Parameter[]
  291.                                 {
  292.                                     "medic"
  293.                                 });
  294.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  295.                                 {
  296.                                     base.Player.Character,
  297.                                     "medic_cpr_in",
  298.                                     "medic",
  299.                                     8.0,
  300.                                     0,
  301.                                     1,
  302.                                     1,
  303.                                     0,
  304.                                     -2
  305.                                 });
  306.                                 Game.DisplayText("LCPD, Preforming CPR!.");
  307.                                 base.Wait(2300);
  308.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  309.                                 {
  310.                                     base.Player.Character,
  311.                                     "medic_cpr_loop",
  312.                                     "medic",
  313.                                     8.0,
  314.                                     0,
  315.                                     1,
  316.                                     1,
  317.                                     0,
  318.                                     -2
  319.                                 });
  320.                                 base.Wait(2300);
  321.                                 ped.Task.ClearAllImmediately();
  322.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  323.                                 {
  324.                                     base.Player.Character,
  325.                                     "medic_cpr_loop",
  326.                                     "medic",
  327.                                     8.0,
  328.                                     0,
  329.                                     1,
  330.                                     1,
  331.                                     0,
  332.                                     -2
  333.                                 });
  334.                                 base.Wait(3600);
  335.                                 ped.Health = 105;
  336.                                 Game.DisplayText("CPR completed...");
  337.                                 ped.Health = 105;
  338.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  339.                                 {
  340.                                     base.Player.Character,
  341.                                     "medic_cpr_out",
  342.                                     "medic",
  343.                                     8.0,
  344.                                     0,
  345.                                     1,
  346.                                     1,
  347.                                     0,
  348.                                     -2
  349.                                 });
  350.                                 base.Wait(1400);
  351.                                 ped.Task.ClearAllImmediately();
  352.                                 Function.Call("REVIVE_INJURED_PED", new Parameter[]
  353.                                 {
  354.                                     ped
  355.                                 });
  356.                                 base.Player.Character.PreventRagdoll = false;
  357.                                 Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
  358.                                 {
  359.                                     ped,
  360.                                     0
  361.                                 });
  362.                                 Function.Call("REQUEST_ANIMS", new Parameter[]
  363.                                 {
  364.                                     "cop"
  365.                                 });
  366.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  367.                                 {
  368.                                     ped,
  369.                                     "armsup_loop",
  370.                                     "cop",
  371.                                     4.0,
  372.                                     1,
  373.                                     0,
  374.                                     0,
  375.                                     1,
  376.                                     -2
  377.                                 });
  378.                                 base.Wait(150);
  379.                                 ped.Task.TurnTo(base.Player.Character);
  380.                                 base.Wait(150);
  381.                                 ped.Task.ClearAllImmediately();
  382.                                 Function.Call("TASK_PLAY_ANIM", new Parameter[]
  383.                                 {
  384.                                     ped,
  385.                                     "armsup_loop",
  386.                                     "cop",
  387.                                     4.0,
  388.                                     1,
  389.                                     0,
  390.                                     0,
  391.                                     1,
  392.                                     -2
  393.                                 });
  394.                                 Function.Call("SWITCH_PED_TO_ANIMATED", new Parameter[]
  395.                                 {
  396.                                     ped,
  397.                                     0
  398.                                 });
  399.                                 ped.Task.ClearAllImmediately();
  400.                                 ped.ForceRagdoll(600, true);
  401.                                 base.Wait(800);
  402.                                 //ped.NoLongerNeeded();
  403.                             }
  404.                             else
  405.                             {
  406.                                 base.Wait(0);
  407.                             }
  408.                         }
  409.                     }
  410.                 }
  411.             }
  412.         }
  413.     }
  414. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement