Sneakyyzz 0 Posted September 1, 2015 Share Posted September 1, 2015 Hey, I need some help with making a ped use a specific weapon (I want them to only use a gun when the player gets his gun out) This is for my bodyguard mod and I'm in desperate need for some help. Thanks. Link to post Share on other sites
Jitnaught 422 Posted September 1, 2015 Share Posted September 1, 2015 In a tick, check if the player has a gun out, if he does then tell the ped to take out his weapon (SET_CURRENT_PED_WEAPON), and if the player doesn't have a gun out, tell the ped to put away his weapon (set his weapon to the hash of "WEAPON_UNARMED"). 1 Link to post Share on other sites
Sneakyyzz 0 Posted September 1, 2015 Author Share Posted September 1, 2015 In a tick, check if the player has a gun out, if he does then tell the ped to take out his weapon (SET_CURRENT_PED_WEAPON), and if the player doesn't have a gun out, tell the ped to put away his weapon (set his weapon to the hash of "WEAPON_UNARMED"). I'm a little confused? In the tick what do I start off with? I'm not very good at C# yet. Link to post Share on other sites
ISOFX 78 Posted September 1, 2015 Share Posted September 1, 2015 You got skype? I can help you out if you want. add me on skype: isofxyt Link to post Share on other sites
GeorgeZhang 25 Posted September 1, 2015 Share Posted September 1, 2015 Doesn't putting them in player's group automatically does this? I don't know but I didn't have bodyguard code in tick event but my bodyguard just DOES THAT. I merely added them to player's group as members, and player as group leader, maybe this is what made them do it? Link to post Share on other sites
Sneakyyzz 0 Posted September 2, 2015 Author Share Posted September 2, 2015 Doesn't putting them in player's group automatically does this? I don't know but I didn't have bodyguard code in tick event but my bodyguard just DOES THAT. I merely added them to player's group as members, and player as group leader, maybe this is what made them do it? Can I talk to you over skype or steam? Link to post Share on other sites
GeorgeZhang 25 Posted September 2, 2015 Share Posted September 2, 2015 Doesn't putting them in player's group automatically does this? I don't know but I didn't have bodyguard code in tick event but my bodyguard just DOES THAT. I merely added them to player's group as members, and player as group leader, maybe this is what made them do it? Can I talk to you over skype or steam?I have Skype but my name is GeorgeZhang which is very common. Maybe you can give ne yours? Link to post Share on other sites
elsewhat 78 Posted September 2, 2015 Share Posted September 2, 2015 GIVE_WEAPON_TO_PED has a parameter for equip now http://www.dev-c.com/nativedb/func/info/bf0fd6e56c964fcb Example WEAPON::GIVE_WEAPON_TO_PED(ped, GAMEPLAY::GET_HASH_KEY("WEAPON_SMG"), 1000, 1, 1); Link to post Share on other sites
Jitnaught 422 Posted September 2, 2015 Share Posted September 2, 2015 In a tick, check if the player has a gun out, if he does then tell the ped to take out his weapon (SET_CURRENT_PED_WEAPON), and if the player doesn't have a gun out, tell the ped to put away his weapon (set his weapon to the hash of "WEAPON_UNARMED"). I'm a little confused? In the tick what do I start off with? I'm not very good at C# yet. Some test code I wrote. Untested. Ped plrPed = Game.Player.Character; if (plrPed.Weapons.Current.Hash != WeaponHash.Unarmed) { if (Function.Call<bool>(Hash.HAS_PED_GOT_WEAPON, yourPed.Handle, (uint)WeaponHash.SpecialCarbine, false)) { Function.Call(Hash.SET_CURRENT_PED_WEAPON, yourPed.Handle, (uint)WeaponHash.SpecialCarbine, true); } else { yourPed.Weapons.Give(WeaponHash.SpecialCarbine/*whatever weapon you wanna give*/, 120, true/*equip now*/, true); } } else { if (!(yourPed.Weapons.Current.Hash == WeaponHash.Unarmed)) { Function.Call(Hash.SET_CURRENT_PED_WEAPON, yourPed.Handle, (uint)WeaponHash.Unarmed, true); } }Replace yourPed with your ped variable and WeaponHash.SpecialCarbine with the WeaponHash you want to give to the ped. Link to post Share on other sites