Automated C4 stuff
1st: a keybind:
2nd: some globals:
3rd: a helper function
4th: something for your engine loop, u need to have this inside the player iteration:
4th: more stuff you initiate when ur dead:
when u have deployed your c4 you press your key (whateva). when enemy now comes close to your explosive your player will switch to detanotor and explode the c4 automaticly. switches back to your main weapon after that and checks also that you are not within explosive blast radius. Current code saves up to 17 different locations on the map. Missing stuff is quite easy and can be added by yourself, like the visibility check.
enemy dead = profit.
Code:
if (GetAsyncKeyState(whateva)&1)
{
if(!bImAVehicle)
bDeployC4 = true;
}
{
if(!bImAVehicle)
bDeployC4 = true;
}
2nd: some globals:
Code:
int C4Count=0; bool btmp,bAutoC4=false,bDeployC4 ;
3rd: a helper function
code:
BOOL CAres::TurnOff()
{
if(( timeGetTime() < (iStartCount + 2000))) return FALSE;
pBorderInputNode->m_inputCache->flInputBuffer[ConceptSwitchToPrimaryWeapon] = 1.0f;
bAutoC4=false;
btmp=false;
iC4Count = 0;
return TRUE;
}
{
if(( timeGetTime() < (iStartCount + 2000))) return FALSE;
pBorderInputNode->m_inputCache->flInputBuffer[ConceptSwitchToPrimaryWeapon] = 1.0f;
bAutoC4=false;
btmp=false;
iC4Count = 0;
return TRUE;
}
4th: something for your engine loop, u need to have this inside the player iteration:
Code:
if(bDeployC4)
{
if(iC4Count <=17)
iC4Count += 1.0f;
pMySoldier->GetVector(&vStaticVecC4[iC4Count]);
bAutoC4 = true;
btmp=false;
bDeployC4 = false;
}
if (bAutoC4 && !GotTarget)
{
if (bIsEnemy )
pVector.vTargetEnemy = pVector.vTarget;
for (int itmp =1; itmp<=iC4Count; itmp++ )
{
if((vStaticVecC4[itmp].DistanceToVector(pVector.vTargetEnemy ) <= 6.f )
&& (vAres.vMe.DistanceToVector(vStaticVecC4[itmp]) >= 5.f)
&& IsVisibleForC4(&vStaticVecC4[itmp],&pVector.vTargetEnemy))
{
if(bSwitchable)
{
pBorderInputNode->m_inputCache->flInputBuffer[ConceptSwitchToDynamicGadget2] = 1.0f;
iStartCount = timeGetTime();
btmp=true;
}
AutoFireLogic();
{
if(iC4Count <=17)
iC4Count += 1.0f;
pMySoldier->GetVector(&vStaticVecC4[iC4Count]);
bAutoC4 = true;
btmp=false;
bDeployC4 = false;
}
if (bAutoC4 && !GotTarget)
{
if (bIsEnemy )
pVector.vTargetEnemy = pVector.vTarget;
for (int itmp =1; itmp<=iC4Count; itmp++ )
{
if((vStaticVecC4[itmp].DistanceToVector(pVector.vTargetEnemy ) <= 6.f )
&& (vAres.vMe.DistanceToVector(vStaticVecC4[itmp]) >= 5.f)
&& IsVisibleForC4(&vStaticVecC4[itmp],&pVector.vTargetEnemy))
{
if(bSwitchable)
{
pBorderInputNode->m_inputCache->flInputBuffer[ConceptSwitchToDynamicGadget2] = 1.0f;
iStartCount = timeGetTime();
btmp=true;
}
AutoFireLogic();
4th: more stuff you initiate when ur dead:
Code:
if(!MyPlayer || !MyPlayer->getSoldierEnt())
{
bDead = 1;
iC4Count=0;
bDeployC4 = 0;
bAutoC4 = 0;
bIsCloseAttack= 0;
}
{
bDead = 1;
iC4Count=0;
bDeployC4 = 0;
bAutoC4 = 0;
bIsCloseAttack= 0;
}
when u have deployed your c4 you press your key (whateva). when enemy now comes close to your explosive your player will switch to detanotor and explode the c4 automaticly. switches back to your main weapon after that and checks also that you are not within explosive blast radius. Current code saves up to 17 different locations on the map. Missing stuff is quite easy and can be added by yourself, like the visibility check.
enemy dead = profit.


''