sachin_rocks1001 Posted April 8, 2018 Share Posted April 8, 2018 i want some one to explain to me how to detect it . i am working on a mod that does something when the player shot someone. and i am a newbie so please go easy on me thanks . i am using c# btw Link to comment Share on other sites More sharing options...
sachin_rocks1001 Posted April 8, 2018 Author Share Posted April 8, 2018 can anyone help please , thanks Link to comment Share on other sites More sharing options...
NModds Posted April 8, 2018 Share Posted April 8, 2018 (edited) This is how I would do it, but there might be simpler and better ways. This checks if the player has been damaged by bullet but it is doing so by coincidence detection. It's assuming that the shooting ped has shot. You could add ShootingPed.IsShooting but I can see a scenario where the ShootingPed has shot but it has not hit the other ped yet, resulting in a false statement. Another thing you could add is a check if Bullet_Is_In_Area. I just don't know what all the parameters are, but you could try different values to see if they work. I think that three of the parameters have to be x,y,z. Ped ShootingPed = Ped.Handle;//i'm using Ped.Handle as a general statement. Replace Ped.Handle with any ped you want. Ped ShotPed = Ped.Handle;OutputArgument outCoords = new OutputArgument();bool Has_hitCoords = Function.Call<bool>(Hash._0x6C4D0409BA1A2BC2, ShootingPed, outCoords);//GET_PED_LAST_WEAPON_IMPACT_COORD, this even works for melee attacks, so need more conditionsVector3 HitCoords = outCoords.GetResult<Vector3>(); if((World.GetDistance(HitCoords, ShotPed.Position) < 1.5f) && ShotPed.HasBeenDamagedBy(ShootingPed) && ShootingPed.Weapons.Current.Group != WeaponGroup.Melee && ShootingPed.Weapons.Current.Group != WeaponGroup.Unarmed){ //do something.} edit: editor thinks that Has HitCoords == Hash*tCoords and is censoring it, Edited April 8, 2018 by nm710 sachin_rocks1001 1 Link to comment Share on other sites More sharing options...
sachin_rocks1001 Posted April 8, 2018 Author Share Posted April 8, 2018 This is how I would do it, but there might be simpler and better ways. This checks if the player has been damaged by bullet but it is doing so by coincidence detection. It's assuming that the shooting ped has shot. You could add ShootingPed.IsShooting but I can see a scenario where the ShootingPed has shot but it has not hit the other ped yet, resulting in a false statement. Another thing you could add is a check if Bullet_Is_In_Area. I just don't know what all the parameters are, but you could try different values to see if they work. I think that three of the parameters have to be x,y,z. Ped ShootingPed = Ped.Handle;//i'm using Ped.Handle as a general statement. Replace Ped.Handle with any ped you want. Ped ShotPed = Ped.Handle;OutputArgument outCoords = new OutputArgument();bool Has_hitCoords = Function.Call<bool>(Hash._0x6C4D0409BA1A2BC2, ShootingPed, outCoords);//GET_PED_LAST_WEAPON_IMPACT_COORD, this even works for melee attacks, so need more conditionsVector3 HitCoords = outCoords.GetResult<Vector3>(); if((World.GetDistance(HitCoords, ShotPed.Position) < 1.5f) && ShotPed.HasBeenDamagedBy(ShootingPed) && ShootingPed.Weapons.Current.Group != WeaponGroup.Melee && ShootingPed.Weapons.Current.Group != WeaponGroup.Unarmed){ //do something.} edit: editor thinks that Has HitCoords == Hash*tCoords and is censoring it, thank you sir , will try it out 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