lua
RegisterCommand('mcikar', function(_)
local player = PlayerPedId()
if IsPedArmed(player, 4) then
local weapon
local found, currentWeapon = GetCurrentPedWeapon(player, true)
if found then
for k, v in pairs(Config.Ammo) do
for y, z in pairs(v.weapons) do
if z == currentWeapon then
weapon = currentWeapon
local pedAmmo = GetAmmoInPedWeapon(player, weapon)
if pedAmmo >= v.count then
local magcount = math.floor(pedAmmo / v.count)
local currentAmmo = math.floor(pedAmmo - (magcount * v.count))
SetPedAmmo(player, weapon, currentAmmo)
TaskReloadWeapon(player)
TriggerServerEvent('m3:inventoryhud:server:updateAmmoCount', weapon, currentAmmo)
TriggerServerEvent('disc-ammo:addAmmoItem', {name = v.name, count = tonumber(magcount)})
else
exports['mythic_notify']:SendAlert('error', 'Silahında çıkartabileceğin kadar mermi yok!')
end
return
end
Wait(0)
end
Wait(0)
end
end
else
exports['mythic_notify']:SendAlert('error', 'Elinde herhangi bir silah yok!')
end
end)