src/network/network_server.cpp
changeset 9649 40194ddf2193
parent 9647 5986dcf7c956
child 9652 0405e98d8e96
equal deleted inserted replaced
9648:c79160082c0f 9649:40194ddf2193
   899 
   899 
   900 	/** Only CMD_PLAYER_CTRL is always allowed, for the rest, playas needs
   900 	/** Only CMD_PLAYER_CTRL is always allowed, for the rest, playas needs
   901 	 * to match the player in the packet. If it doesn't, the client has done
   901 	 * to match the player in the packet. If it doesn't, the client has done
   902 	 * something pretty naughty (or a bug), and will be kicked
   902 	 * something pretty naughty (or a bug), and will be kicked
   903 	 */
   903 	 */
   904 	if (!(cp->cmd == CMD_PLAYER_CTRL && cp->p1 == 0) && ci->client_playas != cp->player) {
   904 	if (!(cp->cmd == CMD_PLAYER_CTRL && cp->p1 == 0 && ci->client_playas == PLAYER_NEW_COMPANY) && ci->client_playas != cp->player) {
   905 		IConsolePrintF(CC_ERROR, "WARNING: player %d (IP: %s) tried to execute a command as player %d, kicking...",
   905 		IConsolePrintF(CC_ERROR, "WARNING: player %d (IP: %s) tried to execute a command as player %d, kicking...",
   906 		               ci->client_playas + 1, GetPlayerIP(ci), cp->player + 1);
   906 		               ci->client_playas + 1, GetPlayerIP(ci), cp->player + 1);
   907 		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_PLAYER_MISMATCH);
   907 		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_PLAYER_MISMATCH);
   908 		free(cp);
   908 		free(cp);
   909 		return;
   909 		return;