• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Release] Clan member friendly fire

Joined
Apr 16, 2007
Messages
441
Reaction score
204
So basically this code will make it so that if you accidentally shoot a clan member they take no damage.

Everything here is server-sided open WarZ_Server.sln

ServerGameLogic.cpp (Search for)
Code:
if((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox) && !force_damage)
        return false;

Add under it:
Code:
// if you are the one inflicting damage to yourself ex: Grenade
if(targetPlr->ID == IsServerPlayer(fromObj)->ID)
    {
         //since you are inflicting dmg to yourself take the damage
         return true; 
    }else{ 

     //We should do a ClanID empty value check before hand
//If the enemy is not in a clan just inflict damage
//The reason why we do this is if players who are not in a clan their ClanID returns the same //so it turns the game into a PVE.
if(!*targetPlr->loadout_->ClanID)
    return true;

//If targetPlr's ClanID is not empty continue
     //After the checks, we check for both the atker/victim's ClanID
    if(targetPlr->loadout_->ClanID == IsServerPlayer(fromObj)->loadout_->ClanID)
        //If player's ClanID = the same take no damage
        return false;
    }
 
Last edited:
Newbie Spellweaver
Joined
Mar 10, 2014
Messages
23
Reaction score
1
if((fromPlr->loadout_->GroupID == targetPlr->loadout_->GroupID && targetPlr->loadout_->GroupID != 0))
{
return false;
}


Change to

if((fromPlr->loadout_->GroupID == targetPlr->loadout_->GroupID && targetPlr->loadout_->GroupID != 0) || (fromPlr->loadout_->ClanID == targetPlr->loadout_->ClanID && targetPlr->loadout_->ClanID != 0))
{
return false;
}


:)
 
Custom Title Activated
Loyal Member
Joined
May 18, 2006
Messages
1,425
Reaction score
119
code by dnc

Code:
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);
	obj_ServerPlayer * fromPlr = ((obj_ServerPlayer*)fromObj);
	// can't damage god or dead players
	if(targetPlr->profile_.ProfileData.isGod || targetPlr->loadout_->Alive == 0)
		return false;

	// can't damage players in safe zones or spawn protected (postbox now act like that)
	else if(((targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_NearPostBox)
		|| (targetPlr->loadout_->GameFlags & wiCharDataFull::GAMEFLAG_isSpawnProtected))
		&& !force_damage)
		return false;

	// can't damage same groups
	else if(fromPlr->loadout_->GroupID == targetPlr->loadout_->GroupID && targetPlr->loadout_->GroupID != 0)
		return false;

	[COLOR="#FF0000"]// can't damage same clan // Clan member friendly fire
	else if(fromPlr->loadout_->ClanID == targetPlr->loadout_->ClanID && targetPlr->loadout_->ClanID != 0)
		return false;[/COLOR]


	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;
}



but ... may be not work
 
Custom Title Activated
Loyal Member
Joined
May 18, 2006
Messages
1,425
Reaction score
119
colorado >> work
custommap >> not work
 
Back
Top