Garry's Mod Wiki

Garry's Mod Wiki

  Entity:RemoveSpawnFlags( number flag )

Recently Added

This was recently added in version (2024.12.04). It might only be available on the Dev Branch right now.

Description

Removes a SpawnFlag from the current SpawnFlags of an Entity.

SpawnFlags can easily be found on https://developer.valvesoftware.com/wiki/.

See also Entity:AddSpawnFlags, Entity:SetSpawnFlags

Using SF Enumerations won't work, if this function is ran clientside due to the enumerations being defined only Serverside. Use the actual SpawnFlag number.

Arguments

1 number flag
The SpawnFlag to remove from the Entity

Example

When a turret Entity is created, it removes the Out of Ammo SpawnFlag, if it has it. Therefore it now has ammo.

hook.Add( "OnEntityCreated", "RemoveSpawnFlagsExample", function( ent ) timer.Simple( 0.1, function() if ( !IsValid(ent) or ent:GetClass() != "npc_turret_floor" ) then return end if ( !ent:HasSpawnFlags(256) ) then return end ent:RemoveSpawnFlags(256) -- https://developer.valvesoftware.com/wiki/Npc_turret_floor#Flags end ) end )

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...