• Removing Entities
    1 replies, posted
How would I go about removing all entities? I don't want players to be removed though. Thanks if you do help me.
[code]// Loop through all entities for k, v in pairs( ents.GetAll( ) ) do // Don't remove invalid entities because we won't be able to if ( !IsValid( v ) ) then continue; end // Don't remove players, because that never ends well if ( v:IsPlayer( ) ) then continue; end // Remove the entity ( although you'll be removing all doors in the map, windows that are entities, weapons, etc... v:Remove( ); end[/code] or [code]// Loop through all entities for k, v in pairs( ents.GetAll( ) ) do // This checks to make sure the object is valid, and that it isn't a player already. SafeRemoveEntity( v ); end[/code] Both of these do the same thing.
Sorry, you need to Log In to post a reply to this thread.