View Single Post
Silvers
SourceMod Plugin Approver
Join Date: Aug 2010
Location: SpaceX
Old 01-27-2023 , 08:36   Re: [L4D2] Weapon Remove
Reply With Quote #31

Quote:
Originally Posted by Grey83 View Post
No, weapon spawners have much larger indexes.
PHP Code:
public void OnMapStart()
{
    
char cls[32];
    for(
int i 1max GetMaxEntities(); <= maxi++)
        if(
IsValidEdict(i) && IsValidEntity(i)
        && 
GetEntityClassname(iclssizeof(cls)) && !strncmp(cls"weapon_"7false))
        {
            
PrintToServer("\n    Entity '%s' (Id: %i, MaxClients: %i)\n"clsiMaxClients);
            break;
        }

It's much faster to use
PHP Code:
int entity = -1;
while( (
entity FindEntityByClassname(entity"weapon_*") != INVALID_ENT_REFERENCE) ) 
instead of a loop like this.
__________________
Silvers is offline