Skip to content

Commit

Permalink
Fixed some weird issues caused by merges
Browse files Browse the repository at this point in the history
  • Loading branch information
OrsellGaming committed Nov 3, 2024
1 parent c54e072 commit 085a124
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions discordrpc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ void DiscordLog(int level, bool dev, const char* pMsgFormat, ...)
// Generates a footer with the player count with max allowed client count and also the current map name
std::string DefaultFooter()
{
// gpGlobals doesn't exist yet at certain situations, so return a blank string.
if (!gpGlobals) { return ""; }
// g_pGlobals doesn't exist yet at certain situations, so return a blank string.
if (!g_pGlobals) { return ""; }

std::string curplayercount = std::to_string(CURPLAYERCOUNT());
std::string maxplayercount = std::to_string(gpGlobals->maxClients);
std::string maxplayercount = std::to_string(g_pGlobals->maxClients);

std::string footer = std::string("Players: ") + curplayercount + "/" + maxplayercount + std::string(" || Current Map: ") + CURMAPNAME;

Expand Down
4 changes: 2 additions & 2 deletions globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class CPortal_Player;
#define P2MM_DISCORD_CONSOLE_COLOR_WARNING Color(255, 187, 28, 255)
//#define P2MM_DISCORD_CONSOLE_COLOR_NORMAL Color(88, 101, 242)

#define CURMAPNAME STRING(gpGlobals->mapname)
#define CURMAPNAME STRING(g_pGlobals->mapname)

// Even programs have to sleep sometimes
#if _WIN32
Expand Down Expand Up @@ -141,7 +141,7 @@ inline edict_t* INDEXENT(int iEdictNum)
// Get the current player count on the server
inline int CURPLAYERCOUNT() {
int playerCount = 0;
for (int i = 1; i < gpGlobals->maxClients; i++)
for (int i = 1; i < g_pGlobals->maxClients; i++)
{
IPlayerInfo* playerinfo = playerinfomanager->GetPlayerInfo(INDEXENT(i));
if (playerinfo)
Expand Down
8 changes: 4 additions & 4 deletions p2mm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ CON_COMMAND_F_COMPLETION(p2mm_startsession, "Starts up a P2:MM session with a re
p2mm_lastmap.SetValue(requestedMap);
engineClient->ExecuteClientCmd(std::string(mapString + "mp_coop_community_hub").c_str());

std::string initmapstr = std::string("Server has started with map: `" + requestedMap + "`");
std::string initmapstr = std::string("Server has started with map: `" + std::string(requestedMap) + "`");
discordIntegration.SendWebHookEmbed(std::string("Server"), initmapstr, EMBEDCOLOR_SERVER, false);
}
else
Expand All @@ -275,7 +275,7 @@ CON_COMMAND_F_COMPLETION(p2mm_startsession, "Starts up a P2:MM session with a re
P2MMLog(0, true, "requestedMap: \"%s\"", requestedMap);
engineClient->ExecuteClientCmd(std::string(mapString + requestedMap).c_str());

std::string initmapstr = std::string("Server has started with map: `" + requestedMap + "`");
std::string initmapstr = std::string("Server has started with map: `" + std::string(requestedMap) + "`");
discordIntegration.SendWebHookEmbed(std::string("Server"), initmapstr, EMBEDCOLOR_SERVER, false);
}
}
Expand Down Expand Up @@ -660,7 +660,7 @@ void CP2MMServerPlugin::LevelInit(char const* pMapName)
memset(&discordPresence, 0, sizeof(discordPresence));

std::string curplayercount = std::to_string(CURPLAYERCOUNT());
std::string maxplayercount = std::to_string(gpGlobals->maxClients);
std::string maxplayercount = std::to_string(g_pGlobals->maxClients);
std::string activityState = std::string("Players: (") + curplayercount + "/" + maxplayercount + ")";

discordPresence.state = activityState.c_str();
Expand Down Expand Up @@ -1102,7 +1102,7 @@ void CP2MMServerPlugin::ClientActive(edict_t* pEntity)
}

std::string curplayercount = std::to_string(CURPLAYERCOUNT());
std::string maxplayercount = std::to_string(gpGlobals->maxClients);
std::string maxplayercount = std::to_string(g_pGlobals->maxClients);
std::string activityState = std::string("Players: (") + curplayercount + "/" + maxplayercount + ")";

//DiscordRichPresence discordPresence;
Expand Down

0 comments on commit 085a124

Please sign in to comment.