ISOFX Posted November 20, 2015 Share Posted November 20, 2015 Hello, does anyone know how to detect if the player has got a headshot and if that player has got a headshot i want to do something at the head bone coordinate. Thanks Sickyman_678 1 Link to comment Share on other sites More sharing options...
ChippingCoder Posted November 20, 2015 Share Posted November 20, 2015 (edited) this is how it would be for the 360. modify to your liking and so it can be compatiable with what you're using run in a loop int outbone;int head = PED::GET_PED_BONE_INDEX(PLAYER::PLAYER_PED_ID, 31086);if(PED::GET_PED_LAST_DAMAGE_BONE(PLAYER::PLAYER_PED_ID, outbone)) { if(outbone == head) { printmsg("HEADSHOT!"); }} Edited November 20, 2015 by ChippingCoder Jitnaught 1 Link to comment Share on other sites More sharing options...
ISOFX Posted November 20, 2015 Author Share Posted November 20, 2015 this is how it would be for the 360. modify to your liking and so it can be compatiable with what you're using run in a loop int outbone;int head = PED::GET_PED_BONE_INDEX(PLAYER::PLAYER_PED_ID, 31086);if(PED::GET_PED_LAST_DAMAGE_BONE(PLAYER::PLAYER_PED_ID, outbone) { if(outbone == head) { printmsg("HEADSHOT!"); }} thanks but my game crashes with this code (C#) int outbone; int head = Function.Call<int>(Hash.GET_PED_BONE_INDEX, Game.Player.Character, 12844); if (Function.Call<bool>(Hash.GET_PED_LAST_DAMAGE_BONE, Game.Player.Character, outbone)) { if (outbone == head) { } } My game just crashes with this on startup.. Can you see the problem? Link to comment Share on other sites More sharing options...
ChippingCoder Posted November 20, 2015 Share Posted November 20, 2015 this is how it would be for the 360. modify to your liking and so it can be compatiable with what you're using run in a loop int outbone;int head = PED::GET_PED_BONE_INDEX(PLAYER::PLAYER_PED_ID, 31086);if(PED::GET_PED_LAST_DAMAGE_BONE(PLAYER::PLAYER_PED_ID, outbone) { if(outbone == head) { printmsg("HEADSHOT!"); }} thanks but my game crashes with this code (C#) int outbone; int head = Function.Call<int>(Hash.GET_PED_BONE_INDEX, Game.Player.Character, 12844); if (Function.Call<bool>(Hash.GET_PED_LAST_DAMAGE_BONE, Game.Player.Character, outbone)) { if (outbone == head) { } } My game just crashes with this on startup.. Can you see the problem? try putting & in front of outbone in the GET_PED_LAST_DAMAGE_BONE Link to comment Share on other sites More sharing options...
ISOFX Posted November 20, 2015 Author Share Posted November 20, 2015 @ChippingCoder That wouldn't work, that only works in C++ not C#. But i tried it anyway and it doesn't work. Thanks for helping me though. Link to comment Share on other sites More sharing options...
CamxxCore Posted November 20, 2015 Share Posted November 20, 2015 (edited) @ChippingCoder That wouldn't work, that only works in C++ not C#. But i tried it anyway and it doesn't work. Thanks for helping me though. You can use pointers in unsafe context. But its advised you use the wrapper with scripthookdotnet. i.e. var head = Function.Call<int>(Hash.GET_PED_BONE_INDEX, Game.Player.Character, 31086);var outBone = new OutputArgument();if (Function.Call<bool>(Hash.GET_PED_LAST_DAMAGE_BONE, Game.Player.Character, outBone)){if (outBone.GetResult<int>() == head){}} Edited November 20, 2015 by CamxxCore Jitnaught 1 Link to comment Share on other sites More sharing options...
ISOFX Posted November 21, 2015 Author Share Posted November 21, 2015 @CamxxCore I tried the code and it doesn't work. I want to detect if the player has got a headshot on a ped and i want to execute some code if the player has got the headshot on a random ped. thanks. Link to comment Share on other sites More sharing options...
ISOFX Posted November 21, 2015 Author Share Posted November 21, 2015 This is what i want to do: If the player has got a headshot on any ped i want to execute some code. Can anyone see the problem with the code? thanks Link to comment Share on other sites More sharing options...
ISOFX Posted November 24, 2015 Author Share Posted November 24, 2015 ? Link to comment Share on other sites More sharing options...
Grale16V Posted November 24, 2015 Share Posted November 24, 2015 It would be polite if you replied to my Skype messages! Link to comment Share on other sites More sharing options...
Colata Posted December 9, 2015 Share Posted December 9, 2015 ? if (outBone.GetResult<int>() == head){}} you place your executable in the brackets, e.g if (outBone.GetResult<int>() == head){ Game.Player.Character.Delete();}} Link to comment Share on other sites More sharing options...
ISOFX Posted December 9, 2015 Author Share Posted December 9, 2015 ? if (outBone.GetResult<int>() == head){}} you place your executable in the brackets, e.g if (outBone.GetResult<int>() == head){ Game.Player.Character.Delete();}} Doesn't work, i tried it before.. Link to comment Share on other sites More sharing options...
Nacorpio Posted December 15, 2015 Share Posted December 15, 2015 @CamxxCore I tried the code and it doesn't work. I want to detect if the player has got a headshot on a ped and i want to execute some code if the player has got the headshot on a random ped. thanks. You'd have to tell us what the error is. You can't really expect us to solve an issue that we know nothing about. jedijosh920 1 Link to comment Share on other sites More sharing options...
ISOFX Posted December 15, 2015 Author Share Posted December 15, 2015 There's @CamxxCore I tried the code and it doesn't work. I want to detect if the player has got a headshot on a ped and i want to execute some code if the player has got the headshot on a random ped. thanks. You'd have to tell us what the error is. You can't really expect us to solve an issue that we know nothing about. There's no error. It just doesn't work. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now