Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24

Thread: COD2 MP: adding killing spree messages

  1. #11
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Your problem is not that you do not know how to program, but that you are chasing two rabbit (I don't know if you know such a saying ) Why did you move the simplest code into a separate function and file? Please do as written in my post. If it works, then do whatever you want. By lumping everything together, you are expanding the places where there can be inconsistencies and errors.

    P.S: my code in CodeCallBack_PlayerKilled(...) { }
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  2. #12
    Private
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    13
    Thanks
    4
    Thanked 1 Time in 1 Post
    Thanks for your reply. I get the chasing rabbit analogy :-) I tried your suggestion in CodeCallBack_PlayerKilled, but then it results in a script compile error: uninitialised variable 'attacker'
    I tried some different options (changing 'attacker' in 'eAttacker' ) but so far I haven't been able to get the kill spree messages..

  3. #13
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    Quote Originally Posted by michelboonstra74 View Post
    Thanks for your reply. I get the chasing rabbit analogy :-) I tried your suggestion in CodeCallBack_PlayerKilled, but then it results in a script compile error: uninitialised variable 'attacker'
    I tried some different options (changing 'attacker' in 'eAttacker' ) but so far I haven't been able to get the kill spree messages..
    post full code of function "codeCallBack_PlayerKilled(...)" with first { and last }.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  4. #14
    Private
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    13
    Thanks
    4
    Thanked 1 Time in 1 Post
    PHP Code:
    CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)

    {
        
    self endon("disconnect");
        [[
    level.callbackPlayerKilled]](eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration);



        if( 
    isplayer(attacker) && isAlive(attacker))
        {
            if (!
    isDefined(attacker.killspree))
            
    attacker.killspree 0;
        
            if ( (
    attacker != self) && (getcvar("g_gametype") != "dm") && (attacker.team != self.team) )
                
    attacker.killspree++;
            else
            if ( (
    attacker != self) && (getcvar("g_gametype") == "dm")  )
                
    attacker.killspree++;

            if(
    attacker != self && isDefined(attacker.team) && isDefined(self.team) && attacker.team != self.team )
            {
                
    iprintlnbold("attacker: " attacker.name " has killing spree: " attacker.killspree " when killing: " self.name);
            
                switch (
    attacker.killspree)
                {
                    case 
    1:
                        
    iprintln(attacker.name " has 1 killing spree");
                        
    //just message();
                        
    break;
                    case 
    2:
                        
    iprintln(attacker.name " has 2 killing spree");
                        
    //LearnSomeSimpleDeveloperLessons();
                        
    break;
                    case 
    3:
                        
    iprintln(attacker.name " has 3 killing spree");
                        
    //Kick();
                        
    break;
                    case 
    4:
                        
    iprintln(attacker.name " has 4 killing spree");
                        
    //GiveSex();
                        
    break;
                    case 
    5:
                        
    iprintln(attacker.name " has 5 killing spree");
                        
    //GiveNades();
                        
    break;
                    
                    default:
                    break;
                }
            }
        }





  5. #15
    Private
    Join Date
    Jun 2013
    Posts
    70
    Thanks
    20
    Thanked 32 Times in 26 Posts
    attacker = eAttacker;

    PHP Code:
    CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)

    {
        
    self endon("disconnect");
        [[
    level.callbackPlayerKilled]](eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration);

    attacker eAttacker;

        if( 
    isplayer(attacker) && isAlive(attacker))
        {
            if (!
    isDefined(attacker.killspree))
            
    attacker.killspree 0;
        
            if ( (
    attacker != self) && (getcvar("g_gametype") != "dm") && (attacker.team != self.team) )
                
    attacker.killspree++;
            else
            if ( (
    attacker != self) && (getcvar("g_gametype") == "dm")  )
                
    attacker.killspree++;

            if(
    attacker != self && isDefined(attacker.team) && isDefined(self.team) && attacker.team != self.team )
            {
                
    iprintlnbold("attacker: " attacker.name " has killing spree: " attacker.killspree " when killing: " self.name);
            
                switch (
    attacker.killspree)
                {
                    cas