JaedenRuiner Posted July 17, 2008 Share Posted July 17, 2008 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: 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: 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 Link to comment Share on other sites More sharing options...
ensiform Posted July 17, 2008 Share Posted July 17, 2008 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. Link to comment Share on other sites More sharing options...
BobaFettUU Posted July 19, 2008 Share Posted July 19, 2008 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. Link to comment Share on other sites More sharing options...
ensiform Posted July 19, 2008 Share Posted July 19, 2008 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.