What I’m trying to do is make a SWep I have that deploys an entity that supplies ammo not give ammo for itself. I think I just have the syntax wrong on the code, but I can’t figure it out. Maybe someone else can see what’s wrong here.
[lua]
function ENT:Think()
if CurTime() >= AmmoDeployDelay then
for _K, _V in pairs(ents.FindInSphere(self:GetPos(), FindRadius)) do
if _V:IsPlayer() and _V:Alive() then
if AmmoCharge > 0 then
_W = _V:GetActiveWeapon()
_PRIAMMO = _W:GetPrimaryAmmoType()
_SECAMMO = _W:GetSecondaryAmmoType()
if _W == (“eq_bag_ammo_bf2” or “eq_bag_medic_bf2” or “eq_c4”) then return false end
if _PRIAMMO == (“ammobag” or “c4” or “medbag”) then return false end
– ammo giving stuff
else
SafeRemoveEntity(self)
end
end
end
AmmoDeployDelay = CurTime() + AmmoGiveDelay
end
end
[/lua]
Right now it’s giving ammo for itself in a recursive manner and that’s not what needs to happen.