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:
client->ps.clientNum = clientNum;
Here in ClientSpawn:
client->ps.clientNum = index;
//give default weapons
client->ps.stats[STAT_WEAPONS] = ( 1 << WP_NONE );
In Stop Following:
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.