Garry's Mod Wiki

Entity:MapCreationID

  number Entity:MapCreationID()

Description

Returns entity's map creation ID. Unlike Entity:EntIndex or Entity:GetCreationID, it will always be the same on same map, no matter how much you clean up or restart it.

It may change if the map is recompiled, even if no edits were made. It will definitely change if entities are added or removed from the map file.

To be used in conjunction with ents.GetMapCreatedEntity. See also Entity:CreatedByMap.

Returns

1 number
The map creation ID or -1 if the entity is not compiled into the map.
If the ID exists, it is identical to the entity's order number as it appears in Lump 1 of the BSP file. It is believed to start at 1234 for some reason.