示例#1
0
bool JumpTester::PlayerRunCommandCallback(NczPlayer* player, CUserCmd* pCmd)
{
	bool drop_cmd = false;

	JumpInfoT* playerData = GetPlayerDataStruct(player);

	if((playerData->jumpCmdHolder.lastJumpCmdState == false) && (pCmd->buttons & IN_JUMP))
	{
		playerData->jumpCmdHolder.JumpDown_Tick = CIFaceManager::GetInstance()->GetGlobals()->tickcount;
		if(playerData->isOnGround)
		{
			int diff = abs(playerData->jumpCmdHolder.JumpDown_Tick - playerData->onGroundHolder.onGround_Tick);
			if(diff < 10)
			{
				++playerData->total_bhopCount;
#				ifdef DEBUG
					Msg("Player %s : total_bhopCount = %d\n", player->GetName(), playerData->total_bhopCount);
#				endif
				if(diff < 3 && diff > 0)
				{
					++playerData->goodBhopsCount;
#					ifdef DEBUG
						Msg("Player %s : goodBhopsCount = %d\n", player->GetName(), playerData->goodBhopsCount);
#					endif
					drop_cmd = true;
				}
				if(diff == 0)
				{
					++playerData->perfectBhopsCount;
#					ifdef DEBUG
						Msg("Player %s : perfectBhopsCount = %d\n", player->GetName(), playerData->perfectBhopsCount);
#					endif
					drop_cmd = true;
				}
			}

			if(HasVerbose()) Msg("Player %s : %f %d : Now using jump button (delta %d)\n", player->GetName(), Plat_FloatTime(), CIFaceManager::GetInstance()->GetGlobals()->tickcount, diff);
		}
		else
		{
			++playerData->jumpCmdHolder.outsideJumpCmdCount;
			if(HasVerbose()) Msg("Player %s : %f %d : Now using jump button (outside count %d)\n", player->GetName(), Plat_FloatTime(), CIFaceManager::GetInstance()->GetGlobals()->tickcount, playerData->jumpCmdHolder.outsideJumpCmdCount);
		}
		playerData->jumpCmdHolder.lastJumpCmdState = true;
	}
	else if((playerData->jumpCmdHolder.lastJumpCmdState == true) && ((pCmd->buttons & IN_JUMP) == 0))
	{
		playerData->jumpCmdHolder.lastJumpCmdState = false;
		playerData->jumpCmdHolder.JumpUp_Tick = CIFaceManager::GetInstance()->GetGlobals()->tickcount;
		if(HasVerbose()) Msg("Player %s : %f %d : Now not using jump button\n", player->GetName(), Plat_FloatTime(), CIFaceManager::GetInstance()->GetGlobals()->tickcount);
	}
#	ifdef DEBUG
		if(drop_cmd) Msg("Player %s : UserCmd will be dropped\n", player->GetName());
#	endif
	return drop_cmd;
}
示例#2
0
void RadarHackBlocker::RT_UpdatePlayerData ( NczPlayer* pPlayer )
{
	ClientRadarData * pData ( GetPlayerDataStruct ( pPlayer ) );

	SourceSdk::IPlayerInfo * const playerinfo ( pPlayer->GetPlayerInfo () );
	if( playerinfo == nullptr ) return;

	pData->m_origin_index = pPlayer->GetIndex ();
	pData->m_team = playerinfo->GetTeamIndex ();
}
示例#3
0
void JumpTester::m_hGroundEntityStateChangedCallback(NczPlayer* player, bool new_isOnGround)
{
	JumpInfoT* playerData = GetPlayerDataStruct(player);

	if(new_isOnGround)
	{
		playerData->onGroundHolder.onGround_Tick = CIFaceManager::GetInstance()->GetGlobals()->tickcount;
		playerData->isOnGround = true;
		if(HasVerbose()) Msg("Player %s : Now on ground at %f %d\n", player->GetName(), Plat_FloatTime(), CIFaceManager::GetInstance()->GetGlobals()->tickcount);
		if(playerData->jumpCmdHolder.outsideJumpCmdCount > 10) // Il serait plus judicieux d'utiliser le RMS
		{
			Detection_BunnyHopScript pDetection = Detection_BunnyHopScript();
			pDetection.PrepareDetectionData(playerData);
			pDetection.PrepareDetectionLog(player, this);
			pDetection.Log();
			player->Kick("You have to turn off your BunnyHop Script to play on this server.");
		}
		else if(playerData->jumpCmdHolder.outsideJumpCmdCount == 0 && playerData->perfectBhopsCount > 5)
		{
			Detection_BunnyHopProgram pDetection = Detection_BunnyHopProgram();
			pDetection.PrepareDetectionData(playerData);
			pDetection.PrepareDetectionLog(player, this);
			pDetection.Log();

			player->Ban("[NoCheatZ 4] You have been banned for using BunnyHop on this server.");
		}
		playerData->jumpCmdHolder.outsideJumpCmdCount = 0;
	}
	else
	{
		playerData->onGroundHolder.notOnGround_Tick = CIFaceManager::GetInstance()->GetGlobals()->tickcount;
		++playerData->onGroundHolder.jumpCount;
		playerData->isOnGround = false;
		if(HasVerbose()) Msg("Player %s : Now not on ground at %f %d\n", player->GetName(), Plat_FloatTime(), CIFaceManager::GetInstance()->GetGlobals()->tickcount);
	}
}