Hey there, i don't use to ask for help, but right now i'm a bit confused, this function keeps returning wrong,
function checkWeapon(player,cat)
melee = {1,10}
primary = {3,5,6}
secondary = {2,4}
projectiles = {7,8}
if cat == "Melee" then
for i,v in pairs(melee) do
if getPedTotalAmmo ( player, v ) == 0 then
return true
else
outputChatBox("You already have a weapon of this category!",player,255,0,0)
return false
end
end
elseif cat == "Primary" then
for i,v in pairs(primary) do
if getPedTotalAmmo ( player, v ) == 0 then
return true
else
outputChatBox("You already have a weapon of this category!",player,255,0,0)
return false
end
end
elseif cat == "Secondary" then
for i,v in pairs(secondary) do
if getPedTotalAmmo ( player, v ) == 0 then
return true
else
outputChatBox("You already have a weapon of this category!",player,255,0,0)
return false
end
end
elseif cat == "Projectiles" then
for i,v in pairs(projectiles) do
if getPedTotalAmmo ( player, v ) == 0 then
return true
else
outputChatBox("You already have a weapon of this category!",player,255,0,0)
return false
end
end
end
end
It's used to check if i have a weapon in the desired category or not, but somehow it keeps returning that i don't have, any help is appreciated.
Thanks in advance.