float infobartime = stof(argv(3));
string successful, t;
+ successful = string_null;
if((targets) && (admin_message))
{
if(successful)
bprint("Successfully sent message '", admin_message, "' to ", successful, ".\n");
else
- print("No players given (", original_targets, ") could recieve the message.\n");
+ print("No players given (", original_targets, ") could receive the message.\n");
return;
}
{
entity client;
string reason = argv(1);
- float i;
+ float i = 0;
FOR_EACH_REALPLAYER(client)
{
}
}
-void GameCommand_bbox(float request) // legacy
+void GameCommand_bbox(float request)
{
switch(request)
{
}
}
-void GameCommand_bot_cmd(float request, float argc) // mostly legacy
+void GameCommand_bot_cmd(float request, float argc, string command)
{
switch(request)
{
bot_resetqueues();
return;
}
+ else if(argv(1) == "setbots")
+ {
+ cvar_settemp("bot_vs_human", "0");
+ cvar_settemp("minplayers", "0");
+ cvar_settemp("bot_number", "0");
+ bot_fixcount();
+ cvar_settemp("bot_number", argv(2));
+ if(!bot_fixcount())
+ print("Sorry, could not set requested bot count\n");
+ return;
+ }
else if(argv(1) == "load" && argc == 3)
{
float fh, i;
}
else if(argv(2) == "setbots")
{
+ cvar_settemp("bot_vs_human", "0");
cvar_settemp("minplayers", "0");
+ cvar_settemp("bot_number", "0");
+ bot_fixcount();
cvar_settemp("bot_number", argv(3));
if(!bot_fixcount())
print("Sorry, could not set requested bot count\n");
if(bot == world)
bot = find_bot_by_name(argv(2));
if(bot)
- bot_queuecommand(bot, strcat(argv(3), " ", argv(4)));
+ bot_queuecommand(bot, substring(s, argv_start_index(3), -1));
}
}
else
bot = find_bot_by_name(argv(1));
if(bot)
{
- print(strcat("Command '", strcat(argv(2), " ", argv(3)), "' sent to bot ", bot.netname, "\n"));
- bot_queuecommand(bot, strcat(argv(2), " ", argv(3)));
+ print(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
}
}
-void GameCommand_database(float request, float argc) // legacy
+void GameCommand_database(float request, float argc)
{
switch(request)
{
case CMD_REQUEST_COMMAND:
{
entity client;
- float i;
+ float i = 0;
float argc;
FOR_EACH_CLIENT(client)
}
}
-void GameCommand_delrec(float request, float argc) // legacy // perhaps merge later with records and printstats and such?
+void GameCommand_delrec(float request, float argc) // perhaps merge later with records and printstats and such?
{
switch(request)
{
}
}
-void GameCommand_effectindexdump(float request) // legacy
+void GameCommand_effectindexdump(float request)
{
switch(request)
{
}
}
-void GameCommand_extendmatchtime(float request) // legacy
+void GameCommand_extendmatchtime(float request)
{
switch(request)
{
}
}
-void GameCommand_find(float request, float argc) // legacy // is this even needed? We have prvm_edicts command and such ANYWAY
+void GameCommand_find(float request, float argc) // is this even needed? We have prvm_edicts command and such ANYWAY
{
switch(request)
{
}
}
-void GameCommand_gametype(float request, float argc) // legacy
+void GameCommand_gametype(float request, float argc)
{
switch(request)
{
}
}
-void GameCommand_gettaginfo(float request, float argc) // legacy
+void GameCommand_gettaginfo(float request, float argc)
{
switch(request)
{
}
}
-void GameCommand_gotomap(float request, float argc) // mostly legacy
+void GameCommand_animbench(float request, float argc)
+{
+ switch(request)
+ {
+ case CMD_REQUEST_COMMAND:
+ {
+ entity tmp_entity;
+ float i;
+ vector v;
+
+ if(argc >= 4)
+ {
+ tmp_entity = spawn();
+ if(argv(1) == "w")
+ setmodel(tmp_entity, (nextent(world)).weaponentity.model);
+ else
+ {
+ precache_model(argv(1));
+ setmodel(tmp_entity, argv(1));
+ }
+ float f1 = stof(argv(2));
+ float f2 = stof(argv(3));
+ float t0;
+ float t1 = 0;
+ float t2 = 0;
+ float n = 0;
+
+ while(t1 + t2 < 1)
+ {
+ tmp_entity.frame = f1;
+ t0 = gettime(GETTIME_HIRES);
+ getsurfacepoint(tmp_entity, 0, 0);
+ t1 += gettime(GETTIME_HIRES) - t0;
+ tmp_entity.frame = f2;
+ t0 = gettime(GETTIME_HIRES);
+ getsurfacepoint(tmp_entity, 0, 0);
+ t2 += gettime(GETTIME_HIRES) - t0;
+ n += 1;
+ }
+ print("model ", tmp_entity.model, " frame ", ftos(f1), " animtime ", ftos(n / t1), "/s\n");
+ print("model ", tmp_entity.model, " frame ", ftos(f2), " animtime ", ftos(n / t2), "/s\n");
+
+ remove(tmp_entity);
+ return;
+ }
+ }
+
+ default:
+ print("Incorrect parameters for ^2gettaginfo^7\n");
+ case CMD_REQUEST_USAGE:
+ {
+ print("\nUsage:^3 sv_cmd gettaginfo model frame index [command one] [command two]\n");
+ print("See also: ^2bbox, trace^7\n");
+ return;
+ }
+ }
+}
+
+void GameCommand_gotomap(float request, float argc)
{
switch(request)
{
}
}
-void GameCommand_make_mapinfo(float request) // legacy
+void GameCommand_make_mapinfo(float request)
{
switch(request)
{
string notify = argv(3);
string successful, t;
+ successful = string_null;
// lets see if the target(s) even actually exist.
if((targets) && (destination))
if(teamplay)
{
// set up
- float team_color;
+ float team_id;
float save = client.team_forced;
client.team_forced = 0;
// find the team to move the player to
- team_color = ColourToNumber(destination);
- if(team_color == client.team) // already on the destination team
+ team_id = Team_ColorToTeam(destination);
+ if(team_id == client.team) // already on the destination team
{
// keep the forcing undone
- print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", ColoredTeamName(client.team), (targets ? ", skipping to next player.\n" : ".\n"));
+ print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
continue;
}
- else if(team_color == 0) // auto team
+ else if(team_id == 0) // auto team
{
- team_color = NumberToTeamNumber(FindSmallestTeam(client, FALSE));
+ team_id = Team_NumberToTeam(FindSmallestTeam(client, FALSE));
}
else
{
client.team_forced = save;
// Check to see if the destination team is even available
- switch(team_color)
+ switch(team_id)
{
- case COLOR_TEAM1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
- case COLOR_TEAM2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
- case COLOR_TEAM3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
- case COLOR_TEAM4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
+ case FL_TEAM_1: if(c1 == -1) { print("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
+ case FL_TEAM_2: if(c2 == -1) { print("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
+ case FL_TEAM_3: if(c3 == -1) { print("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
+ case FL_TEAM_4: if(c4 == -1) { print("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
default: print("Sorry, can't move player here if team ", destination, " doesn't exist.\n"); return;
}
// If so, lets continue and finally move the player
client.team_forced = 0;
- MoveToTeam(client, team_color, 6, stof(notify));
+ MoveToTeam(client, team_id, 6, stof(notify));
successful = strcat(successful, (successful ? ", " : ""), client.netname);
- print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", ColoredTeamName(team_color), ".\n");
+ print("Player ", ftos(GetFilteredNumber(t)), " (", client.netname, ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
continue;
}
else
}
}
-void GameCommand_nospectators(float request) // legacy
+void GameCommand_nospectators(float request)
{
switch(request)
{
}
}
-void GameCommand_playerdemo(float request, float argc) // mostly legacy
+void GameCommand_playerdemo(float request, float argc)
{
switch(request)
{
}
}
-void GameCommand_printstats(float request) // legacy
+void GameCommand_printstats(float request)
{
switch(request)
{
}
}
-void GameCommand_reducematchtime(float request) // legacy
+void GameCommand_reducematchtime(float request)
{
switch(request)
{
{
if(teamplay)
{
- entity tmp_player, client;
- float i, x, z, t_teams, t_players, team_color, accepted;
+ entity tmp_player;
+ float i, x, z, t_teams, t_players, team_color;
// count the total amount of players and total amount of teams
+ t_players = 0;
+ t_teams = 0;
FOR_EACH_PLAYER(tmp_player)
{
CheckAllowedTeams(tmp_player);
x = (t_players / t_teams);
x = ((i == 1) ? ceil(x) : floor(x));
- team_color = NumberToTeamNumber(i);
+ team_color = Team_NumberToTeam(i);
// sort through the random list of players made earlier
for(z = 1; z <= maxclients; ++z)
{
if(argv(2))
{
- entity client = GetIndexedEntity(argc, 1));
+ entity client = GetIndexedEntity(argc, 1);
float accepted = VerifyClientEntity(client, TRUE, FALSE);
if(accepted > 0)
{
case CMD_REQUEST_COMMAND:
{
- // This is kinda a mess, a lot of it is legacy and thus not rewritten/optimized.
entity e;
vector org, delta, start, end, p, q, q0, pos, vv, dv;
float i, f, safe, unsafe, dq, dqf;
{
rint(42); // do an engine breakpoint on VM_rint so you can get the trace that errnoeously returns startsolid
tracebox(start, PL_MIN, PL_MAX, end, MOVE_NOMONSTERS, world);
- tracebox(p, PL_MIN, PL_MAX, q, MOVE_NOMONSTERS, world);
if(trace_startsolid)
{
}
}
-void GameCommand_warp(float request, float argc) // mostly legacy
+void GameCommand_warp(float request, float argc)
{
switch (request)
{
SERVER_COMMAND("allready", GameCommand_allready(request), "Restart the server and reset the players") \
SERVER_COMMAND("allspec", GameCommand_allspec(request, arguments), "Force all players to spectate") \
SERVER_COMMAND("anticheat", GameCommand_anticheat(request, arguments), "Create an anticheat report for a client") \
+ SERVER_COMMAND("animbench", GameCommand_animbench(request, arguments), "Benchmark model animation (LAGS)") \
SERVER_COMMAND("bbox", GameCommand_bbox(request), "Print detailed information about world size") \
- SERVER_COMMAND("bot_cmd", GameCommand_bot_cmd(request, arguments), "Control and send commands to bots") \
+ SERVER_COMMAND("bot_cmd", GameCommand_bot_cmd(request, arguments, command), "Control and send commands to bots") \
SERVER_COMMAND("cointoss", GameCommand_cointoss(request, arguments), "Flip a virtual coin and give random result") \
SERVER_COMMAND("database", GameCommand_database(request, arguments), "Extra controls of the serverprogs database") \
SERVER_COMMAND("defer_clear", GameCommand_defer_clear(request, arguments), "Clear all queued defer commands for a specific client") \
print(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.\n");
return;
-}
\ No newline at end of file
+}