diff --git a/config/compatibility.cfg b/config/compatibility.cfg new file mode 100644 index 00000000..40eab538 --- /dev/null +++ b/config/compatibility.cfg @@ -0,0 +1 @@ +// Makes old cubescripts compatible with newer versions of the game diff --git a/config/docs.cfg b/config/docs.cfg index 791551b5..9d8f543c 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -587,12 +587,9 @@ docident [onChangeVote] [If this alias exists it will be run every time a vote i docident [onVoteEnd] [If this alias exists it will be run every time a vote passes or fails.]; docident [votepending] [Determines if there is a vote pending or not.]; docexample [echo $votepending] [Output: if there is currently a vote pending, returns 1, else returns 0.]; -docident [onDeathOther] [If this alias exists it will be run every time anybody but yourself dies.]; -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 [onSpawn] [If this alias exists it will be run every time someone spawns.]; +docident [onKill] [If this alias exists it will be run every time a player is killed.]; +docident [onFlag] [If this alias exists it will be run every time a flag action occurs.]; docident [mdldyncache] []; docargument [V] [] [min 1/max 32/default 2]; docident [mdlstatcache] []; diff --git a/docs/reference.xml b/docs/reference.xml index 83699c9f..80710521 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -1787,39 +1787,6 @@ addOnLoadAlways [ - - If this alias exists it will be run every time anybody but yourself dies. - - - - - - - - If this alias exists it will be run every time you yourself die. - - - - - - - - If this alias exists it will be run every time anybody but yourself spawns. - - - - - - - - If this alias exists it will be run every time you yourself spawn. - - - - - - - If this alias exists it will be run every time a vote is called. @@ -1855,20 +1822,26 @@ 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. - - - + If it exists, this alias will be executing when any player get killed, receiving a few arguments : + + + + + + - + + + + + + + If defined, this will be executed each time a flag action occurs. + + + + 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. @@ -1904,21 +1877,12 @@ echo foo - - - This will be executed each time the player dies. - - - This will be executed each time another player dies. - - - - This will be executed each time the player spawns. - - - - This will be executed each time another player spawns. + + + + + If defined, this will be executed each time a player spawns. diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 038a5ee1..e79dbc9b 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -712,7 +712,7 @@ void findplayerstart(playerent *d, bool mapcenter, int arenaspawn) d->o.z = 4; } entinmap(d); - if(identexists("onSpawn")) + if(identexists("onSpawn")/* && (m_teammode && d->team == player1->team)*/) { defformatstring(onspawn)("onSpawn %d", d->clientnum); execute(onspawn); @@ -902,8 +902,8 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun) { if(pl->state!=CS_ALIVE || intermission) return; - defformatstring(killevent)("onKillEvent %d %d %d %d", act->clientnum, pl->clientnum, gun, gib ? 1 : 0); - if(identexists("onKillEvent")) execute(killevent); + defformatstring(killevent)("onKill %d %d %d %d", act->clientnum, pl->clientnum, gun, gib ? 1 : 0); + if(identexists("onKill")) execute(killevent); string pname, aname, death; copystring(pname, pl==player1 ? "you" : colorname(pl)); @@ -1256,9 +1256,9 @@ void flagmsg(int flag, int message, int actor, int flagtime) const char *teamstr = m_ktf ? "the" : own ? "your" : "the enemy"; const char *flagteam = m_ktf ? (teammate ? "your teammate " : "your enemy ") : ""; - if(identexists("onFlagEvent")) + if(identexists("onFlag")) { - defformatstring(onflagevent)("onFlagEvent %d %d %d", message, actor); + defformatstring(onflagevent)("onFlag %d %d %d", message, actor, flag); execute(onflagevent); } diff --git a/source/src/clients2c.cpp b/source/src/clients2c.cpp index e3b8c786..91e2e7d6 100644 --- a/source/src/clients2c.cpp +++ b/source/src/clients2c.cpp @@ -571,6 +571,11 @@ void parsemessages(int cn, playerent *d, ucharbuf &p) else // new client { conoutf(_("connected: %s"), colorname(d, text)); + if(identexists("onNewPlayer")) + { + defformatstring(onnewplayer)("onNewPlayer %d", d->clientnum); + execute(onnewplayer); + } } copystring(d->name, text, MAXNAMELEN+1); loopi(2) d->setskin(i, getint(p));