diff --git a/config/docs.cfg b/config/docs.cfg index 08619fc9..c73478dd 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -514,6 +514,8 @@ docident [onDeathOther] [If this alias exists it will be run every time anybody docident [onDeathSelf] [If this alias exists it will be run every time you yourself die.]; docident [onSpawnOther] [If this alias exists it will be run every time anybody but yourself spawns.]; docident [onSpawnSelf] [If this alias exists it will be run every time you yourself spawn.]; +docident [onKill] [If this alias exists it will be run every time you kill an enemy.]; +docident [onTK] [If this alias exists it will be run every time you kill a teammate.]; docident [mdldyncache] []; docargument [V] [] [min 1/max 32/default 2]; docident [mdlstatcache] []; diff --git a/docs/reference.xml b/docs/reference.xml index 3f27b055..26cf71f5 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -1432,6 +1432,20 @@ addOnLoadAlways [ + + + If this alias exists it will be run every time you kill an enemy. + + + + + + + If this alias exists it will be run every time you kill a teammate. + + + + This will append the passed 2nd argument to any existing content of the alias named in the 1st argument. Several popular aliases have predefined shortcuts using this scriptalias: addOnQuit, addOnLoadOnce, addOnLoadAlways. Check config/scripts.cfg for possible omissions in that list. diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 03fe3ac7..ec8f5478 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -770,12 +770,20 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun) else if(isteam(pl->team, act->team)) { if(pl==player1) outf("\f2you were %s by teammate %s", death, aname); - else outf("%s%s %s teammate %s", act==player1 ? "\f3" : "\f2", aname, death, pname); + else + { + outf("%s%s %s teammate %s", act==player1 ? "\f3" : "\f2", aname, death, pname); + if(identexists("onTK")) execute("onTK"); + } } else { if(pl==player1) outf("\f2you were %s by %s", death, aname); - else outf("\f2%s %s %s", aname, death, pname); + else + { + outf("\f2%s %s %s", aname, death, pname); + if(identexists("onKill")) execute("onKill"); + } } if(gib)