Esempio n. 1
0
void CGameControllerSoloFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			
			if (!pVic || (/*pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && */pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
			
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = /*SameTeam ? -1 : */ i;
			}
		}

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			if (pHam)
			{
				//bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = /*SameTeam ? -1 : */ HammeredBy;
				if (/* !SameTeam &&*/ CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0)
				{
					pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}
Esempio n. 2
0
void CGameControllerOpenFNG::DoHookers()
{
	for(int i = 0; i < MAX_CLIENTS; i++)
	{
		CCharacter *pChr = CHAR(i);
		if (!pChr)
			continue;
		
		int Hooking = pChr->GetHookedPlayer();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (!pVic || (pVic->GetPlayer()->GetTeam() != pChr->GetPlayer()->GetTeam() && pChr->GetHookTick() < CFG(HookRegisterDelay)))
				Hooking = -1;
		}

		int HammeredBy = pChr->LastHammeredBy();
		pChr->ClearLastHammeredBy();

		if (Hooking >= 0)
		{
			CCharacter *pVic = CHAR(Hooking);
			if (pVic)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = SameTeam ? -1 : i;
			}
		}
		
		/*
		CPlayer *pPlayer = TPLAYER(Hooking);
			if (pVic)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pVic->GetPlayer()->GetTeam();
				m_aLastInteraction[Hooking] = SameTeam ? -1 : i;
				if(pPlayer)
				{
				    if (!SameTeam && CFG(HammerFreeze) && pVic->GetFreezeTicks() <= 0)
				    {
					    pVic->Freeze(CFG(HammerFreeze) * TS, i);
					    m_aFrozenBy[Hooking] = i; //suppress kill event being generated
				    }
				}
			}
		*/

		if (HammeredBy >= 0)
		{	
			CCharacter *pHam = CHAR(HammeredBy);
			CPlayer *pPlayer = TPLAYER(HammeredBy);
			if (pHam)
			{
				bool SameTeam = pChr->GetPlayer()->GetTeam() == pHam->GetPlayer()->GetTeam();
				m_aLastInteraction[i] = SameTeam ? -1 : HammeredBy;
				if(pPlayer)
				{
				    if (!SameTeam && CFG(HammerFreeze) && pChr->GetFreezeTicks() <= 0 && pPlayer->m_HammerFreeze)
				    {
					    pChr->Freeze(CFG(HammerFreeze) * TS, HammeredBy);
					    m_aFrozenBy[i] = HammeredBy; //suppress kill event being generated
				    }
				}
			}
			else
				m_aLastInteraction[i] = -1;
		}
	}
}