Function to Change a Person's Team
Posted: November 20th, 2011, 6:19 pm
				
				Hey everyone. I was making a mod and I couldn't figure out a function to change a person's team. I'm wondering if there is one at all. Could anyone help?
			CoDJumper.com - For all your CoDJumping needs!
https://codjumper.com/forums/
Code: Select all
self thread maps\mp\gametypes\_teams::changeTeam( "axis" );Code: Select all
killed(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
{
        if(isdefined(eAttacker)&&isplayer(eAttacker)&&eAttacker!=self)
        {
                if(eAttacker == special_person)
                self iprintlnbold("You were killed by "+special_person.name);
        }
        [[level.oldcallbackplayerkilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
}       Code: Select all
 
SwapTeam()
{
        self endon("disconnect");
        self endon("spawned_player");
        self waittill("death");
        killed(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
        {
                if(isdefined(eAttacker)&&isplayer(eAttacker)&&eAttacker!=self)
                {
                        if(eAttacker == special_person) && (eAttacker.team == ("allies"))
                        {
                                self iprintlnbold("You were killed by "+special_person.name);
                                self thread maps\mp\gametypes\_teams::changeTeam("axis");
                        }
                        elseif(eAttacker == special_person) && (eAttacker.team == ("axis"))
                        {
                                self iprintlnbold("You were killed by "+special_person.name);
                                self thread maps\mp\gametypes\_teams::changeTeam("allies");             
                        }
                }
                [[level.oldcallbackplayerkilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
        }
}
 Code: Select all
if(eAttacker == special_person) && (eAttacker.team == ("allies"))Code: Select all
if(eAttacker == special_person && eAttacker.team == "allies")Code: Select all
killed(eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration)
{
        if(isdefined(eAttacker) && isplayer(eAttacker) && eAttacker!=self && eAttacker==special_person && isDefined(self.team))
        {
                if(self.team == "axis")
                {
                        self thread maps\mp\gametypes\_teams::changeTeam("allies");
                }
                else
                {
                        self thread maps\mp\gametypes\_teams::changeTeam("axis");
                }
        }
        [[level.oldcallbackplayerkilled]](eInflictor, eAttacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, timeOffset, deathAnimDuration);
}