[hlcoders] Finding the entity based on the userid

2004-12-20 Thread Josh
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity that
is fired.



Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I determine
the IndexOfEdict or get the pointer to the entity of a userid?



Thanks,

Josh

--


___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Ronny Schedel
The UserID can be accessed through the IPlayerInfo
and the IPlayerInfoManager interfaces.
Greets
Ronny
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity
that
is fired.

Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I
determine
the IndexOfEdict or get the pointer to the entity of a userid?

Thanks,
Josh
--
___
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


Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Marcelo Bezerra
You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);
Loop from
Josh wrote:
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity that
is fired.

Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I determine
the IndexOfEdict or get the pointer to the entity of a userid?

Thanks,
Josh
--
___
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


RE: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Josh
OK all I have is the playerid (userid).  How do I get a pointer to the
entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
different number.

For example, I join a game then I call the iplayerinfo on myself and find
out that my userid is 2.  But IndexOfEdict is 1.  They are different.

Josh


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid

You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);

Loop from
Josh wrote:

This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity that
is fired.



Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I determine
the IndexOfEdict or get the pointer to the entity of a userid?



Thanks,

Josh

--


___
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



___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Pavol Marko
When you have the userid (the thing that appears in the logs and such), you
can do the loop thing to get the entity id (as described by Marcelo and me
before).
Then, you can do PEntFromEntIndex (or whatever) to get the edict pointer.
PM
- Original Message -
From: Josh [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, December 20, 2004 7:16 PM
Subject: RE: [hlcoders] Finding the entity based on the userid

OK all I have is the playerid (userid).  How do I get a pointer to the
entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
different number.
For example, I join a game then I call the iplayerinfo on myself and find
out that my userid is 2.  But IndexOfEdict is 1.  They are different.
Josh
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo
Bezerra
Sent: Monday, December 20, 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid
You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);
Loop from
Josh wrote:
This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity
that
is fired.

Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I
determine
the IndexOfEdict or get the pointer to the entity of a userid?

Thanks,
Josh
--
___
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

___
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


Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Marcelo Bezerra
for(int i=1;i=maxplayers;i++) {
   edict_t *pEntity =  engine-PEntityOfEntIndex(i);
   if(!pEntity || pEntity-IsFree()) {
continue;
   }
   int uid = engine-GetPlayerUserId(pEntity);
}
Josh wrote:
OK all I have is the playerid (userid).  How do I get a pointer to the
entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
different number.
For example, I join a game then I call the iplayerinfo on myself and find
out that my userid is 2.  But IndexOfEdict is 1.  They are different.
Josh
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid
You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);
Loop from
Josh wrote:

This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity that
is fired.

Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I determine
the IndexOfEdict or get the pointer to the entity of a userid?

Thanks,
Josh
--
___
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

___
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


Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Roy Laurie
I'm putting together a Type Conversions list for such. Everyone's welcome to 
add / edit.
http://hl2-dev.com/wiki/index.php?pagename=SdkTypeConversions

-- Roy Kylratix Laurie

On 20 Dec 2004 at 18:20, Ronny Schedel wrote:

 The UserID can be accessed through the IPlayerInfo
 and the IPlayerInfoManager interfaces.

 Greets
 Ronny

  This is a multi-part message in MIME format.
  --
  [ Picked text/plain from multipart/alternative ]
  I was just wondering how I can get an entity or an index of the entity
  that
  is fired.
 
 
 
  Meaning the player_hurt event is fired and I get a userid of 2.  Will this
  is different than the IndexOfEdict function in engine.  How can I
  determine
  the IndexOfEdict or get the pointer to the entity of a userid?
 
 
 
  Thanks,
 
  Josh
 
  --
 
 
  ___
  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





___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



RE: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Josh
Yea that's what I was thinking :(  I was really hoping to not do that, as a
LOT of functions will need to call that function. (I'm working on a war3 mod
for CSS, just building the groundwork).  So every time someone is shot /
died that will be called twice.  Doesn't that seem intensive? Do you think
valve could create an easier way?

Josh

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid


for(int i=1;i=maxplayers;i++) {
edict_t *pEntity =  engine-PEntityOfEntIndex(i);
if(!pEntity || pEntity-IsFree()) {
 continue;
}
int uid = engine-GetPlayerUserId(pEntity);
}

Josh wrote:

OK all I have is the playerid (userid).  How do I get a pointer to the
entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
different number.

For example, I join a game then I call the iplayerinfo on myself and find
out that my userid is 2.  But IndexOfEdict is 1.  They are different.

Josh


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid

You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);

Loop from
Josh wrote:



This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity
that
is fired.



Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I
determine
the IndexOfEdict or get the pointer to the entity of a userid?



Thanks,

Josh

--


___
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



___
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



___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread tei
Josh wrote:
Yea that's what I was thinking :(  I was really hoping to not do that, as a
LOT of functions will need to call that function. (I'm working on a war3 mod
for CSS, just building the groundwork).  So every time someone is shot /
died that will be called twice.  Doesn't that seem intensive? Do you think
valve could create an easier way?
You need the updated  value eveyframe?
often its better to build linked list with interesting values than
querying everything everywhere.
- a linked list of players
- a linked list of waypoints, etc.
- a linked list of buildings, etc..
Having to search everything to search the nearest Orc building its a bad
idea. While a loop with p = p-next its fastest than light


-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid
for(int i=1;i=maxplayers;i++) {
edict_t *pEntity =  engine-PEntityOfEntIndex(i);
if(!pEntity || pEntity-IsFree()) {
 continue;
}
int uid = engine-GetPlayerUserId(pEntity);
}
___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders


Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Marcelo Bezerra
You can code the loop so it looks up both pEntities on a single pass.
(You will be special casing this one to speed things up).
Copy and paste from my plugin:
---
   for(i=1;i=maxplayers  (!pVictim || !pAttacker;i++)) {
   edict_t *pEntity = engine-PEntityOfEntIndex(i);
   if(!pEntity || pEntity-IsFree()) {
   continue;
   }
   int this_uid = engine-GetPlayerUserId(pEntity);
   if(this_uid=0) {
   if(uid == this_uid) {
   pVictim = pEntity;
   }
   if(attacker == this_uid) {
   pAttacker = pEntity;
   }
   }
   }
---
I am generating an attacked logline to be used on my tk prevention system :)
(It runs remotely, parsing log from multiple servers)
Josh wrote:
Yea that's what I was thinking :(  I was really hoping to not do that, as a
LOT of functions will need to call that function. (I'm working on a war3 mod
for CSS, just building the groundwork).  So every time someone is shot /
died that will be called twice.  Doesn't that seem intensive? Do you think
valve could create an easier way?
Josh
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 2:46 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid
for(int i=1;i=maxplayers;i++) {
   edict_t *pEntity =  engine-PEntityOfEntIndex(i);
   if(!pEntity || pEntity-IsFree()) {
continue;
   }
   int uid = engine-GetPlayerUserId(pEntity);
}
Josh wrote:

OK all I have is the playerid (userid).  How do I get a pointer to the
entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
different number.
For example, I join a game then I call the iplayerinfo on myself and find
out that my userid is 2.  But IndexOfEdict is 1.  They are different.
Josh
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
Sent: Monday, December 20, 2004 12:36 PM
To: [EMAIL PROTECTED]
Subject: Re: [hlcoders] Finding the entity based on the userid
You can look from 1 to maxplayers, get the pEntity and use:
engine-GetPlayerUserId(pEntity);
Loop from
Josh wrote:


This is a multi-part message in MIME format.
--
[ Picked text/plain from multipart/alternative ]
I was just wondering how I can get an entity or an index of the entity

that

is fired.

Meaning the player_hurt event is fired and I get a userid of 2.  Will this
is different than the IndexOfEdict function in engine.  How can I

determine

the IndexOfEdict or get the pointer to the entity of a userid?

Thanks,
Josh
--
___
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

___
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

___
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


Re: [hlcoders] Finding the entity based on the userid

2004-12-20 Thread Roy Laurie
In the end, I think it comes down to a simple profiling decision.
The question being: Which method is more economical?

If you're handling an event that happens often...like player_death, my guess is 
the extra 64
bits (depending on the compiler) per player might be worth the amount of 
function calls if
you're doing it often. It'll certainly prevent sudden choppiness; replacing it 
with negligible(?)
sluggishness.

Of course, I base this on absolutely nothing as I haven't profiled the 
difference.

-- Roy Kylratix Laurie

On 20 Dec 2004 at 18:51, Marcelo Bezerra wrote:

 You can code the loop so it looks up both pEntities on a single pass.
 (You will be special casing this one to speed things up).

 Copy and paste from my plugin:
 ---
 for(i=1;i=maxplayers  (!pVictim || !pAttacker;i++)) {
 edict_t *pEntity = engine-PEntityOfEntIndex(i);
 if(!pEntity || pEntity-IsFree()) {
 continue;
 }
 int this_uid = engine-GetPlayerUserId(pEntity);
 if(this_uid=0) {
 if(uid == this_uid) {
 pVictim = pEntity;
 }
 if(attacker == this_uid) {
 pAttacker = pEntity;
 }
 }
 }
 ---
 I am generating an attacked logline to be used on my tk prevention system :)
 (It runs remotely, parsing log from multiple servers)

 Josh wrote:

 Yea that's what I was thinking :(  I was really hoping to not do that, as a
 LOT of functions will need to call that function. (I'm working on a war3 mod
 for CSS, just building the groundwork).  So every time someone is shot /
 died that will be called twice.  Doesn't that seem intensive? Do you think
 valve could create an easier way?
 
 Josh
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
 Sent: Monday, December 20, 2004 2:46 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [hlcoders] Finding the entity based on the userid
 
 
 for(int i=1;i=maxplayers;i++) {
 edict_t *pEntity =  engine-PEntityOfEntIndex(i);
 if(!pEntity || pEntity-IsFree()) {
  continue;
 }
 int uid = engine-GetPlayerUserId(pEntity);
 }
 
 Josh wrote:
 
 
 
 OK all I have is the playerid (userid).  How do I get a pointer to the
 entity having this userid?  And I CANNOT use IndexOfEdict b/c that is a
 different number.
 
 For example, I join a game then I call the iplayerinfo on myself and find
 out that my userid is 2.  But IndexOfEdict is 1.  They are different.
 
 Josh
 
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Marcelo Bezerra
 Sent: Monday, December 20, 2004 12:36 PM
 To: [EMAIL PROTECTED]
 Subject: Re: [hlcoders] Finding the entity based on the userid
 
 You can look from 1 to maxplayers, get the pEntity and use:
 engine-GetPlayerUserId(pEntity);
 
 Loop from
 Josh wrote:
 
 
 
 
 
 This is a multi-part message in MIME format.
 --
 [ Picked text/plain from multipart/alternative ]
 I was just wondering how I can get an entity or an index of the entity
 
 
 that
 
 
 is fired.
 
 
 
 Meaning the player_hurt event is fired and I get a userid of 2.  Will this
 is different than the IndexOfEdict function in engine.  How can I
 
 
 determine
 
 
 the IndexOfEdict or get the pointer to the entity of a userid?
 
 
 
 Thanks,
 
 Josh
 
 --
 
 
 ___
 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
 
 
 
 ___
 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
 
 
 
 ___
 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





___
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders