]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamecommand.qc
now using DP_SV_CMD/DP_QC_CMD; removed cvar abuse by g_maplist_add etc. and changed...
[divverent/nexuiz.git] / data / qcsrc / server / gamecommand.qc
1 void GameCommand(string command)
2 {
3         float argc;
4         argc = tokenize(command);
5
6         if(argv(0) == "help" || argc == 0)
7         {
8                 print("Usage: sv_cmd COMMAND..., where possible commands are:\n");
9                 print("  adminmsg clientnumber \"message\"\n");
10                 print("  teamstatus\n");
11                 print("  printstats\n");
12                 GameCommand_Generic("help");
13                 return;
14         }
15
16         if(GameCommand_Generic(command))
17                 return;
18
19         if(argv(0) == "teamstatus")
20         {
21                 PrintScoreboard(world);
22                 return;
23         }
24
25         if(argv(0) == "printstats")
26         {
27                 DumpStats(FALSE);
28                 return;
29         }
30
31         if(argv(0) == "adminmsg")
32         {
33                 if(argc == 3)
34                 {
35                         entity client;
36                         float entno;
37                         entno = stof(argv(1));
38                         for(client = world; entno > 0; --entno, client = nextent(client))
39                                 ;
40                         if(client.flags & FL_CLIENT)
41                         {
42                                 centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3SERVER ADMIN:\n\n^7", argv(2)));
43                                 sprint(client, strcat("\{1}\{13}^3SERVER ADMIN^7: ", argv(2), "\n"));
44                                 print("Message sent to ", client.netname, "\n");
45                         }
46                         else
47                                 print("Client not found\n");
48                         return;
49                 }
50         }
51
52         print("Invalid command. For a list of supported commands, try sv_cmd help.\n");
53 }
54