I made this script for my server that should remove all weapons on the map when the new round starts, but it doesnt work.
I placed it in lua/autorun/server/weaponremove.lua. Does anyone know how to fix it?
[CODE]hook.add( "GWPreGame", "WeaponRemove", function()
for k,v in pairs(ents.GetAll()) do
if v:IsWeapon() then v:Remove() return
end
end
end)[/CODE]
[QUOTE=Leafdroid;49596688]I made this script for my server that should remove all weapons on the map when the new round starts, but it doesnt work.
I placed it in lua/autorun/server/weaponremove.lua. Does anyone know how to fix it?
[CODE]hook.add( "GWPreGame", "WeaponRemove", function()
for k,v in pairs(ents.GetAll()) do
if v:IsWeapon() then v:Remove() return
end
end
end)[/CODE][/QUOTE]
Once you find the first weapon you return out of the function...
[QUOTE=tzahush;49596722]Once you find the first weapon you return out of the function...[/QUOTE]
So I just remove the return?
[QUOTE=Leafdroid;49596729]So I just remove the return?[/QUOTE]
Yes
[QUOTE=tzahush;49596730]Yes[/QUOTE]
Still doesnt work :/
[QUOTE=Leafdroid;49596734]Still doesnt work :/[/QUOTE]
Print all of the entites it is passing, debug it a bit and see why it isn't working.
Apparently he didn't relog the map after he made the changes. (Linux)
Should work now.
Sorry, you need to Log In to post a reply to this thread.