Index: branches/network/src/lib/network/message_manager.h
===================================================================
--- branches/network/src/lib/network/message_manager.h	(revision 8230)
+++ branches/network/src/lib/network/message_manager.h	(revision 8236)
@@ -31,5 +31,5 @@
   MSGID_DELETESYNCHRONIZEABLE,
   MSGID_PREFEREDTEAM,
-  MSGID_CHANGEPLAYERNAME
+  MSGID_CHANGENICKNAME
 };
 
Index: branches/network/src/lib/network/player_stats.cc
===================================================================
--- branches/network/src/lib/network/player_stats.cc	(revision 8230)
+++ branches/network/src/lib/network/player_stats.cc	(revision 8236)
@@ -23,6 +23,9 @@
 #include "shared_network_data.h"
 
+#include "shell_command.h"
+
 
 CREATE_FACTORY(PlayerStats, CL_PLAYER_STATS);
+SHELL_COMMAND(nick, PlayerStats, shellNick);
 
 /**
@@ -62,4 +65,7 @@
   playableUniqueId_handle = registerVarId( new SynchronizeableInt( &playableUniqueId, &playableUniqueId, "playableUniqueId" ) );
   modelFileName_handle = registerVarId( new SynchronizeableString( &modelFileName, &modelFileName, "modelFileName" ) );
+  nickName_handler = registerVarId( new SynchronizeableString( &nickName, &nickName, "nickName" ) );
+  
+  MessageManager::getInstance()->registerMessageHandler( MSGID_CHANGENICKNAME, changeNickHandler, NULL );
   
   PRINTF(0)("PlayerStats created\n");
@@ -87,4 +93,9 @@
     
     PRINTF(0)("uniqueID changed %d %d %d\n", userId, getHostID(), getUniqueID());
+  }
+  
+  if ( std::find( id.begin(), id.end(), nickName_handler ) != id.end() )
+  {
+    PRINTF(0)("user %d is now known as %s\n", userId, nickName);
   }
 }
@@ -166,3 +177,46 @@
 }
 
-
+/**
+ * client sends server a message to change nick and server changes nick directly
+ * @param nick new nickname
+ */
+void PlayerStats::setNickName( std::string nick )
+{
+  if ( isServer() )
+  {
+    this->nickName = nick;
+    return;
+  }
+  else
+  {
+    byte * data = new byte[nick.length()+INTSIZE];
+    
+    assert( Converter::stringToByteArray( nick, data, nick.length()+INTSIZE) == nick.length()+INTSIZE );
+    
+    MessageManager::getInstance()->sendMessage( MSGID_CHANGENICKNAME, data, nick.length()+INTSIZE, RT_SERVER, 0, MP_HIGHBANDWIDTH );
+    return;
+  }
+}
+
+bool PlayerStats::changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId )
+{
+  std::string newNick;
+  int res = Converter::byteArrayToString( data, newNick, dataLength );
+  
+  if ( res != dataLength )
+  {
+    PRINTF(2)("invalid message size from user %d\n", userId);
+    newNick = "invalid";
+  }
+  
+  if ( PlayerStats::getStats( userId ) )
+    PlayerStats::getStats( userId )->setNickName( newNick );
+}
+
+void PlayerStats::shellNick( const std::string& newNick )
+{
+  //if ( getStats( SharedNetworkData::getInstance()->getHostID() ) )
+  //  getStats( SharedNetworkData::getInstance()->getHostID() )->setNickName( newNick );
+}
+
+
Index: branches/network/src/lib/network/player_stats.h
===================================================================
--- branches/network/src/lib/network/player_stats.h	(revision 8230)
+++ branches/network/src/lib/network/player_stats.h	(revision 8236)
@@ -9,4 +9,5 @@
 #include "synchronizeable.h"
 #include "playable.h"
+#include "message_manager.h"
 
 #include <string>
@@ -54,4 +55,9 @@
     
     Playable * getPlayable();
+    
+    inline std::string getNickName(){ return this->nickName; }
+    void setNickName( std::string nick );
+    static bool changeNickHandler( MessageId messageId, byte * data, int dataLength, void * someData, int userId );
+    void shellNick( const std::string&  newNick );
 
   private:
@@ -59,4 +65,6 @@
     int teamId;                //!< teamId
     int preferedTeamId;        //!< preferedTeamId
+
+    std::string nickName;      //!< players nickname
 
     int score;                 //!< users score points
@@ -75,4 +83,5 @@
     int playableUniqueId_handle;
     int modelFileName_handle;
+    int nickName_handler;
     
     void init();
