Zombie Survival console error?

I just implemented a new add-on in zombie survival that allows specific user groups (admins) to make it so that they can “ban” people from using the hammer, basically what it does is it forces them to drop it initially, and if they pick it up again then they drop it again (etc.etc.) I get the following error code over and over when someone is banned:

TEST [gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/animations.lua][gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua]
TEST [gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua][gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua]
FOUND IN ADDON [0]
TEST [gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/shared.lua][gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua]

[ERROR] gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua:74: attempt to call method ‘GetBarricadeGhosting’ (a nil value)

  1. func - gamemodes/zombiesurvival/entities/weapons/weapon_zs_basemelee/cl_init.lua:74
  2. unknown - gamemodes/base/gamemode/cl_init.lua:563

however, the errors stop when the ban is removed. I honestly don’t know what those methods are or GetBarricadeGhosting is. I feel like this isn’t a really hard issue to fix because the add-on works exactly as intended and the actual game is not affected at all (apart from the “something is creating script errors” box in the top left. Any ideas guys?

The issue probably comes because while a separate addon is forcing them to drop it the first frame ( hooks run before GM functions ), the same first-frame on each client is trying to draw/do something to their active weapon… but when the GM function or hook that runs after the drop occurs on the same frame, the active weapon is NULL so the function won’t exist…

So basically:
Frame1: Addon drops weapon, other addon/gm running on client tries grabbing player active weapon in order to do something; weapon already dropped error
Frame2: Pick up weapon, addon drops weapon …

What needs to happen is another hook needs to be added in the addon which bans weapons: http://wiki.garrysmod.com/page/GM/PlayerCanPickupWeapon

That’ll prevent the weapon from being picked back up only for the addon to drop it and cause other addons / game to go haywire because it thinks the player has the weapon for that frame…

You can also add some IsValid checks to the cl_init, or do:
local _ghosting = ( weapon.GetBarricadeGhosting ) && weapon:GetBarricadeGhosting( ) || 0;

Or, if ( !IsValid( weapon ) || weapon.GetBarricadeGhosting ) then return; end