Fixes for prev commit
This commit is contained in:
parent
b62341284f
commit
efa9d8ecb6
@ -117,7 +117,7 @@
|
||||
"Config": "Config",
|
||||
"CopyrightDisclaimer": "Copyright Grinch_ 2019-2022. All rights reserved.",
|
||||
"Credits": "Credits",
|
||||
"DiscordRPC" : "Discord rich presence",
|
||||
"DiscordRPC": "Discord rich presence",
|
||||
"DiscordServer": "Discord server",
|
||||
"FixVehKey": "Fix current vehicle",
|
||||
"FlipVehKey": "Flip current vehicle",
|
||||
@ -276,6 +276,17 @@
|
||||
"WantedLevel": "Wanted level",
|
||||
"WorkSkinOnly": "Only contains the skins that works"
|
||||
},
|
||||
"RPC": {
|
||||
"BrowsingCheatMenu": "Browsing CheatMenu",
|
||||
"Busted": "Busted!",
|
||||
"DoingMission": "Doing {}",
|
||||
"Driving": "Driving",
|
||||
"In": "in",
|
||||
"InsideMenus": "Inside Menus",
|
||||
"PlayingFor": "Playing for {}:{}:{}",
|
||||
"Walking": "Walking",
|
||||
"Wasted": "Wasted!"
|
||||
},
|
||||
"Teleport": {
|
||||
"AddLocation": "Add location",
|
||||
"Coordinates": "Coordinates",
|
||||
@ -606,15 +617,5 @@
|
||||
"VehiclePage": "Vehicle",
|
||||
"VisualPage": "Visual",
|
||||
"WeaponPage": "Weapon"
|
||||
},
|
||||
"RPC" :
|
||||
{
|
||||
"Walking" : "Walking",
|
||||
"Driving" : "Driving",
|
||||
"In" : "in",
|
||||
"DoingMission" : "Doing missions",
|
||||
"BrowsingCheatMenu" : "Browsing CheatMenu",
|
||||
"InsideMenus" : "Inside Menus",
|
||||
"PlayingFor" : "Playing for {}:{}:{}"
|
||||
}
|
||||
}
|
29
src/rpc.cpp
29
src/rpc.cpp
@ -24,7 +24,7 @@ void RPC::Init()
|
||||
|
||||
void RPC::Process()
|
||||
{
|
||||
if (!Menu::m_bDiscordRPC)
|
||||
if (!(Menu::m_bDiscordRPC && bInit))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -40,7 +40,12 @@ void RPC::Process()
|
||||
if (pPed)
|
||||
{
|
||||
size_t curTimer = CTimer::m_snTimeInMilliseconds;
|
||||
|
||||
#ifdef GTASA
|
||||
size_t wantedLevel = pPed->GetWantedLevel();
|
||||
#else
|
||||
size_t wantedLevel = pPed->m_pWanted->m_nWantedLevel;
|
||||
#endif
|
||||
if (wantedLevel > 0)
|
||||
{
|
||||
detailsText = std::format("{}: ", TEXT("Player.WantedLevel"));
|
||||
@ -67,27 +72,27 @@ void RPC::Process()
|
||||
smallImgText = std::format("{} {} {}", TEXT("RPC.Walking"), TEXT("RPC.In"), Util::GetLocationName(&pPed->GetPosition()));
|
||||
}
|
||||
|
||||
size_t seconds = curTimer - startTime;
|
||||
size_t seconds = (curTimer - startTime) / 1000;
|
||||
size_t minutes = (seconds / 60) % 60;
|
||||
size_t hours = (minutes / 60) % 60;
|
||||
stateText = std::format(TEXT("RPC.PlayingFor"), hours, minutes, seconds);
|
||||
|
||||
if (BY_GAME(Util::IsOnMission(), false, false))
|
||||
{
|
||||
stateText = TEXT("RPC.DoingMission");
|
||||
}
|
||||
|
||||
if (CheatMenu::IsMenuShown())
|
||||
{
|
||||
stateText = TEXT("RPC.BrowsingCheatMenu");
|
||||
}
|
||||
|
||||
if (BY_GAME(FrontEndMenuManager.m_bMenuActive, FrontendMenuManager.m_bMenuVisible, FrontEndMenuManager.m_bMenuActive))
|
||||
if (Command<Commands::IS_CHAR_DEAD>(CPools::GetPedRef(pPed)))
|
||||
{
|
||||
stateText = TEXT("RPC.InsideMenus");
|
||||
stateText = TEXT("RPC.Wasted");
|
||||
}
|
||||
|
||||
largeImgText = std::format("{}: {} / {} {}: {} / {}", TEXT("Player.Armour"), pPed->m_fArmour, BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100), TEXT("Player.Health"), pPed->m_fHealth, BY_GAME(pPed->m_fMaxHealth, 100, 100));
|
||||
if (BY_GAME(pPed->m_nPedFlags.bIsBeingArrested, false, false))
|
||||
{
|
||||
stateText = TEXT("RPC.Busted");
|
||||
}
|
||||
|
||||
largeImgText = std::format("{}: {} / {} {}: {} / {}", TEXT("Player.Armour"), pPed->m_fArmour, BY_GAME(pInfo->m_nMaxArmour, pInfo->m_nMaxArmour, 100), TEXT("Player.Health"), int(pPed->m_fHealth), BY_GAME(int(pPed->m_fMaxHealth), 100, 100));
|
||||
largeImg = std::format("{}{}", BY_GAME("sa", "vc", "3"), curImage);
|
||||
|
||||
discord::Activity activity{};
|
||||
@ -109,11 +114,11 @@ void RPC::Process()
|
||||
});
|
||||
pCore->RunCallbacks();
|
||||
|
||||
if (curTimer - timer > 10000)
|
||||
if (curTimer - timer > 60000)
|
||||
{
|
||||
curImage++;
|
||||
|
||||
if (curImage > totalLargeImages)
|
||||
if (curImage > 5) // Must upload images to discord servers
|
||||
{
|
||||
curImage = 1;
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ class RPC
|
||||
private:
|
||||
static inline discord::Core* pCore;
|
||||
static inline bool bInit = false;
|
||||
static inline size_t totalLargeImages = 5;
|
||||
|
||||
public:
|
||||
RPC() = delete;
|
||||
|
@ -30,12 +30,16 @@ workspace "CheatMenu"
|
||||
location "../build"
|
||||
targetdir "../build/bin"
|
||||
|
||||
libdirs {
|
||||
PSDK_DIR .. "/output/lib",
|
||||
"../depend/lib"
|
||||
}
|
||||
|
||||
links {
|
||||
"d3d9",
|
||||
"d3d11",
|
||||
"Pdh",
|
||||
"urlmon",
|
||||
"depend",
|
||||
"discord_game_sdk"
|
||||
}
|
||||
|
||||
@ -48,10 +52,6 @@ project "depend"
|
||||
"../depend/**.c",
|
||||
"../depend/**.cpp"
|
||||
}
|
||||
libdirs {
|
||||
PSDK_DIR .. "/output/lib",
|
||||
"../depend/lib"
|
||||
}
|
||||
|
||||
filter "configurations:Debug"
|
||||
defines { "DEBUG", "IS_PLATFORM_WIN" }
|
||||
@ -109,7 +109,9 @@ project "CheatMenuIII"
|
||||
"../src/filehandler.cpp",
|
||||
"../src/dllmain.cpp",
|
||||
"../src/locale.h",
|
||||
"../src/locale.cpp"
|
||||
"../src/locale.cpp",
|
||||
"../src/rpc.h",
|
||||
"../src/rpc.cpp"
|
||||
}
|
||||
includedirs {
|
||||
PSDK_DIR .. "/plugin_III/",
|
||||
@ -192,7 +194,9 @@ project "CheatMenuVC"
|
||||
"../src/hotkeys.cpp",
|
||||
"../src/dllmain.cpp",
|
||||
"../src/locale.h",
|
||||
"../src/locale.cpp"
|
||||
"../src/locale.cpp",
|
||||
"../src/rpc.h",
|
||||
"../src/rpc.cpp"
|
||||
}
|
||||
includedirs {
|
||||
PSDK_DIR .. "/plugin_vc/",
|
||||
|
Loading…
Reference in New Issue
Block a user