diff --git a/config/docs.cfg b/config/docs.cfg index 9df00958..03e402fc 100644 --- a/config/docs.cfg +++ b/config/docs.cfg @@ -520,6 +520,7 @@ docremark [If I is 4 you get a string representing the current state of the peer docexample [echo [I am (curserver 4) to (curserver 2)]] [Output: I am connected to ctf-only.assault-servers.net]; docexample [last_server = "" remember_server = [ if (strcmp (curserver 4) "connected") [ last_server = (curserver 0) echo "I'm remembering:" $last_server ] [ echo "you are not 'connected' - you" (concatword "are '" (curserver 4) "' !") ] ] bind PRINT [ if (strcmp $last_server "") [ remember_server ] [ say (concat "^L2I was just ^Lfon^L3" $last_server) last_server = "" ] ]] [This will either remember or retrieve the last server you pressed the PrintScreen-key on.]; docident [curteam] [Returns 1 if the local player is on the RVSF team, 0 if on CLA.]; +docargument [C] [optional argument: client number] [] [0]; docident [curweapon] [Returns the weapon-index the local player is currently holding.]; docident [demo] [Plays a recorded demo.]; docargument [S] [the demo name] [] [0]; @@ -731,7 +732,7 @@ docargument [M] [mode] [1 or 2] [0]; docargument [T] [time (in minutes)] [1-60] [0]; docremark [The first argument "M" needs to be 1 for setting the FFA-timeout or 2 for the Team-Mode-timeout.]; docident [isclient] [Determines if the client number given is a valid client "(player)".]; -docargument [C] [client number [] [0]; +docargument [C] [client number] [] [0]; docexample [echo (isclient 0)] [Example output: 1]; docexample [echo (isclient 32)] [Example output: 0]; docsection [Editing] diff --git a/docs/reference.xml b/docs/reference.xml index ac3becd0..457e49c7 100644 --- a/docs/reference.xml +++ b/docs/reference.xml @@ -2420,7 +2420,7 @@ bind PRINT [ if (strcmp $last_server "") [ remember_server ] Returns 1 if the local player is on the RVSF team, 0 if on CLA. If the player is in SPECTATOR it returns 2. - + diff --git a/source/src/command.cpp b/source/src/command.cpp index f5c98423..49eec2c7 100644 --- a/source/src/command.cpp +++ b/source/src/command.cpp @@ -156,8 +156,15 @@ void constant(const char *name, const char *action) ident b(ID_ALIAS, newstring(name), newstring(action), persistidents, execcontext); b.isconst = true; idents->access(b.name, b); + return; } - else if(b->type==ID_ALIAS) + if(b->isconst) + { + conoutf("%s is already defined as a constant", b->name); + scripterr(); + return; + } + if(b->type==ID_ALIAS) { if(contextisolated[execcontext] && execcontext > b->context) { @@ -1399,7 +1406,14 @@ void writecfg() enumerate(*idents, ident, id, if(id.type==ID_ALIAS && id.persist && id.action[0]) { - f->printf("%s = [%s]\n", id.name, id.action); + if(id.isconst) + { + f->printf("const %s %s\n", id.name, id.action); + } + else + { + f->printf("%s = [%s]\n", id.name, id.action); + } } ); f->printf("\n");