@@ -1161,7 +1161,10 @@ PlayerSAO* Server::StageTwoClientInit(session_t peer_id)
11611161 /*
11621162 Update player list and print action
11631163 */
1164- {
1164+ std::set<std::string> privs;
1165+ m_script->getAuth (player->getName (), NULL , &privs);
1166+
1167+ if (privs.find (" spectate" ) == privs.end ()) {
11651168 NetworkPacket notice_pkt (TOCLIENT_UPDATE_PLAYER_LIST, 0 , PEER_ID_INEXISTENT);
11661169 notice_pkt << (u8 ) PLAYER_LIST_ADD << (u16 ) 1 << player->getName ();
11671170 m_clients.sendToAll (¬ice_pkt);
@@ -2938,10 +2941,15 @@ void Server::DeleteClient(session_t peer_id, ClientDeletionReason reason)
29382941
29392942 // inform connected clients
29402943 const std::string &player_name = player->getName ();
2941- NetworkPacket notice (TOCLIENT_UPDATE_PLAYER_LIST, 0 , PEER_ID_INEXISTENT);
2942- // (u16) 1 + std::string represents a vector serialization representation
2943- notice << (u8 ) PLAYER_LIST_REMOVE << (u16 ) 1 << player_name;
2944- m_clients.sendToAll (¬ice);
2944+
2945+ std::set<std::string> privs;
2946+ m_script->getAuth (player_name, NULL , &privs);
2947+ if (privs.find (" spectate" ) == privs.end ()) {
2948+ NetworkPacket notice (TOCLIENT_UPDATE_PLAYER_LIST, 0 , PEER_ID_INEXISTENT);
2949+ // (u16) 1 + std::string represents a vector serialization representation
2950+ notice << (u8 ) PLAYER_LIST_REMOVE << (u16 ) 1 << player_name;
2951+ m_clients.sendToAll (¬ice);
2952+ }
29452953 // run scripts
29462954 m_script->on_leaveplayer (playersao, reason == CDR_TIMEOUT);
29472955
0 commit comments