}
}
-void LocalCommand_find(int request, int argc)
-{
- switch (request)
- {
- case CMD_REQUEST_COMMAND:
- {
- FOREACH_ENTITY_CLASS(argv(1), true, LAMBDA(LOG_INFO(etos(it), "\n")));
- return;
- }
-
- default:
- {
- LOG_INFO("Incorrect parameters for ^2find^7\n");
- }
- case CMD_REQUEST_USAGE:
- {
- LOG_INFO("\nUsage:^3 cl_cmd find classname\n");
- LOG_INFO(" Where 'classname' is the classname to search for.\n");
- return;
- }
- }
-}
-
void LocalCommand_sendcvar(int request, int argc)
{
switch (request)
CLIENT_COMMAND(handlevote, "System to handle selecting a vote or option") { LocalCommand_handlevote(request, arguments); }
CLIENT_COMMAND(hud, "Commands regarding/controlling the HUD system") { LocalCommand_hud(request, arguments); }
CLIENT_COMMAND(localprint, "Create your own centerprint sent to yourself") { LocalCommand_localprint(request, arguments); }
-CLIENT_COMMAND(find, "Search through entities for matching classname") { LocalCommand_find(request, arguments); }
CLIENT_COMMAND(mv_download, "Retrieve mapshot picture from the server") { LocalCommand_mv_download(request, arguments); }
CLIENT_COMMAND(sendcvar, "Send a cvar to the server (like weaponpriority)") { LocalCommand_sendcvar(request, arguments); }
// Last updated: February 19th, 2012
// =========================================================
-// used by generic commands for better help/usage information
-string GetProgramCommandPrefix()
-{
- #ifdef SVQC
- return "sv_cmd";
- #endif
- #ifdef CSQC
- return "cl_cmd";
- #endif
- #ifdef MENUQC
- return "menu_cmd";
- #endif
-}
// used by curl command
void Curl_URI_Get_Callback(int id, float status, string data)
float GenericCommand(string command);
// Returns command prefix specific for whatever program it is compiled in
-string GetProgramCommandPrefix();
+#ifdef SVQC
+ #define GetProgramCommandPrefix() "sv_cmd"
+#elif defined(CSQC)
+ #define GetProgramCommandPrefix() "cl_cmd"
+#elif defined(MENUQC)
+ #define GetProgramCommandPrefix() "menu_cmd"
+#endif
// used by common/command/generic.qc:GenericCommand_dumpcommands to list all commands into a .txt file
#define CMD_Write(s) fputs(fh, s)
REGISTER_NET_TEMP(net_debug)
#endif
-#ifdef SVQC
-
-#include <server/command/all.qh>
-
-#endif
-
#ifdef CSQC
NET_HANDLE(net_debug, bool isNew)
{
}
#endif
-#ifdef SVQC
-SERVER_COMMAND(find, "Search through entities for matching classname")
+GENERIC_COMMAND(find, "Search through entities for matching classname")
{
switch (request)
{
case CMD_REQUEST_COMMAND:
{
- for (entity client = NULL; (client = find(client, classname, argv(1))); )
- LOG_INFO(etos(client), "\n");
+ FOREACH_ENTITY_CLASS_ORDERED(argv(1), true, LAMBDA(LOG_INFOF("%i (%s)\n", it, it.classname)));
return;
}
default:
+ {
LOG_INFO("Incorrect parameters for ^2find^7\n");
+ }
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd find classname\n");
+ LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " find classname\n");
LOG_INFO(" Where 'classname' is the classname to search for.\n");
return;
}
}
}
-SERVER_COMMAND(findat, "Search through entities for matching origin")
+GENERIC_COMMAND(findat, "Search through entities for matching origin")
{
switch (request)
{
case CMD_REQUEST_COMMAND:
{
vector match = stov(argv(1));
- FOREACH_ENTITY_ORDERED(it.origin == match, LAMBDA(LOG_INFOF("%i\n", it)));
+ FOREACH_ENTITY_ORDERED(it.origin == match, LAMBDA(LOG_INFOF("%i (%s)\n", it, it.classname)));
return;
}
LOG_INFO("Incorrect parameters for ^2findat^7\n");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd findat \"0 0 0\"\n");
+ LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\"\n");
return;
}
}
}
-#endif