From 4847ff00ffceebf4865f7fcf874dff3dd2b1fce1 Mon Sep 17 00:00:00 2001 From: Bukz Date: Fri, 13 May 2011 11:55:57 +0000 Subject: [PATCH] onVoteEnd, curautoteam, addpunct, curplayers, delmenu, votepending, and a new test kick/ban menu :) git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@6422 e016b1c5-ed68-44aa-a2f7-31cac88cffde --- config/admin.cfg | 88 +++++++++++++++++++++++++++++++++++- config/docs.cfg | 16 ++++++- config/menus_multiplayer.cfg | 20 -------- config/scripts.cfg | 4 ++ config/survival.cfg | 2 +- docs/reference.xml | 88 ++++++++++++++++++++++++++++++++++-- source/src/clientgame.cpp | 13 ++++-- source/src/command.cpp | 28 ++++++++++++ source/src/entity.h | 4 +- source/src/menus.cpp | 10 ++++ 10 files changed, 240 insertions(+), 33 deletions(-) diff --git a/config/admin.cfg b/config/admin.cfg index f769da1a..12d24a3c 100644 --- a/config/admin.cfg +++ b/config/admin.cfg @@ -26,4 +26,90 @@ demo = [ ] [ mode -1; map $_demofile ] -] \ No newline at end of file +] + +// Kick/Ban/Reason menu script begins below. +tmpKBR = ""; tmpVic = ""; if (! (checkalias tmpKBP)) [ tmpKBP = "" ]; if (! (checkalias tmpKBMM)) [ tmpKBMM = 0 ] + +selKBItem = [ tmpVic = (getalias arg1); tmpKBR = ""; showmenu reason ] +genKBItem = [ + if (> $numargs 0) [ + tmpArg1 = $arg1; tmpKArg = (concat selKBItem $tmpArg1) + if (curmodeattr team) [ + menuitem (concatword (findpn $arg1) (c 2) " (" $arg1 ")" (c 5) " - " (c 4) (at (concat (concatword (c 3) CLA (c 4)) (concatword (c 1) RVSF (c 4))) (at (pstat_score $arg1) 4)) (c 5)) (addpunct $tmpKArg 2) + ] [ + menuitem (concatword (findpn $arg1) (c 2) " (" $arg1 ")" (c 5)) (addpunct $tmpKArg 2) + ] + ] +] +genKBMenu = [ loop gbl (curplayers) [ if (&& (! (strcmp (findpn $gbl) "")) (!= (findcn $curname) $gbl)) [ genKBItem $gbl ] ] ] +refreshKBM = [ if (!= $arg1 0) [ closemenu reason; sleep 0 [ showmenu reason ] ] [ closemenu kick/ban; sleep 0 [ showmenu kick/ban ] ] ] + +hasValidClients = [ + hvcOutput = 0 + loop hvl (curplayers) [ if (&& (! (strcmp (findpn $hvl) "")) (!= $hvl (findcn $curname))) [ hvcOutput = 1; break ] ] + result $hvcOutput +] +kickBanMenu = [ + newmenu kick/ban + menuinit [ delmenu kick/ban; kickBanMenu ] + menuitem "Refresh list" [ refreshKBM ] + menuitem "Remove all bans" [ removebans; refreshKBM ] + menuitemtextinput "Admin password: " "" [ tmpKBP = $arg1 ] 0 256 + menuitem "Toggle admin status" [ if $connected [ if (currole) [ setadmin; echo you dropped admin status ] [ if (&& (strlen $tmpKBP) (! (strcmp $tmpKBP ""))) [ setadmin 1 $tmpKBP ] ]; refreshKBM ] ] + menuitem "Toggle autoteam" [ if $connected [ if (curautoteam) [ autoteam 0 ] [ autoteam 1 ]; refreshKBM ] ] + menuitemtextinput "Mastermode: " (getalias tmpKBMM) [ if (< $arg1 3) [ tmpKBMM = $arg1 ] [ echo (c 3)Error: (c 5)Valid range for mastermode is 0-2.; tmpKBMM = 0 ] ] 0 1 + menuitem "Change mastermode" [ if (&& (< $tmpKBMM 3) (!= (curmastermode) $tmpKBMM)) [ if $connected [ mastermode $tmpKBMM ] ]; refreshKBM ] + menuitem "" -1 + menuitem "OK" [ closemenu kick/ban ] + menuitem "" -1 + if (hasValidClients) [ menuitem "Choose a client: " -1 ] [ menuitem "No valid clients available." -1 ] + menuitem "" -1 + genKBMenu +] +kickBanMenu + +newmenu reason +menuitemvar [ if (currole) [ concat (c 1)Note: (c 5)You currently have admin status. Your vote will be forced. ] ] +menuitemvar [ if (! (strcmp (findpn $tmpVic) "")) [ if (curmodeattr team) [ concat (c 9) Target client: " " (concatword (c 5) (findpn $tmpVic) " - cn: " (c 2) $tmpVic (c 5) " - team: " (at (concat (concatword (c 3) CLA) (concatword (c 1) RVSF)) (at (pstat_score $tmpVic) 4)) (c 5) " - tks: " (c 2) (at (pstat_score $tmpVic) 5)) ] [ concat (c 9) Target client: " " (concatword (c 5) (findpn $tmpVic) " - cn: " (c 2) $tmpVic (c 5)) ] ] ] [ showmenu stats ] +menuitemvar [ if (> (strlen $tmpKBR) 3) [ concat (c 9) Current reason: (concatword (c 5) $tmpKBR) ] ] +menuitemtextinput "Enter a reason: " "" [ tmpKStr = ""; loop gkl $numargs [ if (> $numargs 0) [ tmpKStr = (concatword $tmpKStr (getalias (format arg%1 $gkl)) " ") ] ]; if (< $numargs 2) [ tmpKBR = $arg1 ] [ tmpKBR = $tmpKStr ]; refreshKBM 1 ] 0 256 +menuitem "" -1 +menuitemvar [ concat (c 9) Use a predefined reason: ] +menuitem "" -1 +menuitem "Lag" [ tmpKBR = "lagging"; refreshKBM 1 ] +menuitem "Away from keyboard" [ tmpKBR = "AFK/not playing"; refreshKBM 1 ] +menuitem "Vote abuse" [ tmpKBR = "kick/ban/other vote abuse"; refreshKBM 1 ] +menuitem "Avoiding kicks/bans" [ tmpKBR = "avoiding kicks/bans"; refreshKBM 1 ] +menuitem "Private match" [ tmpKBR = (concat sorry, organizing a private (concatword match ", " (findpn $tmpVic))); refreshKBM 1 ] +menuitem "Obvious cheat" [ tmpKBR = "blatant cheating"; refreshKBM 1 ] +menuitem "Friendly fire/TK" [ if (curmodeattr team) [ tmpKBR = "intentional teamkills/team damage" ] [ echo (c 3)Error: (c 5) (getmodeacr) is not a team mode. ]; refreshKBM 1 ] +menuitem "Spamming" [ tmpKBR = "spamming chat/voicecoms/etc."; refreshKBM 1 ] +menuitem "Poor/abusive behavior" [ tmpKBR = "poor/abusive behavior"; refreshKBM 1 ] +menuitem "Inappropriate language" [ tmpKBR = "inappropriate language"; refreshKBM 1 ] +menuitem "Inappropriate name" [ tmpKBR = (concat inappropriate name (addpunct (findpn $tmpVic) 2)); refreshKBM 1 ] +menuitem "" -1 +menuitemvar [ concat (c 9) Action: ] +menuitem "" -1 +menuitemvar [ concat (c 2)Kick ] [ if (> (strlen $tmpKBR) 3) [ if $votepending [ if (currole) [ vote 2 ]; sleep 250 [ kick $tmpVic $tmpKBR ] ] ] [ kick $tmpVic $tmpKBR ] ] +menuitemvar [ concat (c 3)Ban ] [ if (> (strlen $tmpKBR) 3) [ if $votepending [ if (currole) [ vote 2 ]; sleep 250 [ ban $tmpVic $tmpKBR ] ] ] [ ban $tmpVic $tmpKBR ] ] +menuitemvar [ concat (c 9)Forceteam ] [ if (curmodeattr team) [ forceteam $tmpVic ] [ echo (c 3)Error: (c 5) (getmodeacr) is not a team mode. ] ] +menuitemvar [ concat (c 1)Whois ] [ whois $tmpVic ] +menuitem "Spectate" [ if (&& $connected (> (curplayers) 1)) [ if (alive) [ suicide ]; sleep 50 [ togglespect ]; sleep 100 [ setfollowplayer $tmpVic ] ] [ echo (c 3)Error: (c 5)Not connected or not enough players. ] ] +menuitemvar [ concat (c 0)Refresh] [ refreshKBM 1 ] +menuitem "" -1 +menuitem "Back" [ closemenu reason ] + +newmenu stats +menuitemvar [ concat (c 9)Current statistics for client: (c 5) (findpn $tmpVic) (c 2) (addpunct $tmpVic 2) ] +menuitemvar [ if (curmodeattr team) [ concat Team: (at (concat (concatword (c 3) CLA) (concatword (c 1) RVSF)) (at (pstat_score $tmpVic) 4)) ] [ concat Mode: (c 2) (getmodeacr) ] ] +menuitemvar [ if (curmodeattr team) [ concat Teamkills: (c 3) (at (pstat_score $tmpVic) 5) ] ] +menuitemvar [ if (curmodeattr flag) [ concat Flags: (at (pstat_score $tmpVic) 0) ] [ concat Flags: N/A ] ] +menuitemvar [ concat Frags: (at (pstat_score $tmpVic) 1) ] +menuitemvar [ concat Deaths: (at (pstat_score $tmpVic) 2) ] +menuitemvar [ if $connected [ concat Score: (at (pstat_score $tmpVic) 3) ] [ concat Score: N/A ] ] +menuitem "" -1 +menuitem "Refresh" [ closemenu stats; sleep 0 [ showmenu stats ] ] +menuitem "Back" [ closemenu stats ] + +addListOnQuit "hvcOutput tmpArg1 tmpKArg tmpKBP tmpVic votepending" \ No newline at end of file diff --git a/config/docs.cfg b/config/docs.cfg index 15e38c0c..82ba8567 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -215,6 +215,12 @@ docargument [L] [the list of aliases to check for] [] [0]; docargument [B] [the optional block of code to ensure the aliases contain] [] [0]; docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5"] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them.]; docexample [aliasinit "tmp1 tmp2 tmp3 tmp4 tmp5" 0] [Checks to ensure that all 5 aliases listed exist, if not, it initializes them to 0.]; +docident [addpunct] [Injects CubeScript punctuation.]; +docargument [S] [a string] [] [0]; +docargument [N] [type ID] [min 0/max 5/default 0] [0]; +docexample [echo (addpunct hello 1)] [Output: [hello]]; +docident [curplayers] [Returns the current number of players.]; +docremark [The return value includes the local player "(you)", and works in both singleplayer and multiplayer scenarios.]; docsection [General] docident [addserver] [Adds a server to the list of server to query in the server list menu.]; docargument [S] [the address of the server (hostname or IP)] [] [0]; @@ -453,7 +459,8 @@ docremark [If you pass it a non-zero value, the result will be path-less.]; docexample [echo playing: (curmap) vote for: (curmap 1)] [output: playing maps/ac_complex vote for: ac_complex]; docident [curmaprevision] [Current map revision number.]; docargument [] [-] [ read-only]; -docident [curmastermode] [Returns the current mastermode]; +docident [curmastermode] [Returns the server's current mastermode state.]; +docident [curautoteam] [Returns the server's current autoteam state.]; docident [curmode] [Returns the mode number for the current game.]; docident [curmodeattr] [Checks the current game mode for certain attributes.]; docargument [A] [attribute name] [] [0]; @@ -552,6 +559,9 @@ docexample [mapstartonce = [ echo "------------------------------" ]] [This will docexample [addOnLoadOnce [ echo "------------------------------" ]] [This will output the string after any previously defined actions have run.]; docident [onCallVote] [If this alias exists it will be run every time a vote is called.]; docident [onChangeVote] [If this alias exists it will be run every time a vote is changed.]; +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.]; @@ -592,7 +602,7 @@ docargument [B] [pause game] [min 0/max 1/default 0]; docident [prevweapon] [Returns the weapon-index the local player was previously holding.]; docident [pstat_score] [Returns the score statistics for the player with the given clientnumber.]; docargument [C] [client] [0..N] [0]; -docexample [echo (pstat_score 0)] [Output: 0 5 3 43 1 unarmed]; +docexample [echo (pstat_score 0)] [Output: 0 5 3 43 1 1 unarmed]; docident [pstat_weap] [Returns the shot statistics for the player with the given clientnumber.]; docargument [C] [client] [0..N] [0]; docexample [echo (pstat_weap 0)] [Output: 0 0 0 0 0 0 0 0 0 0 1 240 15 312 0 0 3 112 0 0]; @@ -1001,6 +1011,8 @@ docremark [All menu commands placed after newmenu (i.e. menuitem, menuitemcheckb docident [showmenu] [Displays the specified menu.]; docargument [N] [the name of a previously defined menu] [] [0]; docremark [The menu allows the user to pick an item with the cursor keys. Upon pressing return, the associated action will be executed. Pressing ESC will cancel the menu.]; +docident [delmenu] [Deletes the entire contents "(all menu items)" of the given menu.]; +docargument [N] [the name of a previously defined menu] [] [0]; docsection [Heads-Up Display] docident [aboveheadiconfadetime] [Time in milliseconds before the abovehead icon dissapears.]; docargument [V] [abovehead icon display time] [min 1/max 10000/default 2000]; diff --git a/config/menus_multiplayer.cfg b/config/menus_multiplayer.cfg index 474e7fbd..fc8af5d3 100644 --- a/config/menus_multiplayer.cfg +++ b/config/menus_multiplayer.cfg @@ -96,26 +96,6 @@ menuitemtextinput "Server admin password: " "" [ acc3 = $arg1 ] "" 128 menuitem "" -1 menuitem " 2 [ Admin connect ] " [ connectadmin $acc1 $acc2 $acc3 ] -_kickbanaction = kick -newmenu reason - -menuinit [ _kickbanreason = "None"; if (strcmp $_kickbanaction kick) [ ] [ if (strcmp $_kickbanaction ban) [ ] [ _kickbanaction = ban ] ] ] -menuitem "intentional TK" [ _kickbanreason = "intentional TK"; showmenu (concat $_kickbanaction player) ] -menuitem "abusive behaviour" [ _kickbanreason = "abusive behaviour"; showmenu (concat $_kickbanaction player) ] -menuitem "bad language" [ _kickbanreason = "bad language"; showmenu (concat $_kickbanaction player) ] -// TODO: more reasons -//menuitem "" [ _kickbanreason = ""; showmenu (concat $_kickbanaction player) ] -menuitemtextinput "Reason: " "" [ _kickbanreason = $arg1 ] "" 255 -menuitem $_kickbanaction [ showmenu (concat $_kickbanaction player) ] -menuinitselection 2 - -newmenu kick/ban -menuitem "Kick a player" [ _kickbanaction = kick; showmenu reason ] -menuitem "Ban a player" [ _kickbanaction = ban; showmenu reason ] -//menuitem "Kick a player" [ showmenu "kick player" ] -//menuitem "Ban a player" [ showmenu "ban player" ] -menuitem "Remove all bans" [ removebans ] - newmenu "Team adjustment" menuitem "Initiate shuffleteams" [ shuffleteams ] diff --git a/config/scripts.cfg b/config/scripts.cfg index bb1201d6..4b0ef7cc 100644 --- a/config/scripts.cfg +++ b/config/scripts.cfg @@ -399,6 +399,10 @@ cleanshot = [ // Slowtoggle - Meant to be keybound, quickly toggle from fast/slow fly speeds. slowtoggle = [ if (!= $arg1 0) [ slowmove 0; onrelease [ slowmove 1 ] ] [ slowmove 1; onrelease [ slowmove 0 ] ] ] +votepending = 0 +if (! (checkalias onCallVote)) [ onCallVote = "" ]; if (! (strstr $onCallVote votepending)) [ add2alias onCallVote [ votepending = 1 ] ] +if (! (checkalias onVoteEnd)) [ onVoteEnd = "" ]; if (! (strstr $onVoteEnd votepending)) [ add2alias onVoteEnd [ votepending = 0 ] ] + // Simple claim-admin script for one single-server. // Fill in the 3 aliases below, and uncomment the below line to activate. // bind F3 "customclaimadminscript" diff --git a/config/survival.cfg b/config/survival.cfg index a90e9889..1fadbd78 100644 --- a/config/survival.cfg +++ b/config/survival.cfg @@ -124,7 +124,7 @@ increaseDifficulty = [ ] endSurvival = [ - tmp_survstr = $arg1; startedSurvival = 0; survIsFinished = 1; positiontype (at $tmpSurvSets 0); survNumBots = (at $tmpSurvSets 1) + tmp_survstr = $arg1; survIsFinished = 1; startedSurvival = 0; positiontype (at $tmpSurvSets 0); survNumBots = (at $tmpSurvSets 1) add2alias mapstartonce [ echo $tmp_survstr ] tdm (at $defaultmaps (rnd (listlen $defaultmaps))) ] diff --git a/docs/reference.xml b/docs/reference.xml index 0beee14a..7a7a5cd3 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -848,6 +848,47 @@ + + + Injects CubeScript punctuation. + + + + Output: "hello" + + + + Output: [hello] + + + + Output: (hello) + + + + Output: $hello + + + + Output: " + + + + Output: % + + + + + + + + + + Returns the current number of players. + + The return value includes the local player "(you)", and works in both singleplayer and multiplayer scenarios. + + @@ -1608,15 +1649,36 @@ addOnLoadAlways [ If this alias exists it will be run every time a vote is called. + + If this alias exists it will be run every time a vote is changed. + + + If this alias exists it will be run every time a vote passes or fails. + + + + + + + + Determines if there is a vote pending or not. + + + + Output: if there is currently a vote pending, returns 1, else returns 0. + + + + If this alias exists it will be run every time you kill an enemy. @@ -1709,8 +1771,8 @@ echo foo - Output: 0 5 3 43 1 unarmed - The output is a list of FLAGS, FRAGS, DEATHS, POINTS, TEAM, and NAME. + Output: 0 5 3 43 1 1 unarmed + The output is a list of FLAGS, FRAGS, DEATHS, POINTS, TEAM, TEAMKILLS, and NAME. @@ -2040,7 +2102,11 @@ echo (pstat_weap 0) - Returns the current mastermode + Returns the server's current mastermode state. + + + + Returns the server's current autoteam state. @@ -3914,7 +3980,9 @@ Output: + + @@ -3927,9 +3995,23 @@ Output: + + + + + Deletes the entire contents (all menu items) of the given menu. + + + + + + + + + Specifies a model to render while displaying the last added menu. diff --git a/source/src/clientgame.cpp b/source/src/clientgame.cpp index 7880a2dd..487525d4 100644 --- a/source/src/clientgame.cpp +++ b/source/src/clientgame.cpp @@ -250,6 +250,7 @@ int isSpect() { return (player1->team==TEAM_SPECT || player1->spectatemode==SM_F int currole() { return player1->clientrole; } int curmode() { return gamemode; } int curmastermode() { return servstate.mastermode; } +int curautoteam() { return servstate.autoteam; } void curmap(int cleaned) { result(cleaned ? behindpath(getclientmap()) : getclientmap()); } int curmodeattr(char *attr) @@ -269,6 +270,7 @@ COMMAND(isSpect, ARG_IVAL); COMMAND(currole, ARG_IVAL); COMMAND(curmode, ARG_IVAL); COMMAND(curmastermode, ARG_IVAL); +COMMAND(curautoteam, ARG_IVAL); COMMAND(getclientmode, ARG_IVAL); COMMAND(curmodeattr, ARG_1EST); COMMAND(curmap, ARG_1INT); @@ -885,7 +887,7 @@ void dokill(playerent *pl, playerent *act, bool gib, int gun) if(!m_mp(gamemode)) { - if(pl==act || isteam(pl->team, act->team)) act->frags--; + if(pl==act || isteam(pl->team, act->team)) { act->frags--; act->tks++; } else act->frags += ( gib && gun != GUN_GRENADE && gun != GUN_SHOTGUN) ? 2 : 1; } @@ -903,6 +905,7 @@ void pstat_score(int cn) int p_frags = 0; int p_deaths = 0; int p_points = 0; + int p_tks = 0; playerent *pl = cn==player1->clientnum?player1:getclient(cn); if(pl) { @@ -910,8 +913,9 @@ void pstat_score(int cn) p_frags = pl->frags; p_deaths = pl->deaths; p_points = pl->points; + p_tks = pl->tks; } - formatstring(scorestring)("%d %d %d %d %d %s", p_flags, p_frags, p_deaths, p_points, pl ? pl->team : -1, pl ? pl->name : "\"\""); + formatstring(scorestring)("%d %d %d %d %d %d %s", p_flags, p_frags, p_deaths, p_points, pl ? pl->team : -1, p_tks, pl ? pl->name : "\"\""); result(scorestring); /*} else result("0 0 0 0 -1 \"\"");*/ @@ -1121,8 +1125,8 @@ void startmap(const char *name, bool reset) // called just after a map load if(!reset) return; - player1->frags = player1->flagscore = player1->deaths = player1->lifesequence = player1->points = 0; - loopv(players) if(players[i]) players[i]->frags = players[i]->flagscore = players[i]->deaths = players[i]->lifesequence = players[i]->points = 0; + player1->frags = player1->flagscore = player1->deaths = player1->lifesequence = player1->points = player1->tks = 0; + loopv(players) if(players[i]) players[i]->frags = players[i]->flagscore = players[i]->deaths = players[i]->lifesequence = players[i]->points = players[i]->tks = 0; if(editmode) toggleedit(true); intermission = false; showscores(false); @@ -1445,6 +1449,7 @@ void voteresult(int v) curvote->millis = totalmillis + 5000; conoutf(_("vote %s"), v == VOTE_YES ? _("passed") : _("failed")); if(multiplayer(false)) audiomgr.playsound(v == VOTE_YES ? S_VOTEPASS : S_VOTEFAIL, SP_HIGH); + if(identexists("onVoteEnd")) execute("onVoteEnd"); } } diff --git a/source/src/command.cpp b/source/src/command.cpp index 6a4c1516..e3e20680 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -1105,6 +1105,32 @@ void colora(char *s) commandret = newstring(x); } } + +// Easily inject a string into various CubeScript punctuations +void addpunct(char *s, char *type = "0") +{ + int t = atoi(type); + if(t > -1 && t < 6) + { + switch(t) + { + case 1: defformatstring(o1)("[%s]", s); result(o1); break; + case 2: defformatstring(o2)("(%s)", s); result(o2); break; + case 3: defformatstring(o3)("$%s", s); result(o3); break; + case 4: result("\""); break; + case 5: result("%"); break; + default: defformatstring(o4)("\"%s\"", s); result(o4); break; + } + } +} + +// Returns the current # of players +void curplayers(void) +{ + defformatstring(output)("%d", (multiplayer(false) ? (players.length() + 1) : players.length())); + result(output); +} + COMMANDN(c, colora, ARG_1STR); COMMANDN(loop, loopa, ARG_3STR); COMMANDN(while, whilea, ARG_2STR); @@ -1118,6 +1144,8 @@ COMMAND(result, ARG_1STR); COMMAND(at, ARG_2STR); COMMAND(listlen, ARG_1EST); COMMAND(findlist, ARG_2STR); +COMMAND(addpunct, ARG_2STR); +COMMAND(curplayers, ARG_NONE); int add(int a, int b) { return a+b; } COMMANDN(+, add, ARG_2EXP); int mul(int a, int b) { return a*b; } COMMANDN(*, mul, ARG_2EXP); diff --git a/source/src/entity.h b/source/src/entity.h index af5834b9..7c2f0251 100644 --- a/source/src/entity.h +++ b/source/src/entity.h @@ -386,7 +386,7 @@ private: public: int clientnum, lastupdate, plag, ping; int lifesequence; // sequence id for each respawn, used in damage test - int frags, flagscore, deaths, points; + int frags, flagscore, deaths, points, tks; int lastaction, lastmove, lastpain, lastvoicecom; int clientrole; bool attacking; @@ -413,7 +413,7 @@ public: bool ignored, muted; - playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), deaths(0), points(0), lastpain(0), lastvoicecom(0), clientrole(CR_DEFAULT), + playerent() : curskin(0), clientnum(-1), lastupdate(0), plag(0), ping(0), lifesequence(0), frags(0), flagscore(0), deaths(0), points(0), tks(0), lastpain(0), lastvoicecom(0), clientrole(CR_DEFAULT), team(TEAM_SPECT), spectatemode(SM_NONE), followplayercn(FPCN_VOID), eardamagemillis(0), respawnoffset(0), prevweaponsel(NULL), weaponsel(NULL), nextweaponsel(NULL), primweap(NULL), nextprimweap(NULL), lastattackweapon(NULL), smoothmillis(-1), diff --git a/source/src/menus.cpp b/source/src/menus.cpp index 6914d784..cc1bf30d 100644 --- a/source/src/menus.cpp +++ b/source/src/menus.cpp @@ -810,6 +810,16 @@ void menureset(void *menu) m.items.deletecontents(); } +void delmenu(const char *name) +{ + if (!name) return; + gmenu *m = menus.access(name); + if (!m) return; + else menureset(m); +} + +COMMAND(delmenu, ARG_1STR); + void menumanual(void *menu, char *text, char *action, color *bgcolor, const char *desc) { gmenu &m = *(gmenu *)menu;