you can still use findentityinsphere. thats what entity->IsPlayer() is for. so you can distinguish between them.
-omega Blackened Interactive http://www.nofadz.com/blackened IRC: irc.gamesnet.net channel: #blackened-interactive Assistant Coder, Underhive (http://www.underhive.com) ----- Original Message ----- From: "Reedbeta" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 02, 2002 11:49 PM Subject: RE: [hlcoders] Items.cpp (MyTouch) > Well, if you only want to find players in the 600-unit radius, I would not use > UTIL_FindEntityInSphere, since that finds all entities (not just players). I > was thinking something like this: > > TraceResult tr; > Vector vecSpot; > CBaseEntity *pEntity; > > // Loop through all player slots > for (int i = 1; i <= gpGlobals->maxClients; i++) > { > pEntity = UTIL_PlayerByIndex(i); > // Check if there is actually a player connected to this slot > if (pEntity) > { > // Do a traceline to them > UTIL_TraceLine(pev->origin, pEntity->pev->origin + > pEntity->pev->view_ofs, dont_ignore_monsters, edict(), &tr); > // Did the traceline hit them? > if ((tr.flFraction == 1.0) || (ENTINDEX(tr.pHit) == > pEntity->entindex())) > { > // Do whatever you need to do, screenfades, whatever > } > } > } > > --- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > > I would not do that in the MyTouch correct? > > > > I drummed up this from the RadiousDamage > > > > BOOL MyTouch( CBasePlayer *pPlayer ) // was My Touch > > { > > CBaseEntity * pEntity = NULL; > > TraceResult tr; > > Vector vecSpot; > > > > while ((pEntity = UTIL_FindEntityInSphere( pEntity, > > pev->origin, 600 )) != NULL) > > { > > vecSpot = pEntity->BodyTarget( pev->origin ); > > UTIL_TraceLine ( pev->origin, vecSpot, > > dont_ignore_monsters, ENT(pev), &tr ); > > if ( tr.flFraction == 1.0 || tr.pHit == > > pEntity->edict() ) { > > UTIL_ScreenFade( pPlayer, > > Vector(255,255,255), 10.0, 2.0, 255, FFADE_IN); > > } > > } > > pev->nextthink = gpGlobals->time + 0.1; > > return TRUE; > > } > > > > As you know by looking... CRASH is the word for the day.. > > > > Not to sure where to put the trace code or even if it is correct > > > > -Ron > > > > -----Original Message----- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED]] On Behalf Of Reedbeta > > Sent: Wednesday, January 02, 2002 3:43 PM > > To: [EMAIL PROTECTED] > > Subject: Re: [hlcoders] Items.cpp (MyTouch) > > > > > > Yes, tracelines are probably the way to go. Simply loop through the > > player slots and for each valid player, do a traceline from the grenade > > to the player's eye position (or whatever other position) and if it > > doesn't hit anything, you can do whatever the grenade is supposed to do. > > > > --- "Yacketta, Ronald" <[EMAIL PROTECTED]> wrote: > > > Have a quick question, just coded a new grenade type. I would like > > > only the players In the FOV of the grenade to be affected by it, that > > > is players behind a wall or obscured by > > > Something are not affected. > > > > > > I have looked through items.cpp and have not found a decent example > > > (or one at all) Would I need to add some traceline code to the > > > MyTouch? Would actually like > > > To trace from the grenade out to find players and affect then, instead > > > of from > > > The player to the grenade. > > > > > > Regards, > > > Ron > > > _______________________________________________ > > > To unsubscribe, edit your list preferences, or view the list archives, > > > > > please > > > visit: > > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > > > > > __________________________________________________ > > Do You Yahoo!? > > Send your FREE holiday greetings online! http://greetings.yahoo.com > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, > > please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ > > To unsubscribe, edit your list preferences, or view the list archives, please > > visit: > > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > > > > __________________________________________________ > Do You Yahoo!? > Send your FREE holiday greetings online! > http://greetings.yahoo.com > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders

