lfnetwork.com mark read register faq members calendar

Thread: gentity_t vs centity_t
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-17-2008, 09:29 AM   #1
JaedenRuiner
Rookie
 
Join Date: Apr 2004
Posts: 19
gentity_t vs centity_t

Okay,
Well, i've gotten pretty far on everything I've wanted to do, but now I am at a point of evaluation entities on the client side as opposed to the server side. The client side does not use gentity_t structure, it has the centity_t structure. However I'm not quite familiar with the appropriate tests to verify an entity is a client. for gentity_t's on the server side you'd simply do:
Code:
if (!ent || !ent->client) {
  return;
}
if (ent->s.number > MAX_CLIENTS) {
  return;
}
Either of those will tell the code that the current entity isn't a client, you know a real player. On the centity_t side, I have entity that has stored it's owner number. so I'm doing this:
Code:
if (ent->s.userInt2 && ent->s.userInt2 <= MAX_CLIENTS) {
  centity_t * own = &cg_entities[ent->s.userInt2];
  if (!own || !own->client) <----- ERROR.  No Client field.
At that point I examined the centity_t structure, and wondered if centity_t :: playerState would be NULL if the entity is NOT a client. Can i test there for player presence to make sure my owner of the entity in question is actually a player/bot/npc, etc?
Thanks


Jaeden "Sifo Dyas" al'Raec Ruiner
http://www.wayoftheleaf.net
JaedenRuiner is offline   you may: quote & reply,
Old 07-17-2008, 05:33 PM   #2
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
centity_t::currentState::eType will tell you ET_PLAYER vs ET_NPC. but you won't really be able to differentiate vs player/bot unless you come up with some method to communicate it via the scoreboard send method. You should know that centity_t out of your snapshot will be invalid unlike gentity_t which have no knowledge of snapshots. cgs.clientinfo[MAX_CLIENTS] is an array of clients with valid info so, you'd check a pointer to one of those array items and possibly the ::infoValid member as well.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-19-2008, 07:11 AM   #3
BobaFettUU
Lurker
 
Join Date: Feb 2006
Posts: 6
To tell clients from bots apart, here's how UU does it:

Fetch the configstring for the player (get CS_PLAYER + currentstate.number) and see if the infostring has a 'skill' entry. If it does, its a bot, if not, its a human.
BobaFettUU is offline   you may: quote & reply,
Old 07-19-2008, 12:01 PM   #4
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Wouldn't do anything if you (like me) had removed support for basejka bots which skill is not even a required key for the CS_PLAYERS info. So I guess ur UU would think all players are humans in my servers. :s


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > gentity_t vs centity_t

Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:31 AM.

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.