Jump to content

[HELP]Verifica munição Player


Recommended Posts

Este código verifica os todos slots de arma do jogador e salva as armas e a munição na tabela:

local wepsTable = {}
for i=0, 12 do
	local weapon = getPedWeapon(player, i)
	local weaponAmmo = getPedTotalAmmo(player, i)
	if tonumber(weaponAmmo) > 0 then
		wepsTable[weapon] = weaponAmmo
	end
end

Pra verificar um slot específico então seria:

local weapon = getPedWeapon(player, 4)
local weaponAmmo = getPedTotalAmmo(player, 4)
if weapon and weapon ~= 0 and weaponAmmo > 0 then
	outputChatBox( "(Slot 4) Arma: "..tostring(weapon).."; Munição: "..tostring(weaponAmmo) )
elseif weapon and weapon ~= 0 and weaponAmmo == 0 then
	outputChatBox( "(Slot 4) Arma: "..tostring(weapon).."; Sem munição!" )
elseif weapon and weapon == 0 then
	outputChatBox( "(Slot 4) Nenhuma arma nesse slot!" )
end

 

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...