X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fgamecommand.qc;h=b0085224fadb3064e9aef6a817c1c2a6fc263222;hb=0731fd69a669075745c22c9e7e8413fe05583b50;hp=8e63beecc33793b7c3611434f609953b76988a98;hpb=50f674234c966c7ae5c6c2f702630a837111c4ab;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/gamecommand.qc b/qcsrc/server/gamecommand.qc index 8e63beecc..b0085224f 100644 --- a/qcsrc/server/gamecommand.qc +++ b/qcsrc/server/gamecommand.qc @@ -590,6 +590,7 @@ void EffectIndexDump() db_put(d, "TR_NEHAHRASMOKE", "1"); print("effect TR_NEHAHRASMOKE is ", ftos(particleeffectnum("TR_NEHAHRASMOKE")), "\n"); db_put(d, "TR_NEXUIZPLASMA", "1"); print("effect TR_NEXUIZPLASMA is ", ftos(particleeffectnum("TR_NEXUIZPLASMA")), "\n"); db_put(d, "TR_GLOWTRAIL", "1"); print("effect TR_GLOWTRAIL is ", ftos(particleeffectnum("TR_GLOWTRAIL")), "\n"); + db_put(d, "TR_SEEKER", "1"); print("effect TR_SEEKER is ", ftos(particleeffectnum("TR_SEEKER")), "\n"); db_put(d, "SVC_PARTICLE", "1"); print("effect SVC_PARTICLE is ", ftos(particleeffectnum("SVC_PARTICLE")), "\n"); fh = fopen("effectinfo.txt", FILE_READ); @@ -626,6 +627,47 @@ void make_mapinfo_Think() } } +void changematchtime(float delta, float mi, float ma) +{ + float cur; + float new; + float lim; + + if(delta == 0) + return; + if(autocvar_timelimit < 0) + return; + + if(mi <= 10) + mi = 10; // at least ten sec in the future + cur = time - game_starttime; + if(cur > 0) + mi += cur; // from current time! + + lim = autocvar_timelimit * 60; + + if(delta > 0) + { + if(lim == 0) + return; // cannot increase any further + else if(lim < ma) + new = min(ma, lim + delta); + else // already above maximum: FAIL + return; + } + else + { + if(lim == 0) // infinite: try reducing to max, if we are allowed to + new = max(mi, ma); + else if(lim > mi) // above minimum: decrease + new = max(mi, lim + delta); + else // already below minimum: FAIL + return; + } + + cvar_set("timelimit", ftos(new)); +} + void GameCommand(string command) { float argc; @@ -638,7 +680,7 @@ void GameCommand(string command) if(argv(0) == "help" || argc == 0) { print("Usage: sv_cmd COMMAND..., where possible commands are:\n"); - print(" adminmsg clientnumber \"message\"\n"); + print(" adminmsg clientnumber \"message\" [infobartime]\n"); print(" teamstatus\n"); print(" printstats\n"); print(" make_mapinfo\n"); @@ -653,6 +695,8 @@ void GameCommand(string command) print(" cvar_changes\n"); print(" cvar_purechanges\n"); print(" find classname\n"); + print(" extendmatchtime\n"); + print(" reducematchtime\n"); GameCommand_Vote("help", world); GameCommand_Ban("help"); GameCommand_Generic("help"); @@ -717,24 +761,40 @@ void GameCommand(string command) } if(argv(0) == "adminmsg") - if(argc == 3) + if(argc >= 3 && argc <= 4) { entno = stof(argv(1)); - if((entno < 1) | (entno > maxclients)) { + if((entno < 0) | (entno > maxclients)) { print("Player ", argv(1), " doesn't exist\n"); return; } - client = edict_num(entno); - - if(client.flags & FL_CLIENT) + n = 0; + for(i = (entno ? entno : 1); i <= (entno ? entno : maxclients); ++i) { - centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3", admin_name(), ":\n\n^7", argv(2))); - sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", argv(2), "\n")); - print("Message sent to ", client.netname, "\n"); + client = edict_num(i); + if(client.flags & FL_CLIENT) + { + if(argc == 4) + { + s = argv(2); + s = strreplace(s, "\n", ""); + s = strreplace(s, "\\", "\\\\"); + s = strreplace(s, "$", "$$"); + s = strreplace(s, "\"", "\\\""); + stuffcmd(client, sprintf("\ninfobar %f \"%s\"\n", stof(argv(3)), s)); + } + else + { + centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3", admin_name(), ":\n\n^7", argv(2))); + sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", argv(2), "\n")); + } + print("Message sent to ", client.netname, "\n"); + ++n; + } } - else + if(!n) print("Client not found\n"); return; @@ -771,10 +831,10 @@ void GameCommand(string command) if(plr.classname == "spectator" || plr.classname == "observer") { plr.spectatortime = time; - sprint(plr, strcat("^7You have to become a player within the next ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); + sprint(plr, strcat("^7You have to become a player within the next ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n")); } } - bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds!\n")); + bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(autocvar_g_maxplayers_spectator_blocktime), " seconds!\n")); return; } @@ -1379,6 +1439,18 @@ void GameCommand(string command) return; } + if(argv(0) == "extendmatchtime") + { + changematchtime(autocvar_timelimit_increment* 60, autocvar_timelimit_min*60, autocvar_timelimit_max*60); + return; + } + + if(argv(0) == "reducematchtime") + { + changematchtime(autocvar_timelimit_decrement*-60, autocvar_timelimit_min*60, autocvar_timelimit_max*60); + return; + } + print("Invalid command. For a list of supported commands, try sv_cmd help.\n"); }