Garry's Mod Wiki

Revision Difference

Global.IsEnemyEntityName#551291

<function name="IsEnemyEntityName" parent="Global" type="libraryfunc"> <description> Returns if the given NPC class name is an enemy. ⤶ ⤶ <bug> npc_antlion_worker and npc_poison_headcrab (the headcrabs thrown by posion zombies) dose not have enemy status despite being hostile to the player </bug>⤶ ⤶ Returns true if the entity name is one of the following:⤶ * "npc_antlion"⤶ * "npc_antlionguard"⤶ * "npc_antlionguardian"⤶ * "npc_barnacle"⤶ * "npc_breen"⤶ * "npc_clawscanner"⤶ * "npc_combine_s"⤶ * "npc_cscanner"⤶ * "npc_fastzombie"⤶ * "npc_fastzombie_torso"⤶ * "npc_headcrab"⤶ * "npc_headcrab_fast"⤶ * "npc_headcrab_poison"⤶ * "npc_hunter"⤶ * "npc_metropolice"⤶ * "npc_manhack"⤶ * "npc_poisonzombie"⤶ * "npc_strider"⤶ * "npc_stalker"⤶ * "npc_zombie"⤶ * "npc_zombie_torso"⤶ * "npc_zombine"⤶ ⤶ <note>Some NPCs are missing from this list even though they are hostile to players. If you'd like to complete this function until this [pull request](https://github.com/Facepunch/garrysmod/pull/2000) is merged, here are the missing NPCs: `npc_combine_camera`, `npc_turret_ceiling`, `npc_combinedropship`, `npc_combinegunship`, `npc_helicopter`, `npc_turret_floor`, `npc_antlion_worker`, `npc_headcrab_black`.</note>⤶ ⤶ Returns `true` if the entity name is one of the following:⤶ * `npc_antlion`⤶ * `npc_antlionguard`⤶ * `npc_antlionguardian`⤶ * `npc_barnacle`⤶ * `npc_breen`⤶ * `npc_clawscanner`⤶ * `npc_combine_s`⤶ * `npc_cscanner`⤶ * `npc_fastzombie`⤶ * `npc_fastzombie_torso`⤶ * `npc_headcrab`⤶ * `npc_headcrab_fast`⤶ * `npc_headcrab_poison`⤶ * `npc_hunter`⤶ * `npc_metropolice`⤶ * `npc_manhack`⤶ * `npc_poisonzombie`⤶ * `npc_strider`⤶ * `npc_stalker`⤶ * `npc_zombie`⤶ * `npc_zombie_torso`⤶ * `npc_zombine`⤶ </description> <realm>Shared and Menu</realm> <file line="317-L319">lua/includes/util.lua</file> <file line="330-L345">lua/includes/util.lua</file> <args> <arg name="className" type="string">Class name of the entity to check</arg>⤶ <arg name="className" type="string">Class name of the entity to check.</arg>⤶ </args> <rets> <ret name="" type="boolean">Is an enemy</ret>⤶ <ret name="" type="boolean">Is an enemy?</ret>⤶ </rets> </function>