AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   listing all entity in current map (https://forums.alliedmods.net/showthread.php?t=62945)

l4ulwtlln 11-08-2007 02:32

listing all entity in current map
 
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)

ConnorMcLeod 11-08-2007 07:04

Re: listing all entity in current map
 
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     }

Orangutanz 11-08-2007 08:29

Re: listing all entity in current map
 
Download SHPTools in my sig, in console type listent, for more specific information you can do printent ID Number

VEN 11-08-2007 09:43

Re: listing all entity in current map
 
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.

ConnorMcLeod 11-08-2007 10:25

Re: listing all entity in current map
 
Thanks.
(fixed)

l4ulwtlln 11-08-2007 23:22

Re: listing all entity in current map
 
thank u both as u both helped me a lot


All times are GMT -4. The time now is 01:20.

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