}
else
{
- centerprint(client, strcat("^3", admin_name(), ":\n^7", admin_message));
- sprint(client, strcat("\{1}\{13}^3", admin_name(), "^7: ", admin_message, "\n"));
+ centerprint(client, strcat("^3", GetCallerName(NULL), ":\n^7", admin_message));
+ sprint(client, strcat("\{1}\{13}^3", GetCallerName(NULL), "^7: ", admin_message, "\n"));
}
- successful = strcat(successful, (successful ? ", " : ""), client.netname);
- LOG_TRACE("Message sent to ", client.netname);
+ successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
+ LOG_TRACE("Message sent to ", playername(client, false));
continue;
}
{
case CMD_REQUEST_COMMAND:
{
- LOG_INFO("Original size: ", ftos(world.absmin.x), " ", ftos(world.absmin.y), " ", ftos(world.absmin.z));
- LOG_INFO(" ", ftos(world.absmax.x), " ", ftos(world.absmax.y), " ", ftos(world.absmax.z), "\n");
- LOG_INFO("Currently set size: ", ftos(world.mins.x), " ", ftos(world.mins.y), " ", ftos(world.mins.z));
- LOG_INFO(" ", ftos(world.maxs.x), " ", ftos(world.maxs.y), " ", ftos(world.maxs.z), "\n");
- LOG_INFO("Solid bounding box size:");
-
+ vector size_min = '0 0 0';
+ vector size_max = '0 0 0';
tracebox('1 0 0' * world.absmin.x,
'0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
'0 1 0' * world.absmax.y + '0 0 1' * world.absmax.z,
'1 0 0' * world.absmax.x,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.x));
- else LOG_INFO(" ", ftos(trace_endpos.x));
+ size_min.x = (trace_startsolid) ? world.absmin.x : trace_endpos.x;
tracebox('0 1 0' * world.absmin.y,
'1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
'0 1 0' * world.absmax.y,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.y));
- else LOG_INFO(" ", ftos(trace_endpos.y));
+ size_min.y = (trace_startsolid) ? world.absmin.y : trace_endpos.y;
tracebox('0 0 1' * world.absmin.z,
'1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
'0 0 1' * world.absmax.z,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmin.z));
- else LOG_INFO(" ", ftos(trace_endpos.z));
+ size_min.z = (trace_startsolid) ? world.absmin.z : trace_endpos.z;
tracebox('1 0 0' * world.absmax.x,
'0 1 0' * world.absmin.y + '0 0 1' * world.absmin.z,
'1 0 0' * world.absmin.x,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.x));
- else LOG_INFO(" ", ftos(trace_endpos.x));
+ size_max.x = (trace_startsolid) ? world.absmax.x : trace_endpos.x;
tracebox('0 1 0' * world.absmax.y,
'1 0 0' * world.absmin.x + '0 0 1' * world.absmin.z,
'0 1 0' * world.absmin.y,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.y));
- else LOG_INFO(" ", ftos(trace_endpos.y));
+ size_max.y = (trace_startsolid) ? world.absmax.y : trace_endpos.y;
tracebox('0 0 1' * world.absmax.z,
'1 0 0' * world.absmin.x + '0 1 0' * world.absmin.y,
'0 0 1' * world.absmin.z,
MOVE_WORLDONLY,
NULL);
- if (trace_startsolid) LOG_INFO(" ", ftos(world.absmax.z));
- else LOG_INFO(" ", ftos(trace_endpos.z));
+ size_max.z = (trace_startsolid) ? world.absmax.z : trace_endpos.z;
- LOG_INFO("\n");
+ LOG_INFOF("Original size: %v %v\n", world.absmin, world.absmax);
+ LOG_INFOF("Currently set size: %v %v\n", world.mins, world.maxs);
+ LOG_INFOF("Solid bounding box size: %v %v\n", size_min, size_max);
return;
}
}
else
{
- // let's start at token 2 so we can skip sv_cmd bot_cmd
- bot = find_bot_by_number(stof(argv(2)));
- if (bot == NULL) bot = find_bot_by_name(argv(2));
- if (bot) bot_queuecommand(bot, substring(s, argv_start_index(3), -1));
+ if(argv(2) == "*" || argv(2) == "all")
+ FOREACH_CLIENT(IS_BOT_CLIENT(it), {
+ bot_queuecommand(it, substring(s, argv_start_index(3), -1));
+ });
+ else
+ {
+ bot = find_bot_by_number(stof(argv(2)));
+ if (bot == NULL) bot = find_bot_by_name(argv(2));
+ if (bot) bot_queuecommand(bot, substring(s, argv_start_index(3), -1));
+ }
}
}
else
}
else if (argc >= 3) // this comes last
{
- bot = find_bot_by_number(stof(argv(1)));
- if (bot == NULL) bot = find_bot_by_name(argv(1));
- if (bot)
+ if(argv(1) == "*" || argv(1) == "all")
{
- LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
- bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
+ int bot_num = 0;
+ FOREACH_CLIENT(IS_BOT_CLIENT(it), {
+ bot_queuecommand(it, substring(command, argv_start_index(2), -1));
+ bot_num++;
+ });
+ if(bot_num)
+ LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")\n"));
return;
}
else
{
- LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n")); // don't return so that usage is shown
+ bot = find_bot_by_number(stof(argv(1)));
+ if (bot == NULL) bot = find_bot_by_name(argv(1));
+ if (bot)
+ {
+ LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
+ bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
+ return;
+ }
+ else
+ {
+ LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n")); // don't return so that usage is shown
+ }
}
}
}
case CMD_REQUEST_USAGE:
{
LOG_INFO("\nUsage:^3 sv_cmd bot_cmd client command [argument]\n");
- LOG_INFO(" 'client' can be either the name or entity id of the bot\n");
+ LOG_INFO(" 'client' can be either the name of the bot or a progressive number (not the entity number!)\n");
+ LOG_INFO(" can also be '*' or 'all' to allow sending the command to all the bots\n");
LOG_INFO(" For full list of commands, see bot_cmd help [command].\n");
- LOG_INFO("Examples: sv_cmd bot_cmd client cc \"say something\"\n");
- LOG_INFO(" sv_cmd bot_cmd client presskey jump\n");
+ LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"\n");
+ LOG_INFO(" sv_cmd bot_cmd 1 presskey jump\n");
+ LOG_INFO(" sv_cmd bot_cmd * pause\n");
return;
}
}
if (accepted > 0)
{
stuffcmd(client, "defer clear\n");
- LOG_INFO("defer clear stuffed to ", client.netname, "\n");
+ LOG_INFO("defer clear stuffed to ", playername(client, false), "\n");
}
else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
if (client.caplayer) client.caplayer = 0;
PutObserverInServer(client);
- successful = strcat(successful, (successful ? ", " : ""), client.netname);
+ successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
}
else
{
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already spectating.\n");
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.\n");
}
continue;
}
if (team_id == client.team) // already on the destination team
{
// keep the forcing undone
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
continue;
}
else if (team_id == 0) // auto team
// If so, lets continue and finally move the player
client.team_forced = 0;
- MoveToTeam(client, team_id, 6);
- successful = strcat(successful, (successful ? ", " : ""), client.netname);
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+ if (MoveToTeam(client, team_id, 6))
+ {
+ successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+ }
+ else
+ {
+ LOG_INFO("Unable to move player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ")");
+ }
continue;
}
else
FOREACH_CLIENT(IS_REAL_CLIENT(it) && (IS_SPEC(it) || IS_OBSERVER(it)) && !it.caplayer, LAMBDA(
if(!it.caplayer)
{
- it.spectatortime = time;
+ CS(it).spectatortime = time;
Send_Notification(NOTIF_ONE_ONLY, it, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);
}
));
start = stov(vtos(start));
end = stov(vtos(end));
- tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, NULL);
+ tracebox(start, PL_MIN_CONST, PL_MAX_CONST, end, MOVE_NOMONSTERS, NULL);
if (!trace_startsolid && trace_fraction < 1)
{
p = trace_endpos;
- tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), p, MOVE_NOMONSTERS, NULL);
+ tracebox(p, PL_MIN_CONST, PL_MAX_CONST, p, MOVE_NOMONSTERS, NULL);
if (trace_startsolid)
{
rint(42); // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid
- tracebox(start, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), end, MOVE_NOMONSTERS, NULL);
+ tracebox(start, PL_MIN_CONST, PL_MAX_CONST, end, MOVE_NOMONSTERS, NULL);
// how much do we need to back off?
safe = 1;
for ( ; ; )
{
pos = p * (1 - (safe + unsafe) * 0.5) + start * ((safe + unsafe) * 0.5);
- tracebox(pos, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), pos, MOVE_NOMONSTERS, NULL);
+ tracebox(pos, PL_MIN_CONST, PL_MAX_CONST, pos, MOVE_NOMONSTERS, NULL);
if (trace_startsolid)
{
if ((safe + unsafe) * 0.5 == unsafe) break;
LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
- tracebox(p, STAT(PL_MIN, NULL) + '0.1 0.1 0.1', STAT(PL_MAX, NULL) - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
+ tracebox(p, PL_MIN_CONST + '0.1 0.1 0.1', PL_MAX_CONST - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
if (++hitcount >= 10) break;
{
q = p + normalize(end - p) * (dq + dqf);
if (q == q0) break;
- tracebox(p, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), q, MOVE_NOMONSTERS, NULL);
+ tracebox(p, PL_MIN_CONST, PL_MAX_CONST, q, MOVE_NOMONSTERS, NULL);
if (trace_startsolid) error("THIS ONE cannot happen");
if (trace_fraction > 0) dq += dqf * trace_fraction;
dqf *= 0.5;