区分死斗和正常respawn
This commit is contained in:
@@ -150,6 +150,7 @@
|
|||||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ uint64_t MaxPlayerNumsPtr;
|
|||||||
HashFunction_t FnServerHashFunction;
|
HashFunction_t FnServerHashFunction;
|
||||||
StateChanged_t FnStateChanged;
|
StateChanged_t FnStateChanged;
|
||||||
NetworkStateChanged_t FnNetworkStateChanged;
|
NetworkStateChanged_t FnNetworkStateChanged;
|
||||||
RespawnPlayer_t FnRespawnPlayer;
|
RespawnPlayerInDeathMatch_t FnRespawnPlayerInDeathMatch;
|
||||||
GiveNamedItem_t FnGiveNamedItem;
|
GiveNamedItem_t FnGiveNamedItem;
|
||||||
EntityRemove_t FnEntityRemove;
|
EntityRemove_t FnEntityRemove;
|
||||||
UTIL_SayTextFilter_t FnUTIL_SayTextFilter;
|
UTIL_SayTextFilter_t FnUTIL_SayTextFilter;
|
||||||
@@ -71,7 +71,7 @@ auto Init() -> bool {
|
|||||||
server.FindPattern(pattern_CreateCCSGameRulesInterFacePtr)
|
server.FindPattern(pattern_CreateCCSGameRulesInterFacePtr)
|
||||||
.ToAbsolute(3, 0)
|
.ToAbsolute(3, 0)
|
||||||
.Get(CCSGameRulesInterFacePtr);
|
.Get(CCSGameRulesInterFacePtr);
|
||||||
server.FindPattern(pattern_FnRespawnPlayer).Get(FnRespawnPlayer);
|
server.FindPattern(pattern_FnRespawnPlayerInDeathMatch).Get(FnRespawnPlayerInDeathMatch);
|
||||||
server.FindPattern(pattern_FnEntityRemove).Get(FnEntityRemove);
|
server.FindPattern(pattern_FnEntityRemove).Get(FnEntityRemove);
|
||||||
server.FindPattern(pattern_FnGiveNamedItemPtr).Get(FnGiveNamedItem);
|
server.FindPattern(pattern_FnGiveNamedItemPtr).Get(FnGiveNamedItem);
|
||||||
server.FindPattern(pattern_fnHost_SayPtr).Get(Host_SayPtr);
|
server.FindPattern(pattern_fnHost_SayPtr).Get(Host_SayPtr);
|
||||||
@@ -123,7 +123,7 @@ auto Init() -> bool {
|
|||||||
LOG("[huoji]FnNetworkStateChanged : %llx \n", FnNetworkStateChanged);
|
LOG("[huoji]FnNetworkStateChanged : %llx \n", FnNetworkStateChanged);
|
||||||
LOG("[huoji]FnServerHashFunction : %llx \n", FnServerHashFunction);
|
LOG("[huoji]FnServerHashFunction : %llx \n", FnServerHashFunction);
|
||||||
LOG("[huoji]FnStateChanged : %llx \n", FnStateChanged);
|
LOG("[huoji]FnStateChanged : %llx \n", FnStateChanged);
|
||||||
LOG("[huoji]FnRespawnPlayer : %llx \n", FnRespawnPlayer);
|
LOG("[huoji]FnRespawnPlayerInDeathMatch : %llx \n", FnRespawnPlayerInDeathMatch);
|
||||||
LOG("[huoji]FnGiveNamedItem : %llx \n", FnGiveNamedItem);
|
LOG("[huoji]FnGiveNamedItem : %llx \n", FnGiveNamedItem);
|
||||||
LOG("[huoji]FnClientPrint : %llx \n", FnClientPrint);
|
LOG("[huoji]FnClientPrint : %llx \n", FnClientPrint);
|
||||||
LOG("[huoji]FnUTIL_ClientPrintAll : %llx \n", FnUTIL_ClientPrintAll);
|
LOG("[huoji]FnUTIL_ClientPrintAll : %llx \n", FnUTIL_ClientPrintAll);
|
||||||
@@ -154,7 +154,7 @@ auto Init() -> bool {
|
|||||||
0, NULL);
|
0, NULL);
|
||||||
// LOG("FnServerHashFunction: %llx \n", FnServerHashFunction("here",
|
// LOG("FnServerHashFunction: %llx \n", FnServerHashFunction("here",
|
||||||
// sizeof("here") - 1, 0x31415926));
|
// sizeof("here") - 1, 0x31415926));
|
||||||
return FnCCSWeaponBase_Spawn && FnEntityRemove && FnRespawnPlayer && FnGiveNamedItem &&
|
return FnCCSWeaponBase_Spawn && FnEntityRemove && FnRespawnPlayerInDeathMatch && FnGiveNamedItem &&
|
||||||
FnServerHashFunction && Host_SayPtr && InterFaces::IVEngineServer &&
|
FnServerHashFunction && Host_SayPtr && InterFaces::IVEngineServer &&
|
||||||
InterFaces::GameResourceServiceServer &&
|
InterFaces::GameResourceServiceServer &&
|
||||||
InterFaces::IServerGameClient && InterFaces::GameEventManager &&
|
InterFaces::IServerGameClient && InterFaces::GameEventManager &&
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ typedef void(__fastcall* StateChanged_t)(void* networkTransmitComponent,
|
|||||||
typedef void(__fastcall* NetworkStateChanged_t)(uintptr_t chainEntity,
|
typedef void(__fastcall* NetworkStateChanged_t)(uintptr_t chainEntity,
|
||||||
uintptr_t offset, uintptr_t a3);
|
uintptr_t offset, uintptr_t a3);
|
||||||
typedef void*(__fastcall* CreateGameRuleInterFace_t)();
|
typedef void*(__fastcall* CreateGameRuleInterFace_t)();
|
||||||
typedef bool(__fastcall* RespawnPlayer_t)(CCSPlayerPawn* player);
|
typedef bool(__fastcall* RespawnPlayerInDeathMatch_t)(CCSPlayerPawn* player);
|
||||||
typedef void(__fastcall* GiveNamedItem_t)(void* itemService,
|
typedef void(__fastcall* GiveNamedItem_t)(void* itemService,
|
||||||
const char* pchName, void* iSubType,
|
const char* pchName, void* iSubType,
|
||||||
void* pScriptItem, void* a5,
|
void* pScriptItem, void* a5,
|
||||||
@@ -26,7 +26,6 @@ typedef void*(__fastcall* UTIL_SayTextFilter_t)(IRecipientFilter&, const char*,
|
|||||||
typedef void(__fastcall* UTIL_ClientPrintAll_t)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4);
|
typedef void(__fastcall* UTIL_ClientPrintAll_t)(int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4);
|
||||||
typedef void(__fastcall* ClientPrint_t)(CCSPlayerController* player, int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4);
|
typedef void(__fastcall* ClientPrint_t)(CCSPlayerController* player, int msg_dest, const char* msg_name, const char* param1, const char* param2, const char* param3, const char* param4);
|
||||||
typedef void(__fastcall* CCSWeaponBase_Spawn_t)(CBaseEntity*, void*);
|
typedef void(__fastcall* CCSWeaponBase_Spawn_t)(CBaseEntity*, void*);
|
||||||
|
|
||||||
class CSchemaSystem;
|
class CSchemaSystem;
|
||||||
class CGameResourceService;
|
class CGameResourceService;
|
||||||
class CLocalize;
|
class CLocalize;
|
||||||
@@ -79,6 +78,8 @@ static const auto pattern_CreateCCSGameRulesInterFacePtr = THE_GAME_SIG(
|
|||||||
"?? ?? 4C 8D ?? ?? ?? 49 8B ?? ?? 49 8B ?? ?? 49 8B ?? ?? 49 8B E3 41 5F "
|
"?? ?? 4C 8D ?? ?? ?? 49 8B ?? ?? 49 8B ?? ?? 49 8B ?? ?? 49 8B E3 41 5F "
|
||||||
"41 5E 5F C3");
|
"41 5E 5F C3");
|
||||||
static const auto pattern_FnRespawnPlayer = THE_GAME_SIG(
|
static const auto pattern_FnRespawnPlayer = THE_GAME_SIG(
|
||||||
|
"48 89 ?? ?? ?? 48 89 ?? ?? ?? 56 48 ?? ?? ?? ?? ?? ?? 48 8B DA 48 8B E9 48 85 D2 0F ?? ?? ?? ?? ?? 48 8B 02 48 8B CA FF ?? ?? ?? ?? ?? 84 C0 0F ?? ?? ?? ?? ?? 83 BB ?? ?? ?? ?? ?? 0F ?? ?? ?? ?? ??");
|
||||||
|
static const auto pattern_FnRespawnPlayerInDeathMatch = THE_GAME_SIG(
|
||||||
"48 89 ?? ?? ?? 57 48 ?? ?? ?? 48 8D ?? ?? ?? 48 8B F9 E8 ?? ?? ?? ?? 83 "
|
"48 89 ?? ?? ?? 57 48 ?? ?? ?? 48 8D ?? ?? ?? 48 8B F9 E8 ?? ?? ?? ?? 83 "
|
||||||
"?? ?? 74 ?? 48 ?? ?? ?? ?? ?? ?? 48 8B CF 48 8B 10 48 8B ?? ?? ?? ?? ?? "
|
"?? ?? 74 ?? 48 ?? ?? ?? ?? ?? ?? 48 8B CF 48 8B 10 48 8B ?? ?? ?? ?? ?? "
|
||||||
"48 8D ?? ?? ?? E8 ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ??");
|
"48 8D ?? ?? ?? E8 ?? ?? ?? ?? 48 ?? ?? ?? ?? ?? ??");
|
||||||
@@ -102,7 +103,7 @@ extern uint64_t MaxPlayerNumsPtr;
|
|||||||
extern HashFunction_t FnServerHashFunction;
|
extern HashFunction_t FnServerHashFunction;
|
||||||
extern StateChanged_t FnStateChanged;
|
extern StateChanged_t FnStateChanged;
|
||||||
extern NetworkStateChanged_t FnNetworkStateChanged;
|
extern NetworkStateChanged_t FnNetworkStateChanged;
|
||||||
extern RespawnPlayer_t FnRespawnPlayer;
|
extern RespawnPlayerInDeathMatch_t FnRespawnPlayerInDeathMatch;
|
||||||
extern GiveNamedItem_t FnGiveNamedItem;
|
extern GiveNamedItem_t FnGiveNamedItem;
|
||||||
extern EntityRemove_t FnEntityRemove;
|
extern EntityRemove_t FnEntityRemove;
|
||||||
extern UTIL_SayTextFilter_t FnUTIL_SayTextFilter;
|
extern UTIL_SayTextFilter_t FnUTIL_SayTextFilter;
|
||||||
|
|||||||
@@ -111,6 +111,7 @@ auto luaApi_SetPlayerCurrentWeaponAmmo(lua_State* luaVm) -> int {
|
|||||||
lua_pop(luaVm, 3);
|
lua_pop(luaVm, 3);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
auto luaApi_RespawnPlayer(lua_State* luaVm) -> int {
|
auto luaApi_RespawnPlayer(lua_State* luaVm) -> int {
|
||||||
const auto playerIndex = lua_tointeger(luaVm, 1);
|
const auto playerIndex = lua_tointeger(luaVm, 1);
|
||||||
int playerArmorValue = 0;
|
int playerArmorValue = 0;
|
||||||
@@ -120,7 +121,20 @@ auto luaApi_RespawnPlayer(lua_State* luaVm) -> int {
|
|||||||
if (playerPawn == nullptr) {
|
if (playerPawn == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Offset::FnRespawnPlayer(playerPawn);
|
Offset::InterFaces::CCSGameRulesInterFace->PlayerRespawn(playerPawn);
|
||||||
|
});
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
auto luaApi_RespawnPlayerInDeathMatch(lua_State* luaVm) -> int {
|
||||||
|
const auto playerIndex = lua_tointeger(luaVm, 1);
|
||||||
|
int playerArmorValue = 0;
|
||||||
|
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
|
||||||
|
const auto playerPawn =
|
||||||
|
playerController->m_hPawn().Get<CCSPlayerPawn>();
|
||||||
|
if (playerPawn == nullptr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Offset::FnRespawnPlayerInDeathMatch(playerPawn);
|
||||||
});
|
});
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -753,6 +767,7 @@ auto initFunciton(lua_State* luaVm) -> void {
|
|||||||
lua_register(luaVm, "luaApi_SetPlayerArmorValue",
|
lua_register(luaVm, "luaApi_SetPlayerArmorValue",
|
||||||
luaApi_SetPlayerArmorValue);
|
luaApi_SetPlayerArmorValue);
|
||||||
lua_register(luaVm, "luaApi_RespawnPlayer", luaApi_RespawnPlayer);
|
lua_register(luaVm, "luaApi_RespawnPlayer", luaApi_RespawnPlayer);
|
||||||
|
lua_register(luaVm, "luaApi_RespawnPlayerInDeathMatch", luaApi_RespawnPlayerInDeathMatch);
|
||||||
lua_register(luaVm, "luaApi_CreateTimer", luaApi_CreateTimer);
|
lua_register(luaVm, "luaApi_CreateTimer", luaApi_CreateTimer);
|
||||||
lua_register(luaVm, "luaApi_CreateTickRunFunction",
|
lua_register(luaVm, "luaApi_CreateTickRunFunction",
|
||||||
luaApi_CreateTickRunFunction);
|
luaApi_CreateTickRunFunction);
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
#include <document.h>
|
#include <document.h>
|
||||||
struct _Config
|
struct _Config
|
||||||
{
|
{
|
||||||
|
std::string dll;
|
||||||
std::string path;
|
std::string path;
|
||||||
std::string command;
|
std::string command;
|
||||||
};
|
};
|
||||||
@@ -32,9 +33,10 @@ namespace Config {
|
|||||||
for (rapidjson::SizeType i = 0; i < servers.Size(); i++) { // Uses SizeType instead of size_t
|
for (rapidjson::SizeType i = 0; i < servers.Size(); i++) { // Uses SizeType instead of size_t
|
||||||
const rapidjson::Value& server = servers[i];
|
const rapidjson::Value& server = servers[i];
|
||||||
assert(server.IsObject()); // Each server should be an object.
|
assert(server.IsObject()); // Each server should be an object.
|
||||||
if (server.HasMember("path") && server["path"].IsString() && server.HasMember("command") && server["command"].IsString())
|
if (server.HasMember("path") && server["path"].IsString() && server.HasMember("command") && server["command"].IsString() && server.HasMember("dll") && server["dll"].IsString())
|
||||||
{
|
{
|
||||||
configs.push_back(_Config{
|
configs.push_back(_Config{
|
||||||
|
.dll = server["dll"].GetString(),
|
||||||
.path = server["path"].GetString(),
|
.path = server["path"].GetString(),
|
||||||
.command = server["command"].GetString()
|
.command = server["command"].GetString()
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -134,6 +134,7 @@
|
|||||||
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<ConformanceMode>true</ConformanceMode>
|
<ConformanceMode>true</ConformanceMode>
|
||||||
<LanguageStandard>stdcpplatest</LanguageStandard>
|
<LanguageStandard>stdcpplatest</LanguageStandard>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
|||||||
Reference in New Issue
Block a user