• How would you go about to remove all the weapons in a map?
    6 replies, posted
well i found some weapons in a map that i don't want there how do i remove them?
[lua] local function RemoveWeps() for k,v in pairs(ents.GetAll()) do if string.find(v:GetClass(),"weapon_") ~= nil then v:Remove() end end end hook.Add("InitPostEntity","RemoveWeps",RemoveWeps) [/lua]
hmm care to explain what your doing with? [lua] ~= nil then [/lua]
[QUOTE=Gbps;20203563][lua]if string.find(v:GetClass(),"weapon_") ~= nil then[/lua][/QUOTE] [lua]if string.find(v:GetClass(),"weapon_") then[/lua]
[QUOTE=MakeR;20206580][lua]if string.find(v:GetClass(),"weapon_") then[/lua][/QUOTE] [lua]if v:IsWeapon() then[/lua]
[QUOTE=|FlapJack|;20207566][lua]if v:IsWeapon() then[/lua][/QUOTE] I wasn't saying that was the best way of doing it, I was just showing that Gbps was doing a pointless comparison.
[QUOTE=MakeR;20207609]I wasn't saying that was the best way of doing it, I was just showing that Gbps was doing a pointless comparison.[/QUOTE] Well, I mostly make that comparison to specify that the return I wish for is not nil. I don't feel particularly safe leaving a window open for extra input (such as a boolean)
Sorry, you need to Log In to post a reply to this thread.