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

Thread: COD2 MP: adding killing spree messages

  1. #11
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    455
    Thanks
    79
    Thanked 121 Times in 100 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
    12
    Thanks
    3
    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
    455
    Thanks
    79
    Thanked 121 Times in 100 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
    12
    Thanks
    3
    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
    69
    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)
                {
                    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;
                }
            }
        }





  6. #16
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    455
    Thanks
    79
    Thanked 121 Times in 100 Posts
    try
    PHP Code:
    CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)
    {
        
    self endon("disconnect");
        
        [[
    level.callbackPlayerKilled]](eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration); // what this?

        
    if(isPlayer(eAttacker) && isAlive(eAttacker) && isDefined(eAttacker.team) && isDefined(self.team) && eAttacker != self)
        {
            if (!
    isDefined(eAttacker.killspree))
                
    eAttacker.killspree 0;
        
            
    eAttacker.killspree += (eAttacker.team != self.team || getcvar("g_gametype") == "dm");

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

    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

  7. The Following User Says Thank You to maxdamage99 For This Useful Post:

    michelboonstra74 (Yesterday)

  8. #17
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,676
    Thanks
    17
    Thanked 1,013 Times in 637 Posts
    You're going to need a bit of code inside the spawnplayer() too, to reset the killstreak counter upon respawn. (thats the lazy way, the better way would be to put it in playerkilled, spawnspectator and spawnintermission but i digress).

    Furthermore, judging by the script you've showed, you're running it as a plugin, and only after the playerkilled callback has finished. This callback takes 2 seconds to finish, so your killstreak messages will be delayed. Probably not what you want.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  9. The Following User Says Thank You to IzNoGoD For This Useful Post:

    michelboonstra74 (Yesterday)

  10. #18
    Private
    Join Date
    Jun 2013
    Posts
    69
    Thanks
    20
    Thanked 32 Times in 26 Posts
    you can use my scrip
    it supports last shoot kill,revenge kill and time based multikill (this way dont need resets )

    save the following code in a file call it kspree.gsc put it in your maps/mp folder

    and add this line in your Callback_PlayerKilled function in dm.gsc/ tdm.gsc (under level.mapended is a good place ):

    maps\mp\gametypes\kspree::missions(self, Attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);

    PHP Code:
    missions(eInflictorattackeriDamagesMeansOfDeathsWeaponvDirsHitLoc)
    {
    self endon("disconnected");
    if(
    issubstr(sWeapon,"dummy")) return;
    delay 2500;
    // sound = undefined;
    text undefined;
    attacker.onspree false;



    if(!
    isdefined(attacker.spreezeit) || !isdefined(attacker.spreezeit_alt) ||!isdefined(attacker.KillsiRow))
    {
    attacker.spreezeit 0;
    attacker.spreezeit_alt 0;
    attacker.KillsiRow 0;
    }

        if(
    isPlayer(attacker))
        {
            if(
    attacker != eInflictor)
            {
            
    eInflictor.lastkiller attacker;

                
                if(
    isAlive(attacker))
                {


                
    //LastShot
                
    if(sWeapon == attacker getweaponslotweapon("primary") && attacker getweaponslotclipammo("primary") == ||sWeapon == attacker getweaponslotweapon("primaryb") && attacker getweaponslotclipammo("primaryb") == )
                {
                if(
    sMeansOfDeath != "MOD_PROJECTILE_SPLASH" && sMeansOfDeath != "MOD_MELEE" && sMeansOfDeath != "MOD_GRENADE_SPLASH")
                {
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold("LASTSHOOT");
                }
                }
                
                
    //Revenge
                
    if(isdefined(attacker.lastkiller))
                if(
    attacker.lastkiller != eInflictor)
                
    attacker.lastkiller undefined;
                else
                {
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold("REVENGE");
                
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold("REVENGE");
                
    attacker.lastkiller undefined;

                }
                
                
                
    //SpreeStop
                
    if( isdefined(eInflictor.onspree) && eInflictor.onspree && isdefined(eInflictor.spreezeit_alt))
                {
                
    eInflictor.spreezeit getTime();
                if(
    eInflictor.spreezeit_alt delay >= eInflictor.spreezeit)
                
    iprintln("^2"+attacker.name +"^3 stops "+"^2"+eInflictor.name +"^3 on Killingspree ");
                }
                
                
                
    //KillSpree
                
    attacker.KillsiRow++;
                
    attacker.spreezeit getTime();

                    switch(
    attacker.KillsiRow)
                    {
                    case 
    1:
                    
    attacker.spreezeit_alt attacker.spreezeit;
                    break;
                    case 
    2:
                    
    // sound = "doublekill";
                    
    text "DOUBLEKILL";
                    break;
                    case 
    3:
                    
    // sound = "multikill";
                    
    text "MULTIKILL";
                    break;
                    case 
    4:
                    
    // sound = "ultrakill";
                    
    text "ULTRAKILL";    
                    break;
                    case 
    5:
                    
    // sound = "monsterkill";
                    
    text "MONSTERKILL";
                    break;
                    case 
    6:
                    
    // sound = "godlike";
                    
    text "GODLIKE";
                    break;
                    
                    case 
    7:
                    
    attacker.spreezeit 0;
                    
    attacker.spreezeit_alt 0;
                    
    attacker.KillsiRow 0;                
                    break;

                    }
                    
                        if( 
    attacker.spreezeit_alt delay attacker.spreezeit && attacker.KillsiRow 1)
                        {
                        
    attacker.onspree true;
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold text );
                        
    iprintln attacker.name text );
                        
    // attacker playLocalSound( sound );
                        
    attacker.spreezeit gettime();
                        
    attacker.spreezeit_alt attacker.spreezeit;
                        
                        }
                        else if(
    attacker.spreezeit_alt delay attacker.spreezeit)
                        {
                        
    attacker.KillsiRow 1;
                        
    attacker.spreezeit_alt gettime();

                        }
                }
            }    
        }

    i only use it in dm so if something weird going on in tdm let me know

  11. The Following User Says Thank You to vanfreddy For This Useful Post:

    michelboonstra74 (Yesterday)

  12. #19
    Private
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    12
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by maxdamage99 View Post
    try
    PHP Code:
    CodeCallback_PlayerKilled(eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration)
    {
        
    self endon("disconnect");
        
        [[
    level.callbackPlayerKilled]](eInflictoreAttackeriDamagesMeansOfDeathsWeaponvDirsHitLoctimeOffsetdeathAnimDuration); // what this?

        
    if(isPlayer(eAttacker) && isAlive(eAttacker) && isDefined(eAttacker.team) && isDefined(self.team) && eAttacker != self)
        {
            if (!
    isDefined(eAttacker.killspree))
                
    eAttacker.killspree 0;
        
            
    eAttacker.killspree += (eAttacker.team != self.team || getcvar("g_gametype") == "dm");

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

    Thank your for your reply. However, I still don't get kill spree messages.. it seems to ignore the script, I also don't get any error messages about it..

  13. #20
    Private
    Join Date
    Mar 2021
    Location
    Netherlands
    Posts
    12
    Thanks
    3
    Thanked 1 Time in 1 Post
    Quote Originally Posted by vanfreddy View Post
    you can use my scrip
    it supports last shoot kill,revenge kill and time based multikill (this way dont need resets )

    save the following code in a file call it kspree.gsc put it in your maps/mp folder

    and add this line in your Callback_PlayerKilled function in dm.gsc/ tdm.gsc (under level.mapended is a good place ):

    maps\mp\gametypes\kspree::missions(self, Attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc);

    PHP Code:
    missions(eInflictorattackeriDamagesMeansOfDeathsWeaponvDirsHitLoc)
    {
    self endon("disconnected");
    if(
    issubstr(sWeapon,"dummy")) return;
    delay 2500;
    // sound = undefined;
    text undefined;
    attacker.onspree false;



    if(!
    isdefined(attacker.spreezeit) || !isdefined(attacker.spreezeit_alt) ||!isdefined(attacker.KillsiRow))
    {
    attacker.spreezeit 0;
    attacker.spreezeit_alt 0;
    attacker.KillsiRow 0;
    }

        if(
    isPlayer(attacker))
        {
            if(
    attacker != eInflictor)
            {
            
    eInflictor.lastkiller attacker;

                
                if(
    isAlive(attacker))
                {


                
    //LastShot
                
    if(sWeapon == attacker getweaponslotweapon("primary") && attacker getweaponslotclipammo("primary") == ||sWeapon == attacker getweaponslotweapon("primaryb") && attacker getweaponslotclipammo("primaryb") == )
                {
                if(
    sMeansOfDeath != "MOD_PROJECTILE_SPLASH" && sMeansOfDeath != "MOD_MELEE" && sMeansOfDeath != "MOD_GRENADE_SPLASH")
                {
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold("LASTSHOOT");
                }
                }
                
                
    //Revenge
                
    if(isdefined(attacker.lastkiller))
                if(
    attacker.lastkiller != eInflictor)
                
    attacker.lastkiller undefined;
                else
                {
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold(" ");
                
    attacker iprintlnbold("REVENGE");
                
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold(" ");
                
    eInflictor iprintlnbold("REVENGE");
                
    attacker.lastkiller undefined;

                }
                
                
                
    //SpreeStop
                
    if( isdefined(eInflictor.onspree) && eInflictor.onspree && isdefined(eInflictor.spreezeit_alt))
                {
                
    eInflictor.spreezeit getTime();
                if(
    eInflictor.spreezeit_alt delay >= eInflictor.spreezeit)
                
    iprintln("^2"+attacker.name +"^3 stops "+"^2"+eInflictor.name +"^3 on Killingspree ");
                }
                
                
                
    //KillSpree
                
    attacker.KillsiRow++;
                
    attacker.spreezeit getTime();

                    switch(
    attacker.KillsiRow)
                    {
                    case 
    1:
                    
    attacker.spreezeit_alt attacker.spreezeit;
                    break;
                    case 
    2:
                    
    // sound = "doublekill";
                    
    text "DOUBLEKILL";
                    break;
                    case 
    3:
                    
    // sound = "multikill";
                    
    text "MULTIKILL";
                    break;
                    case 
    4:
                    
    // sound = "ultrakill";
                    
    text "ULTRAKILL";    
                    break;
                    case 
    5:
                    
    // sound = "monsterkill";
                    
    text "MONSTERKILL";
                    break;
                    case 
    6:
                    
    // sound = "godlike";
                    
    text "GODLIKE";
                    break;
                    
                    case 
    7:
                    
    attacker.spreezeit 0;
                    
    attacker.spreezeit_alt 0;
                    
    attacker.KillsiRow 0;                
                    break;

                    }
                    
                        if( 
    attacker.spreezeit_alt delay attacker.spreezeit && attacker.KillsiRow 1)
                        {
                        
    attacker.onspree true;
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold(" ");
                        
    attacker iprintlnbold text );
                        
    iprintln attacker.name text );
                        
    // attacker playLocalSound( sound );
                        
    attacker.spreezeit gettime();
                        
    attacker.spreezeit_alt attacker.spreezeit;
                        
                        }
                        else if(
    attacker.spreezeit_alt delay attacker.spreezeit)
                        {
                        
    attacker.KillsiRow 1;
                        
    attacker.spreezeit_alt gettime();

                        }
                }
            }    
        }

    i only use it in dm so if something weird going on in tdm let me know
    Thanks! I'll give it a try and let you know if it works with my config.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •