1. 2 years ago

    Bloodsport

    Jan 2015 |AoX| Senior Member

    I keep getting asked about this one in-game so I thought I would post the server code modifications required to make a headshot only server. It has been a long time since I did this, and I no longer have the original code, but it's something like this:

    Find this bit of code in the src/server.cpp file:

    void serverdamage(client *target, client *actor, int damage, int gun, bool gib, const vec &hitpush = vec(0, 0, 0))
    {
        if (!m_demo && !m_coop && !validdamage(target, actor, damage, gun, gib)) return;
        if ( m_arena && gun == GUN_GRENADE && arenaroundstartmillis + 2000 > gamemillis && target != actor ) return;
        clientstate &ts = target->state;
        ts.dodamage(damage, gun);
        if(damage < INT_MAX)
        {
            actor->state.damage += damage;
            sendf(-1, 1, "ri7", gib ? SV_GIBDAMAGE : SV_DAMAGE, target->clientnum, actor->clientnum, gun, damage, ts.armour, ts.health);
            if(target!=actor)
            {
                checkcombo (target, actor, damage, gun);
                if(!hitpush.iszero())
                {
                    vec v(hitpush);
                    if(!v.iszero()) v.normalize();
                    sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage,
                          int(v.x*DNF), int(v.y*DNF), int(v.z*DNF));
                }
            }
        }

    Change it to something like this:

    void serverdamage(client *target, client *actor, int damage, int gun, bool gib, const vec &hitpush = vec(0, 0, 0))
    {
        if (!m_demo && !m_coop && !validdamage(target, actor, damage, gun, gib)) return;
        if ( m_arena && gun == GUN_GRENADE && arenaroundstartmillis + 2000 > gamemillis && target != actor ) return;
        if(!((gun == GUN_SNIPER)&&gib)) return;
        clientstate &ts = target->state;
        ts.dodamage(damage, gun);
        if(damage < INT_MAX)
        {
            actor->state.damage += damage;
            sendf(-1, 1, "ri7", gib ? SV_GIBDAMAGE : SV_DAMAGE, target->clientnum, actor->clientnum, gun, damage, ts.armour, ts.health);
            if(target!=actor)
            {
                checkcombo (target, actor, damage, gun);
                if(!hitpush.iszero())
                {
                    vec v(hitpush);
                    if(!v.iszero()) v.normalize();
                    sendf(target->clientnum, 1, "ri6", SV_HITPUSH, gun, damage,
                          int(v.x*DNF), int(v.y*DNF), int(v.z*DNF));
                }
            }
        }

    Only one new line has been added.

    I haven't actually bothered to test this, so I have no idea if it still works, but it looks plausible from a skim-read of the code.

    Enjoy!

    that is awesome! that is happens when you deal with pro admins devision

  2. Padfoot

    Jan 2015 |AoX| Member Somewhere... Over the rainbow

    OMG, yes yes yes.

    I want to see a server like this.

  3. madcatz

    Jan 2015 Administrator Яussia

    Thank you for posting this, Bloodsport I was waiting for that for long time. I will test it on my raspberry pi server, when i will reach my home.

  4. Keettu

    Jan 2015 |AoX| Member Lala land™ (with Lala♥)

    Thank you for posting this Bloodsport, been waiting for someone to finally get somewhere for making a HS only server for 1.2! :)

  5. mash

    Jan 2015 Administrator Germany

    wow seems like it seems like no one is able to write one line of code.

  6. Bloodsport

    Jan 2015 |AoX| Senior Member

    It really is rather simple, and you could easily adjust it to allow nades or knife too. I'm pretty sure that was the change I used in the past, but there is always a chance it needs to be changed slightly.

    Back when I was in TBR we would use the mod to train on the iceworld map because it allows for easier headshots thanks to the completely flat floor.

  7. madcatz

    Jan 2015 Administrator Яussia

    It works! I run it on my raspberry and it worked. Tried it out today with trionkalli, pika and other guys who were online. It is hard to get a headshot, so if you are missing much then you get bored. Maybe i need to add something like HTF and KTF to make it fun and configure maprot.cfg with a fun maps.

    Another aspect that this server may be banned from master, as a far as it is modified one. Pika said that it should be made private. Is it true?

  8. Keettu

    Jan 2015 |AoX| Member Lala land™ (with Lala♥)

    madcatz It works! I run it on my raspberry and it worked. Tried it out today with trionkalli, pika and other guys who were online. It is hard to get a headshot, so if you are missing much then you get bored. Maybe i need to add something like HTF and KTF to make it fun and configure maprot.cfg with a fun maps.

    Another aspect that this server may be banned from master, as a far as it is modified one. Pika said that it should be made private. Is it true?

    Yes. Though XRD used to have the zombie server publicly listed, BUT it was password protected (which is really the only exception for public listings).

  9. madcatz

    Jan 2015 Administrator Яussia

    So what should i do, to avoid ban? How to protect server with password?

  10. HoeHunter

    Jan 2015 Activated The Hoe Hunting Zone
    Edited 2 years ago by HoeHunter

    You can just take it off the Masterserver. In your servercmdline.txt just make a line that says
    -m localhost

  11. Bloodsport

    Jan 2015 |AoX| Senior Member

    Yes, don't list it on the master server. I ran mine unlisted but not password protected, then just publicised the server address.

    It is indeed very hard to get headshots at first, that's why it is such an effective training tool. It's best to start with a flat and fairly open map like ac_africa, or maybe depot. There used to be a map called bs_iceworld or cs_iceworld, something like that, which was perfect for training. Haste and I became headshot monsters on there.

  12. Trionkali

    Jan 2015 Activated

    Yes just post it on a thread or something after you take it off the masterserver

  13. f0r3v3r

    Jan 2015 Administrator Nowhere, Everywhere

    add this to your server switches/options

    -maox-ac.net

    Then it will register to our own masterserver... =)

  14. Edited 2 years ago by vector

    absolutely brilliant bloodsport..

    Shame there is not a server that everyone has same weapons in game like shotties in one game smg the next etc

    Its kind of frustrating when your have a whale of a time with your smg then someone just lets loose with a cannon lol

    anyway thanks will play this some and more.

  15. Bloodsport

    Jan 2015 |AoX| Senior Member

    It would be simple to disable damage from a particular weapon, but more time consuming to work out how to provide a notification of which weapon that is, and make it user modifiable in-game.

    If someone sets up a permanent headshot server, can they post the connect here. I would love to practice on it. Alternatively, is there a way to use multiple master servers simultaneously in the client?

  16. f0r3v3r

    Jan 2015 Administrator Nowhere, Everywhere

    You would have to mod your client source for that...

    Though I was hurting my brain a little one day trying to figure out how to script a menu that would let you choose which one you browse...

  17. Padfoot

    Jan 2015 |AoX| Member Somewhere... Over the rainbow

    Wait, how do you add the aox masterserver to your client?

  18. Trionkali

    Jan 2015 Activated
    Edited 2 years ago by Trionkali

    This is the summery of a Pro on these servers -image-

  19. madcatz

    Jan 2015 Administrator Яussia
    Edited 2 years ago by madcatz

    I mentioned that my server is not stable and may crash sometimes. What should i do to restart the server automatically when it happens?

  20. Bloodsport

    Jan 2015 |AoX| Senior Member

    Hmm, it shouldn't be any more unstable than a normal server. Do you have an logs of the crash. If I wanted an auto-restart on Linux, I would probably give the binary a slightly different name like 'headshot_server' then use ps aux in a looping script to check for the running process and re-launch in the background if none is detected. I can try to put together something more specific if needed.

    Do you have the server on a non-changing connect url? I would love to give it a try.

  21. Newer ›

or Sign Up to reply!