1 string GotoMap(string m);
3 void make_mapinfo_Think()
5 if(MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 1))
7 print("Done rebuiling mapinfos.\n");
8 MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
13 self.think = make_mapinfo_Think;
14 self.nextthink = time;
18 void GameCommand(string command)
23 argc = tokenize(command);
25 if(argv(0) == "help" || argc == 0)
27 print("Usage: sv_cmd COMMAND..., where possible commands are:\n");
28 print(" adminmsg clientnumber \"message\"\n");
29 print(" teamstatus\n");
30 print(" printstats\n");
31 print(" make_mapinfo\n");
32 print(" gametype dm|ctf|...\n");
33 print(" savedb filename\n");
34 print(" dumpdb filename\n");
35 print(" loaddb filename\n");
36 GameCommand_Vote("help", world);
37 GameCommand_Ban("help");
38 GameCommand_Generic("help");
42 if(GameCommand_Vote(command, world))
45 if(GameCommand_Ban(command))
48 if(GameCommand_Generic(command))
51 if(argv(0) == "teamstatus")
53 PrintScoreboard(world);
57 if(argv(0) == "printstats")
63 if(argv(0) == "make_mapinfo")
67 e.classname = "make_mapinfo";
68 e.think = make_mapinfo_Think;
74 if(argv(0) == "warp") if(argc == 2) if(cvar("g_campaign"))
76 CampaignLevelWarp(stof(argv(1)));
80 if(argv(0) == "gotomap") if(argc == 2)
82 print(GotoMap(argv(1)), "\n");
87 if(argv(0) == "gametype") if(argc == 2)
92 t = MapInfo_Type_FromString(s);
93 tsave = MapInfo_CurrentGametype();
96 MapInfo_SwitchGameType(t);
97 MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
100 bprint("Game type successfully switched to ", s, "\n");
104 bprint("Cannot use this game type: no map for it found\n");
105 MapInfo_SwitchGameType(tsave);
106 MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), 0);
110 bprint("Game type switch to ", s, " failed: this type does not exist!\n");
115 if(argv(0) == "adminmsg") if(argc == 3)
117 entno = stof(argv(1));
119 if(entno <= maxclients)
120 client = edict_num(entno);
121 if(client.flags & FL_CLIENT)
123 centerprint_atprio(client, CENTERPRIO_ADMIN, strcat("^3SERVER ADMIN:\n\n^7", argv(2)));
124 sprint(client, strcat("\{1}\{13}^3SERVER ADMIN^7: ", argv(2), "\n"));
125 print("Message sent to ", client.netname, "\n");
128 print("Client not found\n");
132 if(argv(0) == "savedb") if(argc == 2)
134 db_save(ServerProgsDB, argv(1));
135 print("DB saved.\n");
139 if(argv(0) == "dumpdb") if(argc == 2)
141 db_dump(ServerProgsDB, argv(1));
142 print("DB dumped.\n");
146 if(argv(0) == "loaddb") if(argc == 2)
148 db_close(ServerProgsDB);
149 ServerProgsDB = db_load(argv(1));
150 print("DB loaded.\n");
153 if (argv(0) == "nospectators")
157 FOR_EACH_CLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> seconds time to become a player
159 if(plr.classname == "spectator" || plr.classname == "observer")
161 plr.spectatortime = time;
162 sprint(plr, strcat("^7You have to become a player within the next ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds, otherwise you will be kicked, because spectators aren't allowed at this time!\n"));
165 bprint(strcat("^7All spectators will be automatically kicked when not joining the game after ", ftos(cvar("g_maxplayers_spectator_blocktime")), " seconds!\n"));
168 if (argv(0) == "lockteams")
173 bprint("^1The teams are now locked.\n");
176 bprint("That command can only be used in a team-based gamemode.\n");
179 if (argv(0) == "unlockteams")
184 bprint("^1The teams are now unlocked.\n");
187 bprint("That command can only be used in a team-based gamemode.\n");
190 if (argv(0) == "movetoteam") if(argc == 3)
192 entno = stof(argv(1));
194 if(entno <= maxclients)
195 client = edict_num(entno);
196 if(client.flags & FL_CLIENT)
203 SV_ParseClientCommand(strcat("selectteam ", argv(2)));
208 print("Client not found\n");
212 print("Invalid command. For a list of supported commands, try sv_cmd help.\n");