• ERROR: Hook 'ProfEvener' Failed: [lua\weaponprofeven.lua:9] attempt to call method 'GetActiveWeapon'
    2 replies, posted
  • Title says the problem. I'm trying to make the code not execute when the NPC has a grenade because it causes the code to return a nil value ending the script :\ Code: [CODE]if NPC:GetActiveWeapon():IsValid() && NPC:GetActiveWeapon() != "weapon_frag" then[/CODE] [highlight](User was banned for this post ("Wrong section" - Gran PC))[/highlight]
  • All current NPC's. This: [CODE]NPCS = ents.FindByClass( "npc_*" ) if #NPCS == 0 then end for i=1,#NPCS do NPC = NPCS[i][/CODE] And I feel like a dumbass now because I failed to read the big sticky and will probably be banned for this post... EDIT: If it helps, it worked before I added that part of the script, and it fails when they throw a grenade. EDIT2: Hah! I fixed it. It turns out that active grenades are NPC's. [url]https://developer.valvesoftware.com/wiki/Npc_grenade_frag[/url].