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!
Answered by madcatz
See post in contextthat is awesome! that is happens when you deal with pro admins devision