Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using GTA;
- // CAPTURING HEADSHOTS
- // ©2011 LouNGeR
- // For http://www.gtaforums.com/index.php?act=ST&t=475837
- public class HeadshotTest : Script
- {
- public HeadshotTest()
- {
- Interval = 250;
- this.Tick += new EventHandler(this.HeadshotTest_Tick);
- }
- private void HeadshotTest_Tick(object sender, EventArgs e)
- {
- GTA.Native.Pointer BonePointer = typeof(Int32);
- GTA.Native.Function.Call("GET_CHAR_LAST_DAMAGE_BONE", Player.Character, BonePointer);
- Int32 iBone = Convert.ToInt32(BonePointer.Value);
- // http://www.gtamodding.com/index.php?title=Ped_Bones
- // BONE_NECK: 0x4B4
- // BONE_HEAD: 0x4B5
- switch (iBone)
- {
- case 0x4B5:
- //Game.DisplayText("HEADSHOT!!"); // Received a headshot
- Random RNG = new Random((int)DateTime.Now.Ticks);
- Double RandomNumber = RNG.NextDouble();
- if (RandomNumber < .7) // Let's say Niko has a 70% chance of dying
- Player.Character.Die();
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement