]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/gamecommand.qc
add "features" (so a mutator combination can require them)
[divverent/nexuiz.git] / data / qcsrc / server / gamecommand.qc
1 string GotoMap(string m);
2
3 void make_mapinfo_Think()
4 {
5         MapInfo_Enumerate(); // just in case
6         if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0))
7         {
8                 print("Done rebuiling mapinfos.\n");
9                 remove(self);
10         }
11         else
12         {
13                 self.think = make_mapinfo_Think;
14                 self.nextthink = time;
15         }
16 }
17
18 void GameCommand(string command)
19 {
20         float argc;
21         argc = tokenize(command);
22
23         if(argv(0) == "help" || argc == 0)
24         {
25                 print("Usage: sv_cmd COMMAND..., where possible commands are:\n");
26                 print("  adminmsg clientnumber \"message\"\n");
27                 print("  teamstatus\n");
28                 print("  printstats\n");
29                 print("  make_mapinfo\n");
30                 GameCommand_Ban("help");
31                 GameCommand_Generic("help");
32                 return;
33         }
34
35         if(GameCommand_Ban(command))
36                 return;
37
38         if(GameCommand_Generic(command))
39                 return;
40
41         if(argv(0) == "teamstatus")
42         {
43                 PrintScoreboard(world);
44                 return;
45         }
46
47         if(argv(0) == "printstats")
48         {
49                 DumpStats(FALSE);
50                 return;
51         }
52
53         if(argv(0) == "make_mapinfo")
54         {
55                 entity e;
56                 e = spawn();
57                 e.classname = "make_mapinfo";
58                 e.think = make_mapinfo_Think;
59                 e.nextthink = time;
60                 return;
61         }
62
63         if(argv(0) == "warp") if(argc == 2) if(cvar("g_campaign"))
64         {
65                 CampaignLevelWarp(stof(argv(1)));
66                 return;
67         }
68
69         if(argv(0) == "gotomap") if(argc == 2)
70         {
71                 print(GotoMap(argv(1)), "\n");
72                 return;
73         }
74
75         if(argv(0) == "adminmsg") if(argc == 3)
76         {
77                 entity client;
78                 float entno;
79                 entno = stof(argv(1));
80                 for(client = world; entno > 0; --entno, client = nextent(client))
81                         ;
82                 if(client.flags & FL_CLIENT)
83                 {
84                         centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3SERVER ADMIN:\n\n^7", argv(2)));
85                         sprint(client, strcat("\{1}\{13}^3SERVER ADMIN^7: ", argv(2), "\n"));
86                         print("Message sent to ", client.netname, "\n");
87                 }
88                 else
89                         print("Client not found\n");
90                 return;
91         }
92
93         print("Invalid command. For a list of supported commands, try sv_cmd help.\n");
94 }
95