For loop failing when giving weapons

i am working on my pvp minigame for the lobby when i stumbled upon a flaw: the for loop , the only way i imagined to give weapons to EVERYONE failed. here is my indipendant code that should work:

[lua]

function playerDies( victim, weapon, killer )

if victim:IsPlayer() and killer:IsPlayer() then
	killer:SetNWInt( "money", killer:GetNWInt( "money" ) + 10)
	local ourmoney = killer:GetNWInt( "money" )
	file.Write(gmod.GetGamemode().Name .."/Money/".. string.gsub(killer:SteamID(), ":", "_") ..".txt", ourmoney)
	local vPoint = killer:GetPos() + Vector(0,0,30)
	local effectdata = EffectData()
	effectdata:SetStart( vPoint )
	effectdata:SetOrigin( vPoint )
	effectdata:SetScale( 1 )
	util.Effect( "balloon_pop", effectdata )	
end

end

hook.Add( “PlayerDeath”, “playerDeathTest213413854”, playerDies )

function enable_pvp( ply )
if ply:IsAdmin() then
local allplayers = player.GetAll()
for i = 1, table.Count(allplayers) do
local v = allplayers*
v:SetTeam( 5 )
v:Give( “weapon_ar2” )
v:Give( “weapon_pistol” )
v:Give( “weapon_crowbar” )
v:Give( “weapon_357” )
v:Give( “weapon_shotgun” )
end
server_settings.Int( “sbox_godmode”, 0 )
umsg.Start(“PVP_enable”, ply)
umsg.End()
end
end

concommand.Add(“lobby_pvp_enable”, enable_pvp)

function disable_pvp( ply )
if ply:IsAdmin() then
local allplayers = player.GetAll()
for i = 1, table.Count(allplayers) do
local v = allplayers*
v:StripWeapons()
if v:IsSuperAdmin() then
v:SetTeam( 3 )
elseif v:IsAdmin() then
v:SetTeam( 2 )
else
v:SetTeam( 1 )
end
end
server_settings.Int( “sbox_godmode”, 1 )
umsg.Start(“PVP_disable”, ply)
umsg.End()
end
end

concommand.Add(“lobby_pvp_disable”, disable_pvp)

local function test()
local allplayers = player.GetAll()
for i = 1, table.Count(allplayers) do
local ply = allplayers*
ply:SetVelocity(Vector(0,0,50) * 50 )
end
end

concommand.Add(“lobby_pvp_debug”, test)

[/lua]

the lobby_pvp_debug command works as it should and sends everyone flying into the air so what am i doing wrong with the enabling bit. also: i did try the for k,v in pairs(player.GetAll()) do v:Give thing but that fails aswell . Any ideas?

bump

What do you mean it fails? does it error or just not do anything?

None admins don’t get Eros for some reason

[editline]11:04PM[/editline]

Weapons, not Eros

Are you saying that something like this doesn’t work?

[lua]for _, v in ipairs(player.GetAll()) do
v:Give(“weapon_ar2”) ;
v:Give(“weapon_pistol”) ;
v:Give(“weapon_crowbar”) ;
v:Give(“weapon_357”) ;
v:Give(“weapon_shotgun”) ;
end[/lua]

Yep, tried that befor I used my hacky way of geting all players

[editline]11:06PM[/editline]

Why are you using ipairs? The order doesn’t count and ur making italot slower. Use pairs

The table is numerically indexed, so I am using ipairs, it isn’t any slower. It would only make a difference in speed with tables that have over like 100,000 indices.

Ok! So, any ideas?

Not really, I don’t see how something so simple can not be working.

Any other ways to do it?