Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Native;
- using System;
- using System.Windows.Forms;
- namespace CPR
- {
- public class CPR : Script
- {
- public CPR()
- {
- base.Tick += new EventHandler(this.ScriptCommunicationExample1_Tick);
- }
- private void ScriptCommunicationExample1_Tick(object sender, EventArgs e)
- {
- if (base.isKeyPressed(base.Settings.GetValueKey("CPRKey", Keys.B)))
- {
- //Ped targetedPed = this.Player.GetTargetedPed();
- //targetedPed.WantedByPolice = true;
- //Ped[] peds = World.GetPeds(targetedPed.Position, 100f);
- AnimationSet animationSet = new AnimationSet("cop");
- new AnimationSet("move_m@h_cuffed");
- Weapon currentType = base.Player.Character.Weapons.CurrentType;
- Group arg_54_0 = base.Player.Group;
- int num = 250;
- Ped[] peds = World.GetPeds(base.Player.Character.Position, 2.35f, 2);
- Ped[] array = peds;
- for (int i = 0; i < array.Length; i++)
- {
- Ped ped = array[i];
- if (!base.Player.Group.isMember(ped) && !(ped == base.Player.Character) && !ped.isRagdoll)
- {
- if (ped.isAliveAndWell)
- {
- if (ped.Animation.isPlaying(animationSet, "armsup_loop") && !base.Player.Character.isSittingInVehicle() && !ped.isSittingInVehicle())
- {
- ped.Task.ClearAll();
- Function.Call("SET_COLLIDE_WITH_PEDS", new Parameter[]
- {
- 0
- });
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 1
- });
- ped.PreventRagdoll = true;
- base.Player.Character.PreventRagdoll = true;
- Game.DisplayText("LCPD: Hands on your head...");
- base.Wait(100);
- base.Player.Character.Task.ClearAll();
- base.Wait(10);
- base.Player.Character.Task.ClearAll();
- base.Wait(10);
- base.Player.Character.Task.ClearAll();
- base.Wait(10);
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "searched_pose",
- "cop",
- 4.0,
- 1,
- 0,
- 0,
- 1,
- 8000
- });
- ped.Animation.WaitUntilFinished(animationSet, "searched_pose");
- base.Player.Character.Task.GoTo(ped.Position, true);
- base.Wait(900);
- base.Player.Character.Task.TurnTo(ped);
- base.Wait(100);
- base.Player.Character.Task.TurnTo(ped);
- base.Wait(100);
- base.Player.Character.Task.TurnTo(ped);
- base.Wait(100);
- base.Player.Character.Task.ClearAll();
- base.Player.Character.Task.TurnTo(ped);
- base.Wait(200);
- base.Player.Character.Task.TurnTo(ped);
- base.Wait(200);
- float heading = base.Player.Character.Heading;
- Function.Call("REQUEST_ANIMS", new Parameter[]
- {
- "move_m@h_cuffed"
- });
- Function.Call("SET_CHAR_HEADING", new Parameter[]
- {
- ped,
- heading
- });
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- base.Player.Character,
- "cop_cuff",
- "cop",
- 4.0,
- 0,
- 1,
- 1,
- 0,
- -2
- });
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "crim_cuffed",
- "cop",
- 4.0,
- 0,
- 0,
- 0,
- 0,
- -2
- });
- base.Wait(500);
- Game.DisplayText("LCPD: you are under arrest.");
- ped.Animation.WaitUntilFinished(animationSet, "crim_cuffed");
- //ped.RelationshipGroup = RelationshipGroup.Player;
- ped.RelationshipGroup = RelationshipGroup.Criminal;
- //ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Companion);
- //ped.ChangeRelationship(RelationshipGroup.Player, Relationship.Hate);
- ped.ChangeRelationship(RelationshipGroup.Cop, Relationship.Hate);
- //ped.ChangeRelationship(RelationshipGroup.Prostitute, Relationship.Hate);
- //ped.ChangeRelationship(RelationshipGroup.Bum, Relationship.Hate);
- //ped.ChangeRelationship(RelationshipGroup.Civillian_Male, Relationship.Hate);
- //ped.ChangeRelationship(RelationshipGroup.Civillian_Female, Relationship.Hate);
- base.Wait(0);
- if (base.Player.Character.HasBeenDamagedBy(ped))
- {
- base.Player.Money += num;
- Game.DisplayText("Enemy arrest bonus +" + num + "$");
- }
- Function.Call("SET_ANIM_GROUP_FOR_CHAR", new Parameter[]
- {
- ped,
- "move_m@h_cuffed"
- });
- ped.WantedByPolice = true;
- ped.PreventRagdoll = false;
- base.Player.Character.PreventRagdoll = false;
- ped.Task.ClearAllImmediately();
- base.Player.Character.Task.ClearAll();
- //ped.Task.Wait(1000);
- //ped.Task.GoTo(base.Player.Character);
- //ped.Task.AimAt(base.Player.Character, 2.0F);
- //ped.Task.StandStill();
- base.Wait(500);
- base.Player.Character.Task.ClearAll();
- //ped.Task.FightAgainstHatedTargets();
- //ped.Task.FleeFromChar(base.Player.Character);
- ped.Task.StandStill(4000);
- base.Wait(800);
- ped.Task.ClearAllImmediately();
- Function.Call("CLEAR_CHAR_SECONDARY_TASK", ped);
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 1 //0 default
- });
- Function.Call("SET_CHAR_KEEP_TASK", new Parameter[]
- {
- ped,
- 1
- });
- base.Wait(100);
- Function.Call("SET_COLLIDE_WITH_PEDS", new Parameter[]
- {
- 1
- });
- //ped.NoLongerNeeded();
- }
- else
- {
- Function.Call("REQUEST_ANIMS", new Parameter[]
- {
- "cop"
- });
- Function.Call("CLEAR_CONVERSATION_FOR_CHAR", new Parameter[]
- {
- ped
- });
- Function.Call("CLEAR_CHAR_SECONDARY_TASK", new Parameter[]
- {
- ped
- });
- Function.Call("SWITCH_PED_TO_ANIMATED", new Parameter[]
- {
- ped,
- 0
- });
- base.Player.Character.Task.ClearAll();
- base.Player.Character.Task.AimAt(ped.GetBonePosition(Bone.LeftClavicle), 1500);
- if (ped.isSittingInVehicle())
- {
- base.Wait(300);
- ped.Task.LeaveVehicleImmediately(ped.CurrentVehicle);
- base.Player.Character.Task.AimAt(ped.GetBonePosition(Bone.LeftClavicle), 1800);
- Game.DisplayText("Step away from the vehicle and put your hands up!");
- base.Wait(550);
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "armsup_loop",
- "cop",
- 4.0,
- 1,
- 0,
- 0,
- 1,
- 12000
- });
- ped.Animation.WaitUntilFinished(animationSet, "armsup_loop");
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 1
- });
- }
- else
- {
- ped.Task.ClearAll();
- base.Wait(150);
- ped.Task.TurnTo(base.Player.Character);
- base.Wait(150);
- Game.DisplayText("LCPD: Put your hands up!");
- ped.Task.ClearAllImmediately();
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "armsup_loop",
- "cop",
- 4.0,
- 1,
- 0,
- 0,
- 1,
- 12000
- });
- ped.Animation.WaitUntilFinished(animationSet, "armsup_loop");
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 1
- });
- ped.DropCurrentWeapon();
- ped.DropCurrentWeapon();
- ped.DropCurrentWeapon();
- }
- base.Wait(600);
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 0
- });
- //ped.NoLongerNeeded();
- }
- }
- else
- {
- if (!base.Player.Character.isInCombat)
- {
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 1
- });
- base.Player.Character.PreventRagdoll = true;
- base.Player.Character.Task.ClearAll();
- base.Wait(10);
- base.Player.Character.Task.ClearAll();
- base.Wait(10);
- base.Player.Character.Task.ClearAll();
- base.Wait(50);
- base.Player.Character.Task.GoTo(ped.GetBonePosition(Bone.Spine), true);
- base.Wait(1100);
- base.Player.Character.Task.GoTo(ped.GetBonePosition(Bone.RightUpperarm), true);
- base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
- base.Wait(200);
- base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
- base.Wait(200);
- base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
- base.Wait(200);
- base.Player.Character.Task.ClearAll();
- base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
- base.Wait(300);
- base.Player.Character.Task.TurnTo(ped.GetBonePosition(Bone.RightUpperarm));
- Function.Call("REQUEST_ANIMS", new Parameter[]
- {
- "medic"
- });
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- base.Player.Character,
- "medic_cpr_in",
- "medic",
- 8.0,
- 0,
- 1,
- 1,
- 0,
- -2
- });
- Game.DisplayText("LCPD, Preforming CPR!.");
- base.Wait(2300);
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- base.Player.Character,
- "medic_cpr_loop",
- "medic",
- 8.0,
- 0,
- 1,
- 1,
- 0,
- -2
- });
- base.Wait(2300);
- ped.Task.ClearAllImmediately();
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- base.Player.Character,
- "medic_cpr_loop",
- "medic",
- 8.0,
- 0,
- 1,
- 1,
- 0,
- -2
- });
- base.Wait(3600);
- ped.Health = 105;
- Game.DisplayText("CPR completed...");
- ped.Health = 105;
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- base.Player.Character,
- "medic_cpr_out",
- "medic",
- 8.0,
- 0,
- 1,
- 1,
- 0,
- -2
- });
- base.Wait(1400);
- ped.Task.ClearAllImmediately();
- Function.Call("REVIVE_INJURED_PED", new Parameter[]
- {
- ped
- });
- base.Player.Character.PreventRagdoll = false;
- Function.Call("SET_BLOCKING_OF_NON_TEMPORARY_EVENTS", new Parameter[]
- {
- ped,
- 0
- });
- Function.Call("REQUEST_ANIMS", new Parameter[]
- {
- "cop"
- });
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "armsup_loop",
- "cop",
- 4.0,
- 1,
- 0,
- 0,
- 1,
- -2
- });
- base.Wait(150);
- ped.Task.TurnTo(base.Player.Character);
- base.Wait(150);
- ped.Task.ClearAllImmediately();
- Function.Call("TASK_PLAY_ANIM", new Parameter[]
- {
- ped,
- "armsup_loop",
- "cop",
- 4.0,
- 1,
- 0,
- 0,
- 1,
- -2
- });
- Function.Call("SWITCH_PED_TO_ANIMATED", new Parameter[]
- {
- ped,
- 0
- });
- ped.Task.ClearAllImmediately();
- ped.ForceRagdoll(600, true);
- base.Wait(800);
- //ped.NoLongerNeeded();
- }
- else
- {
- base.Wait(0);
- }
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement