View Single Post
Old 08-03-2006, 11:59 PM   #91
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
Also, somewhat of a bug: There should only be 3 places where ps.clientNum should be used on the game module, anything else can potentially cause troubles with specators. For example, your code for auto balance in ojp will sometimes spam to the spectator "You were switched" message. Or even use the spectator's name in messages, or in the duel/pduel check code it could potentially pick a spectator when it didn't mean to.

You should only have these lines:

Near Top of ClientUserInfoChanged:

Code:
client->ps.clientNum = clientNum;
Here in ClientSpawn:

Code:
	client->ps.clientNum = index;
	//give default weapons
	client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE );
and...

In Stop Following:

Code:
ent->client->ps.clientNum = ent - g_entities;
Use gentity_t->s.number or gentity_t - g_entities.

(gentity_t being the entity you want the number from)

anything ps->clientNum (meaning something from pmove usually) and client-side is required that it be used but the server no.


iojamp project lead / coder
ensiform is offline   you may: quote & reply,