Jump to content

[Q] Can We Reload A Gun By Script?


Recommended Posts

Hey Guys I Am Back..... to Modding

 

So I Was Making A Mod And Came Across Of This.....Is It Possible o.O ???

 

i Know its a dumb question because we can just reload it by using R but i am making a mod and if it works its gonna be awesome!

 

 

Its A secert.....and if u guys help me u r in the credit list ^^

Link to comment
https://gtaforums.com/topic/710557-q-can-we-reload-a-gun-by-script/
Share on other sites

LordOfTheBongs

1. Check gun player is holding and if player is crouching

2. Play correct animation for if standing or crouching and correct gun, use flags to allow rotation, upper body only and something called root motion... see here

 

flag 1: return "RootMotion - Updates Position";
flag 2: return "Unknown";
flag 3: return "Lock On Pelvis Z";
flag 4: return "Freeze Last Rotation";
flag 5: return "Repeat";
flag 6: return "Freeze Last Frame";
flag 7: return "End@ Current Position";
flag 8: return "UpperBody Only Unk.";
flag 9: return "UpperBody Only";
flag 10: return "Idle/Block Controls";
flag 11: return "Allow Ped Rotation";
flag 12: return "Unknown";

3. Game.LocalPlayer.Character.Weapons.TheWeapon.AmmoInClip = x;

LordOfTheBongs

You had the same in mind as me, i had all animations done, but could not figure out how to restock the ammo!

oh cool, yeah here is a better way to do it so it works for any gun and refills ammo to max...

Game.LocalPlayer.Character.Weapons.Current.AmmoInClip = Game.LocalPlayer.Character.Weapons.Current.MaxAmmoInClip;
Edited by LordOfTheBongs

Hey LordofBongs Can We Put Like This:

case "Reload":                    Game.LocalPlayer.Character.Weapons.FromType(Game.LocalPlayer.Character.Weapons.CurrentType).AmmoInClip = Game.LocalPlayer.Character.Weapons.FromType(Game.LocalPlayer.Character.Weapons.CurrentType).MaxAmmoInClip;                    currentFunction = null;                    break;

hehehe ^^

yes u can do that but i edited the code, check my post again ;)

 

i made it shorter and it does the same thing

 

Haha, i add it to my script with the animations. And what is see now, i forgot to sue unknown11 to keep Niko able to walk while reloading.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.