Raised This Month: $ Target: $400
 0% 

listing all entity in current map


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
l4ulwtlln
Member
Join Date: Aug 2007
Old 11-08-2007 , 02:32   listing all entity in current map
Reply With Quote #1

i kno if i do this i can get entities by searching for it but it is very tedious

PHP Code:
        register_forward(FM_Touch"touch")

public 
touch(touchedtoucher)
{
        static 
classname[33]
        
pev(touchedpev_classnameclassname32)

        static 
mapname[33]
        
get_mapname(mapname32)
        
log_amx("%s: %s"mapnameclassname)

        return 
FMRES_IGNORED

so i was wondering how i would get a list of all entities on the current map without having to physically search for it? (i might be using the wrong word here but i think u all should understand what i want)
l4ulwtlln is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-08-2007 , 07:04   Re: listing all entity in current map
Reply With Quote #2

Do something like this :

Code:
    new g_max_clients = global_get(glb_maxClients)     new entitiesnum = global_get(glb_maxEntities)     for(new i = g_max_clients + 1; i < entitiesnum ; i++)     {         // do what you want with each entity     }

Last edited by ConnorMcLeod; 11-08-2007 at 10:25.
ConnorMcLeod is offline
Orangutanz
Veteran Member
Join Date: Apr 2006
Old 11-08-2007 , 08:29   Re: listing all entity in current map
Reply With Quote #3

Download SHPTools in my sig, in console type listent, for more specific information you can do printent ID Number
__________________
|<-- Retired from everything Small/Pawn related -->|
You know when you've been Rango'd
Orangutanz is offline
VEN
Veteran Member
Join Date: Jan 2005
Old 11-08-2007 , 09:43   Re: listing all entity in current map
Reply With Quote #4

Use of engfunc(EngFunc_NumberOfEntities) would be incorrect in this case. You should use global_get(glb_maxEntities) instead of that.
Let's say that you have ent1, ent2 and ent3, then if you would remove the second one number of entities would be 2 and your method will not detect the last one.
VEN is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-08-2007 , 10:25   Re: listing all entity in current map
Reply With Quote #5

Thanks.
(fixed)
ConnorMcLeod is offline
l4ulwtlln
Member
Join Date: Aug 2007
Old 11-08-2007 , 23:22   Re: listing all entity in current map
Reply With Quote #6

thank u both as u both helped me a lot
l4ulwtlln 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 01:20.


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