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