Ugly command invis_me ^_^ seems very funny

This commit is contained in:
btd 2010-09-14 20:56:28 +04:00
parent 3cd72cfb87
commit c4fa5c6128
5 changed files with 18 additions and 1 deletions

View file

@ -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<CNetObj_Character *>(Server()->SnapNewItem(NETOBJTYPE_CHARACTER, m_pPlayer->GetCID(), sizeof(CNetObj_Character)));
// write down the m_Core

View file

@ -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<IServer>();
m_pConsole = Kernel()->RequestInterface<IConsole>();
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);

View file

@ -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);

View file

@ -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()

View file

@ -81,6 +81,7 @@ public:
int m_Last_ShowOthers;
bool m_ShowOthers;
bool m_Invisible;
//DDRace
int m_Muted;