// =====================================================
// Server side game commands code, reworked by Samual
-// Last updated: November 8th, 2011
+// Last updated: December 6th, 2011
// =====================================================
#define GC_REQUEST_COMMAND 1
// Command Sub-Functions
// =======================
-void GameCommand_adminmsg(float request, float argc)
+void GameCommand_adminmsg(float request, float argc) // todo: re-write this, plus support multiple clients at once like moveplayer
{
switch(request)
{
// ==================================
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-#define SERVER_COMMANDS(request,arguments) \
+#define SERVER_COMMANDS(request,arguments,command) \
SERVER_COMMAND("adminmsg", GameCommand_adminmsg(request, arguments), "Send an admin message to a client directly") \
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("trace", GameCommand_trace(request, arguments), "Various debugging tools with tracing") \
SERVER_COMMAND("unlockteams", GameCommand_unlockteams(request), "Enable the ability for players to switch or enter teams") \
SERVER_COMMAND("warp", GameCommand_warp(request, arguments), "Choose different level in campaign") \
+ SERVER_COMMAND("vote", VoteCommand(request, world, arguments, command), "Server side control of voting") /* handled in server/vote.qc */ \
/* nothing */
void GameCommand_macro_help()
#define SERVER_COMMAND(name,function,description) \
{ print(" ^2", name, "^7: ", description, "\n"); }
- SERVER_COMMANDS(0, 0)
+ SERVER_COMMANDS(0, 0, "")
#undef SERVER_COMMAND
return;
}
-float GameCommand_macro_command(float argc)
+float GameCommand_macro_command(float argc, string command)
{
#define SERVER_COMMAND(name,function,description) \
{ if(name == strtolower(argv(0))) { function; return TRUE; } }
- SERVER_COMMANDS(GC_REQUEST_COMMAND, argc)
+ SERVER_COMMANDS(GC_REQUEST_COMMAND, argc, command)
#undef SERVER_COMMAND
return FALSE;
#define SERVER_COMMAND(name,function,description) \
{ if(name == strtolower(argv(1))) { function; return TRUE; } }
- SERVER_COMMANDS(GC_REQUEST_USAGE, argc)
+ SERVER_COMMANDS(GC_REQUEST_USAGE, argc, "")
#undef SERVER_COMMAND
return FALSE;
{
print("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are:\n");
GameCommand_macro_help();
- GameCommand_Vote("help", world);
+
GameCommand_Ban("help");
GameCommand_Generic("help");
print("For help about specific commands, type sv_cmd help COMMAND\n");
return;
}
}
- else if(GameCommand_Vote(command, world))
- {
- return; // handled by server/vote.qc
- }
else if(GameCommand_Ban(command))
{
return; // handled by server/ipban.qc
{
return; // handled by common/gamecommand.qc
}
- else if(GameCommand_macro_command(argc)) // continue as usual and scan for normal commands
+ else if(GameCommand_macro_command(argc, command)) // continue as usual and scan for normal commands
{
return; // handled by one of the above GameCommand_* functions
}