#include "common.qh"
-#include <common/command/command.qh>
+
+#include <server/defs.qh>
+#include <server/miscfunctions.qh>
+
+#include <common/command/_mod.qh>
#include "common.qh"
#include "../scores.qh"
-#include <common/monsters/all.qh>
+#include <common/monsters/_mod.qh>
#include <common/notifications/all.qh>
#include <lib/warpzone/common.qh>
// if client return player nickname, or if server return admin nickname
string GetCallerName(entity caller)
{
- if (caller) return caller.netname;
- else return admin_name(); // ((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : autocvar_hostname);
+ if (caller) return playername(caller, false);
+ else return ((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : "SERVER ADMIN"); // autocvar_hostname
}
// verify that the client provided is acceptable for kicking
}
else // no, maybe it's a name?
{
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(strdecolorize(it.netname) == strdecolorize(argv(start_index)))
{
selection = it;
break; // no reason to keep looking
}
- ));
+ });
index = (start_index + 1);
}
else
{
selection = NULL;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
if(strdecolorize(it.netname) == strdecolorize(input))
{
selection = it;
break; // no reason to keep looking
}
- ));
+ });
}
return selection;
void print_to(entity to, string input)
{
if (to) sprint(to, strcat(input, "\n"));
- else LOG_INFO(input, "\n");
+ else print(input, "\n");
}
// ==========================================
}
else // time to end the timeout
{
+ Kill_Notification(NOTIF_ALL, NULL, MSG_CENTER, CPID_TIMEIN);
timeout_status = TIMEOUT_INACTIVE;
// reset the slowmo value back to normal
cvar_set("slowmo", ftos(orig_slowmo));
// unlock the view for players so they can move around again
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
it.fixangle = false;
- ));
+ });
timeout_handler_reset(this);
}
cvar_set("slowmo", ftos(TIMEOUT_SLOWMO_VALUE));
// reset all the flood variables
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
it.nickspamcount = it.nickspamtime = it.floodcontrol_chat =
it.floodcontrol_chatteam = it.floodcontrol_chattell =
it.floodcontrol_voice = it.floodcontrol_voiceteam = 0;
- ));
+ });
// copy .v_angle to .lastV_angle for every player in order to fix their view during pause (see PlayerPreThink)
- FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), LAMBDA(
+ FOREACH_CLIENT(IS_PLAYER(it) && IS_REAL_CLIENT(it), {
it.lastV_angle = it.v_angle;
- ));
+ });
this.nextthink = time; // think again next frame to handle it under TIMEOUT_ACTIVE code
}
if (tmp_moncount >= autocvar_g_monsters_max_perplayer) { print_to(caller, "You can't spawn any more monsters"); return; }
bool found = false;
- for (int i = MON_FIRST; i <= MON_LAST; ++i)
+ FOREACH(Monsters, it != MON_Null && it.netname == arg_lower,
{
- mon = get_monsterinfo(i);
- if (mon.netname == arg_lower) { found = true; break; }
- }
+ found = true;
+ break;
+ });
if (!found && arg_lower != "random") { print_to(caller, "Invalid monster"); return; }
totalspawned += 1;
WarpZone_TraceBox(CENTER_OR_VIEWOFS(caller), caller.mins, caller.maxs, CENTER_OR_VIEWOFS(caller) + v_forward * 150, true, caller);
- mon = spawnmonster(arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag);
+ mon = spawnmonster(spawn(), arg_lower, 0, caller, caller, trace_endpos, false, false, moveflag);
print_to(caller, strcat("Spawned ", mon.monster_name));
return;
}
case "butcher":
{
if (caller) { print_to(caller, "This command is not available to players"); return; }
- if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
+ if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFOF("%s", M_ARGV(0, string)); return; }
int tmp_remcount = 0;
{
case CMD_REQUEST_COMMAND:
{
- for (int i = 0; i < 10; ++i)
- if (records_reply[i] != "") print_to(caller, records_reply[i]);
+ int num = stoi(argv(1));
+ if(num > 0 && num <= 10 && records_reply[num - 1] != "")
+ print_to(caller, records_reply[num - 1]);
+ else
+ {
+ for (int i = 0; i < 10; ++i)
+ if (records_reply[i] != "") print_to(caller, records_reply[i]);
+ }
return; // never fall through to usage
}
{
print_to(caller, "^7Error: You can not call a timeout while the map is being restarted.");
}
- else if (caller && (caller.allowed_timeouts < 1))
+ else if (caller && (CS(caller).allowed_timeouts < 1))
{
print_to(caller, "^7Error: You already used all your timeout calls for this map.");
}
else // everything should be okay, proceed with starting the timeout
{
- if (caller) caller.allowed_timeouts -= 1;
+ if (caller) CS(caller).allowed_timeouts -= 1;
// write a bprint who started the timeout (and how many they have left)
- bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(caller.allowed_timeouts), " timeout(s) left)") : ""), "!\n");
+ bprint(GetCallerName(caller), " ^7called a timeout", (caller ? strcat(" (", ftos(CS(caller).allowed_timeouts), " timeout(s) left)") : ""), "!\n");
timeout_status = TIMEOUT_LEADTIME;
timeout_caller = caller;
"ent", "nickname", "ping", "pl", "time", "ip", "crypto_id"));
total_listed_players = 0;
- FOREACH_CLIENT(true, LAMBDA(
+ FOREACH_CLIENT(true, {
is_bot = (IS_BOT_CLIENT(it));
if (is_bot)
print_to(caller, sprintf(strreplace(" ", separator, " #%-3d %-20.20s %-5d %-3d %-9s %-16s %s "),
etof(it),
it.netname,
- it.ping,
- it.ping_packetloss,
- process_time(1, time - it.jointime),
+ CS(it).ping,
+ CS(it).ping_packetloss,
+ process_time(1, time - CS(it).jointime),
tmp_netaddress,
tmp_crypto_idfp));
++total_listed_players;
- ));
+ });
print_to(caller, strcat("Finished listing ", ftos(total_listed_players), " client(s) out of ", ftos(maxclients), " slots."));