Nuclide
Software Development Kit for id Technology (BETA)
Loading...
Searching...
No Matches
map.h
1
3void
4Map_NewGame(int skillValue)
5{
6 if (fileExists("cfg/chapter1.cfg")) {
7 localcmd("set sv_background 0\nset sv_playerslots 1\nset maxclients 1\nset deathmatch 0\nset coop 0\nset g_gametype singleplayer\nexec cfg/chapter1.cfg");
8 } else {
9 localcmd( sprintf("set sv_background 0\nset skill %i\nset sv_playerslots 1\nset maxclients 1\nset deathmatch 0\nset coop 0\nset g_gametype singleplayer\n%s", skillValue, GameLibrary_GetInfo(GAMEINFO_STARTMAP)) );
10 }
11
13 switch (skillValue) {
14 case 1i:
15 RichPresence_Set("status", "Singleplayer: Normal");
16 break;
17 case 2i:
18 RichPresence_Set("status", "Singleplayer: Medium");
19 break;
20 case 3i:
21 RichPresence_Set("status", "Singleplayer: Hard");
22 break;
23 }
24}
25
27void
28Map_Training(void)
29{
31 RichPresence_Set("status", "Training");
32 localcmd( sprintf("set sv_background 0\nset maxplayers 1\nset deathmatch 0\nset coop 0\nset skill 2\nset g_gametype singleplayer\n%s", GameLibrary_GetInfo(GAMEINFO_TRAININGMAP)) );
33}
34
36void
37Map_SpawnServer(string hostName, string mapName, int maxPlayers, string gameType, string passWord)
38{
39 localcmd( sprintf( "set sv_background 0\nhostname %s\n", hostName ) );
40 localcmd( sprintf( "set maxplayers %i\n", maxPlayers ) );
41 localcmd( sprintf( "set sv_password %s\n", passWord ) );
42 localcmd( sprintf( "set g_gametype %s\n", gameType ) );
43 localcmd( sprintf( "map %s\n", mapName ) );
45 RichPresence_Set("status", sprintf("Multiplayer: %s", mapName));
46}
__variant GameLibrary_GetInfo(gameInfo_t)
Retrieves fields for the currently running game.
Definition gamelibrary.qc:796
@ GAMEINFO_STARTMAP
(string) The command for starting a new game.
Definition gamelibrary.h:71
@ GAMEINFO_TRAININGMAP
(string) The command for starting the training.
Definition gamelibrary.h:72
void RichPresence_Set(string strKey, string strValue)
Sets a rich-presence key to the desired value.
Definition richpresence.qc:32
void RichPresence_Clear(void)
Clears the current rich-presence status.
Definition richpresence.qc:52