[Release] [ESX/Standalone] Weapon Reload

reloadimg

This script was custom-made for a client, which means that not every weapon/ammo-related feature has been added to the script. However, if a feature is requested and I have time, I could add it in an update.

I’ll try to help with issues and problems as much as I can if these arise.
If you have any suggestions, ideas, or improvements then please let me know!


Description
Removes the reloading logic from GTA and replaces it with a more realistic way of reloading weapons.
To reload your weapon, the keybind is “R” on the keyboard.
Ammunition can never be above the max amount of the clip size of the specific weapon.

Features

  • Maximum ammunition is the size of the clip size.
  • Reloading only works if you possess a specific item in your inventory (only ESX).
  • You cannot reload if your clip size is full.
  • One reload equals the maximum amount of ammunition in the clip size.

Usage

  • Idle: 0.01ms.
  • While holding a weapon (not melee): 0.03-0.04ms.

Config

config.lua
Config = {}

Config.Framework = "ESX"                --"ESX" or "STANDALONE"

Config.Debug = false                    --Displays information about the current weapon (prints to console).
Config.DebugRefresh = 5000              --How often should it refresh.

Config.Item = "REPLACE_ME"             --Database name of YOUR item that should be used as a weapon clip.

Config.SpamDelay = 1500                 --If trigger and error; How long delay until next trigger.
Config.CheckAndApplyAmmo = true         --Weapons that have ammo beyond the clip gets its ammo automatically removed.
Config.DisablePistolPunching = true     --Remove melee hits while wielding a weapon.

Config.NotificationStyle = "ESX"        --"ESX" or "CONSOLE"; Defaults back to console (print) if not ESX.
Config.Notifications = {
    FullClip = "You have a fully loaded clip in your weapon",
    NotEnough = "You don't have enough ammo boxes", --This is only if framework is "ESX"
}

Video Showcase


If the video doesn’t work, click here.

Download/Github

7 Likes

how do you define mutiple ammo items. With the inventory i use, each weapon has its own ammo item (ex: ammo_weapon_pistol, ammo_weapon_heavypistol etc)

4 Likes

Thank you for the script! I’d also like to know how to define multiple ammo items?

1 Like

@Wollffus @ChromeNine I’ll take a look at this either today or tomorrow when I can find some time.

1 Like

Thanks, because this is a really neat feature. Just as it stands, you would have to make one single item load every gun in game

has anyone figured out how to define more than one ammo item?

Nah, i would liek it too.

1 Like

[Release][ESX] Reloading System that one

1 Like

ayo, i cant entry on server it says : my character not found, i want to entry but i cant and this is my fav server man :frowning:

Good work ty

2 Likes

Any posibility this could also work for QBus?

I don’t know the QB callouts by heart. However, you could replace the ESX code with the correct code from QB if you know them.

Is there a way to disable putting your gun away when you run out of ammo?

Hello I run a QBCORE server the script works great the only problem i am having in when reloading it dosen’t take the ammo out of the players inventory.

Does anyone know how to fix this?

You can use
local src = source local Player = QBCore.Functions.GetPlayer(src) Player.Functions.RemoveItem('ammo', 1)

but you also need to figure out what weapon the person is reloading and remove the appropriate ammo type