Advertisement
Guest User

change_weapon_model

a guest
Mar 17th, 2018
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1.  
  2. private Entity GetCurrentWeapon(Ped ped)
  3. {
  4.     return  Function.Call<Entity>(Hash.GET_CURRENT_PED_WEAPON_ENTITY_INDEX, player.Character);
  5. }
  6. private void ChangeWeaponModel()
  7. {
  8.     Entity weap = null;
  9.     Object weapObject = null;
  10.     if ((weap = GetCurrentWeapon(Game.Player.Character)) != null)
  11.     {
  12.         if (weap.Model.Hash == WantedWeaponModelHash)
  13.         {
  14.             weapObject = Function.Call(Hash.CREATE_WEAPON_OBJECT, WantedWeaponHash, -1, weap.Position.X, weap.Position.Y, weap.Position.Z, true, weap.Heading/*Not sure about the heading, might need tweaking*/, 0);
  15.             if (weapObject != null)
  16.             {
  17.                     weapObject.AttachTo(Game.Player.Character, playerHandBoneIndex, weapObject.Position, new Vector3(objRot.X, objRot.Y, objRot.Z));
  18.                     Function.Call(Hash.CREATE_MODEL_SWAP, weapObject.Position.X, weapObject.Position.X, weapObject.Position.X, hashRadius, wantedWeaponModelHash, newWeaponModelHash, true);
  19.             }
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement