AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to count entities in a map (https://forums.alliedmods.net/showthread.php?t=74508)

hzqst 07-20-2008 07:45

how to count entities in a map
 
Quote:

public plugin_init(){
set_task(1.0,"ent_counter")
...
}
Quote:

public ent_counter(){
new physnum
while((ent = find_ent_by_class(ent, "zombiemod_phys")) != 0)
physnum ++
new gphys[physnum+1]
}
error --- array must be a number -_-
i want to get indexes of all entities

Sn!ff3r 07-20-2008 08:20

Re: how to count entities in a map
 
Array size must be constant.

Exolent[jNr] 07-20-2008 16:55

Re: how to count entities in a map
 
Use Dynamic Arrays.

PHP Code:

public ent_counter()
{
    new Array:
entities ArrayCreate(132);
    
    while( (
ent find_ent_by_class(ent"zombiemod_phys")) )
    {
        
ArrayPushCell(entitiesent);
    }
    
    new 
total ArraySize(entities);
    
    
// ....




All times are GMT -4. The time now is 05:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.