Raised This Month: $ Target: $400
 0% 

how to count entities in a map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
hzqst
Senior Member
Join Date: Jul 2008
Old 07-20-2008 , 07:45   how to count entities in a map
Reply With Quote #1

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

Last edited by hzqst; 07-20-2008 at 08:00.
hzqst is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 07-20-2008 , 08:20   Re: how to count entities in a map
Reply With Quote #2

Array size must be constant.
Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 07-20-2008 , 16:55   Re: how to count entities in a map
Reply With Quote #3

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);
    
    
// ....

__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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