[Tutorial] Clan member friendly fire OFF

Junior Spellweaver
Joined
Jan 19, 2014
Messages
137
Reaction score
128
Location
Parnamirim (Rio
Sorry my English!
I was andano by ragezone and the codes to disable friendly fire was all in error, I decided to do a basic tutorial of how to solve.

Search in WarZ_Server.sln


Search for:

if
((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox) && !force_damage)
return false;


Add below:
Code:
// A menos que voce não cause dano a si mesmo os demais em clan não são atingidos, com excessão das granadas
if(targetPlr->ID == IsServerPlayer(fromObj)->ID) // TheLiciaZ
{
return true; //The damage friend is disabled.
}else{

/*if(!*targetPlr->loadout_-> ClanID != 0
return true; */ // TheLiciaZ apenas para src codex e amosin deixar não comentado


if(targetPlr->loadout_->ClanID == IsServerPlayer(fromObj)->loadout_->ClanID)
return false;
}



You will have this here:

if((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox) && !force_damage)
return false;

// A menos que voce não cause dano a si mesmo os demais em clan não são atingidos, com excessão das granadas
if(targetPlr->ID == IsServerPlayer(fromObj)->ID) // TheLiciaZ
{
return true; //The damage friend is disabled.
}else{

/*if(!*targetPlr->loadout_-> ClanID != 0
return true; */ // TheLiciaZ apenas para src codex e amosin deixar não comentado


if(targetPlr->loadout_->ClanID == IsServerPlayer(fromObj)->loadout_->ClanID)
return false;
}
 
If that does not work try this! Code 100% working in WarZTHv2


bool ServerGameLogic::ApplyDamageToPlayer(GameObject* fromObj, obj_ServerPlayer* targetPlr, const r3dPoint3D& dmgPos, float damage, int bodyBone, int bodyPart, bool force_damage, STORE_CATEGORIES damageSource, int airState )
{


r3d_assert(fromObj);
r3d_assert(targetPlr);



// Não receber dano quando estiver com o GM ativado
if(targetPlr->loadout_->Alive == 0 || targetPlr->profile_.ProfileData.isGod)
return false;


// Removido o dano
else if(IsServerPlayer(fromObj)) // Removido o dano dos players em grupo
{
obj_ServerPlayer * fromPlr = ((obj_ServerPlayer*)fromObj);
if(fromPlr->loadout_->GroupID == targetPlr->loadout_->GroupID && targetPlr->loadout_->GroupID != 0)
return false;

// Removido o dano dos player em clã
if (fromPlr->loadout_->ClanID == targetPlr->loadout_->ClanID && targetPlr->loadout_->ClanID != 0)
return false;


}

// Spawn Protection 100%
if(((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox) || (targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_isSpawnProtected)) && !force_damage)
return false;






if(targetPlr->loadout_->Alive == 0)
return false;


// Sem dano nas safes, ou quando o player estiver com spawn
if(((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox)||
(targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_isSpawnProtected)) && !force_damage)
return false;



damage = targetPlr->ApplyDamage(damage, fromObj, bodyPart, damageSource);


// send damage packet, originating from the firing dude
PKT_S2C_Damage_s a;
a.dmgPos = dmgPos;
a.targetId = toP2pNetId(targetPlr->GetNetworkID());
a.damage = R3D_MIN((BYTE)damage, (BYTE)255);
a.dmgType = damageSource;
a.bodyBone = bodyBone;
p2pBroadcastToActive(fromObj, &a, sizeof(a));


// check if we killed player
if(targetPlr->loadout_->Health <= 0)
{
bool fromPlayerInAir = ((airState & 0x1) != 0);
bool targetPlayerInAir = ((airState & 0x2) != 0);


DoKillPlayer(fromObj, targetPlr, damageSource, false, fromPlayerInAir, targetPlayerInAir);
}


return true;
}
 
Code 100% working in V3SRC

http://forum.ragezone.com/f791/tutorial-clan-friendly-fire-1112313/
 
Back