G.IsFriendEntityName

From GMod Wiki

Jump to: navigation, search
Function
Syntax IsFriendEntityName( victimtype )
Where is this used?
Description:
Tests is an NPC friendly to the player.
Returns: Boolean
Part of Library: Global Functions
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=G.IsFriendEntityName]G.IsFriendEntityName [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionGives or takes 1 frag from the player depending on hostility of the killed NPC.
Used onNewerShared.png
Code
 
hook.Add("OnNPCKilled","RewardOrPunish",function(npc,ply)
 if IsEnemyEntityName(npc:GetClass()) then
  ply:AddFrags(1)
 elseif IsFriendEntityName(npc:GetClass()) then
  ply:AddFrags(-1)
 end
end)
 
OutputN/A

Additional Notes

npc_alyxnpc_barneynpc_citizen
npc_elinpc_kleinernpc_magnusson
npc_monknpc_mossmannpc_vortigaunt
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox