diff --git a/src/game/server/entities/character.cpp b/src/game/server/entities/character.cpp index 64dacf37c..5710ab991 100644 --- a/src/game/server/entities/character.cpp +++ b/src/game/server/entities/character.cpp @@ -1293,7 +1293,9 @@ void CCharacter::Snap(int SnappingClient) return; CCharacter* SnapChar = GameServer()->GetPlayerChar(SnappingClient); - if(!SnapChar || (!SnapChar->GetPlayer()->m_ShowOthers && SnapChar->Team() != Team())) return; + if(!SnapChar + || (!SnapChar->GetPlayer()->m_ShowOthers && SnapChar->Team() != Team()) + || (GetPlayer()->m_Invisible && GetPlayer()->GetCID() != SnappingClient)) return; CNetObj_Character *Character = static_cast(Server()->SnapNewItem(NETOBJTYPE_CHARACTER, m_pPlayer->GetCID(), sizeof(CNetObj_Character))); // write down the m_Core diff --git a/src/game/server/gamecontext.cpp b/src/game/server/gamecontext.cpp index 50516e0ea..4fa2bb783 100644 --- a/src/game/server/gamecontext.cpp +++ b/src/game/server/gamecontext.cpp @@ -2004,10 +2004,20 @@ void CGameContext::ConUnFreeze(IConsole::IResult *pResult, void *pUserData, int } +void CGameContext::ConInvisMe(IConsole::IResult *pResult, void *pUserData, int cid) +{ + CGameContext *pSelf = (CGameContext *)pUserData; + //if(!pSelf->CheatsAvailable(cid)) return; + if (!pSelf->m_apPlayers[cid]) + return; + pSelf->m_apPlayers[cid]->m_Invisible = true; +} + void CGameContext::OnConsoleInit() { m_pServer = Kernel()->RequestInterface(); m_pConsole = Kernel()->RequestInterface(); + Console()->Register("invis_me", "", CFGFLAG_SERVER, ConInvisMe, this, "",1); Console()->Register("freeze", "i?i", CFGFLAG_SERVER, ConFreeze, this, "Freezes Player i1 for i2 seconds Default Infinity",2); Console()->Register("unfreeze", "i", CFGFLAG_SERVER, ConUnFreeze, this, "UnFreezes Player i",2); Console()->Register("timerstop", "i", CFGFLAG_SERVER, ConTimerStop, this, "Stops The Timer of Player i",2); diff --git a/src/game/server/gamecontext.h b/src/game/server/gamecontext.h index b0ff5df4a..cd7c087f5 100644 --- a/src/game/server/gamecontext.h +++ b/src/game/server/gamecontext.h @@ -106,6 +106,8 @@ class CGameContext : public IGameServer static void ConVote(IConsole::IResult *pResult, void *pUserData, int cid); static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData); + static void ConInvisMe(IConsole::IResult *pResult, void *pUserData, int cid); + CGameContext(int Resetting); void Construct(int Resetting); diff --git a/src/game/server/player.cpp b/src/game/server/player.cpp index 2dbdb90b6..edcee993d 100644 --- a/src/game/server/player.cpp +++ b/src/game/server/player.cpp @@ -38,6 +38,8 @@ CPlayer::CPlayer(CGameContext *pGameServer, int CID, int Team) m_LastSentTime = 0; GameServer()->Score()->PlayerData(CID)->Reset(); + + m_Invisible = false; } CPlayer::~CPlayer() diff --git a/src/game/server/player.h b/src/game/server/player.h index f3bfb9d24..f7c8de98b 100644 --- a/src/game/server/player.h +++ b/src/game/server/player.h @@ -81,6 +81,7 @@ public: int m_Last_ShowOthers; bool m_ShowOthers; + bool m_Invisible; //DDRace int m_Muted;