View Single Post
Author Message
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 09-14-2009 , 19:04   [TUT] Usage EngFunc_EntitiesInPVS
Reply With Quote #1

This is my first tutorial.

After interpreting trigger.cpp (from HLDS), I decided to make this tutorial.

EngFunc_EntitiesInPVS (maybe the same for EngFunc_FindClientInPVS)
It returns an entity in PVS (potential visible set) of a player.
It never returns worldspawn.

In that entity returned, you have a set of chained entities using pev_chain.

Example
Code:
public whatisonPVS(id) {     static next, chain;     static class[32];     next = engfunc(EngFunc_EntitiesInPVS, id);     while(next)     {         pev(next, pev_classname, class, charsmax(class));         chain = pev(next, pev_chain);         server_print("Found entity in player (%i) PVS: ent(%i) class(%s)", id, next, class);         if(!chain)             break;         next = chain;     } }

So this function iterates over and over every entity until pev_chain is NULL.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.

Last edited by joropito; 10-16-2009 at 19:40.
joropito is offline
Send a message via MSN to joropito