Garry's Mod Wiki

Entity:HasSpawnFlags

  boolean Entity:HasSpawnFlags( number spawnFlags )

Description

Returns whether this entity has the specified spawnflags bits set.

Arguments

1 number spawnFlags
The spawnflag bits to check, see SF enum.

Returns

1 boolean
Whether the entity has that spawnflag set or not.

Example

As seen in sandbox's PhysgunPickup hook.

function GM:PhysgunPickup( ply, ent ) -- Don't move physboxes if the mapper logic says no if ( ent:GetClass() == "func_physbox" && ent:HasSpawnFlags( SF_PHYSBOX_MOTIONDISABLED ) ) then return false end return true end