mirror of
https://github.com/fedddddd/iw5-gsc-utils.git
synced 2025-07-03 17:51:55 +00:00
Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
9ca07aca55 | |||
10b45027d0 | |||
d5c0063fee
|
|||
31920b0692 | |||
89e4edc00b | |||
379a21ff7e |
@ -416,6 +416,22 @@ namespace gsc
|
|||||||
return {};
|
return {};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
method::add("isbot", [](const game::scr_entref_t ent, const function_args& args) -> scripting::script_value
|
||||||
|
{
|
||||||
|
if (ent.classnum != 0)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("Invalid entity");
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto client = ent.entnum;
|
||||||
|
if (game::g_entities[client].client == nullptr)
|
||||||
|
{
|
||||||
|
throw std::runtime_error("entity is not a player");
|
||||||
|
}
|
||||||
|
|
||||||
|
return game::svs_clients[client].bIsTestClient;
|
||||||
|
});
|
||||||
|
|
||||||
utils::hook::jump(0x56C8EB, call_builtin_stub);
|
utils::hook::jump(0x56C8EB, call_builtin_stub);
|
||||||
utils::hook::jump(0x56CBDC, call_builtin_method_stub);
|
utils::hook::jump(0x56CBDC, call_builtin_method_stub);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace notifies
|
|||||||
const auto entity_id = game::Scr_GetEntityId(clientNum, 0);
|
const auto entity_id = game::Scr_GetEntityId(clientNum, 0);
|
||||||
const auto result = callback(entity_id, {message, cmd == "say_team"s});
|
const auto result = callback(entity_id, {message, cmd == "say_team"s});
|
||||||
|
|
||||||
if (result.is<int>())
|
if (result.is<int>() && !hidden)
|
||||||
{
|
{
|
||||||
hidden = result.as<int>() == 0;
|
hidden = result.as<int>() == 0;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,6 @@ namespace scripting
|
|||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
shutdown_callbacks = {};
|
|
||||||
g_shutdown_game_hook.invoke<void>(free_scripts);
|
g_shutdown_game_hook.invoke<void>(free_scripts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,12 +13,17 @@ namespace userinfo
|
|||||||
{
|
{
|
||||||
utils::hook::detour sv_getuserinfo_hook;
|
utils::hook::detour sv_getuserinfo_hook;
|
||||||
|
|
||||||
userinfo_map userinfo_to_map(const std::string& userinfo)
|
userinfo_map userinfo_to_map(std::string userinfo)
|
||||||
{
|
{
|
||||||
userinfo_map map;
|
userinfo_map map{};
|
||||||
const auto args = utils::string::split(userinfo, '\\');
|
|
||||||
|
|
||||||
for (auto i = 1; i < args.size() - 1; i += 2)
|
if (userinfo[0] == '\\')
|
||||||
|
{
|
||||||
|
userinfo = userinfo.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto args = utils::string::split(userinfo, '\\');
|
||||||
|
for (size_t i = 0; !args.empty() && i < (args.size() - 1); i += 2)
|
||||||
{
|
{
|
||||||
map[args[i]] = args[i + 1];
|
map[args[i]] = args[i + 1];
|
||||||
}
|
}
|
||||||
@ -28,7 +33,7 @@ namespace userinfo
|
|||||||
|
|
||||||
std::string map_to_userinfo(const userinfo_map& map)
|
std::string map_to_userinfo(const userinfo_map& map)
|
||||||
{
|
{
|
||||||
std::string buffer;
|
std::string buffer{};
|
||||||
|
|
||||||
for (const auto& value : map)
|
for (const auto& value : map)
|
||||||
{
|
{
|
||||||
@ -43,9 +48,8 @@ namespace userinfo
|
|||||||
|
|
||||||
void sv_getuserinfo_stub(int index, char* buffer, int bufferSize)
|
void sv_getuserinfo_stub(int index, char* buffer, int bufferSize)
|
||||||
{
|
{
|
||||||
char _buffer[1024];
|
sv_getuserinfo_hook.invoke<void>(index, buffer, bufferSize);
|
||||||
sv_getuserinfo_hook.invoke<void>(index, _buffer, 1024);
|
auto map = userinfo_to_map(buffer);
|
||||||
auto map = userinfo_to_map(_buffer);
|
|
||||||
|
|
||||||
if (userinfo_overrides.find(index) == userinfo_overrides.end())
|
if (userinfo_overrides.find(index) == userinfo_overrides.end())
|
||||||
{
|
{
|
||||||
|
@ -5,8 +5,8 @@ BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserv
|
|||||||
{
|
{
|
||||||
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
if (ul_reason_for_call == DLL_PROCESS_ATTACH)
|
||||||
{
|
{
|
||||||
const auto value = *reinterpret_cast<DWORD*>(0x20900000);
|
const auto value = *reinterpret_cast<DWORD*>(0x21000000);
|
||||||
if (value != 0xF0681B6A)
|
if (value != 0x7AC6)
|
||||||
{
|
{
|
||||||
MessageBoxA(NULL,
|
MessageBoxA(NULL,
|
||||||
"This version of iw5-gsc-utils is outdated.\n" \
|
"This version of iw5-gsc-utils is outdated.\n" \
|
||||||
|
@ -60,13 +60,11 @@ namespace scripting
|
|||||||
array::array()
|
array::array()
|
||||||
{
|
{
|
||||||
this->id_ = make_array();
|
this->id_ = make_array();
|
||||||
this->add();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
array::array(std::vector<script_value> values)
|
array::array(std::vector<script_value> values)
|
||||||
{
|
{
|
||||||
this->id_ = make_array();
|
this->id_ = make_array();
|
||||||
this->add();
|
|
||||||
|
|
||||||
for (const auto& value : values)
|
for (const auto& value : values)
|
||||||
{
|
{
|
||||||
@ -77,7 +75,6 @@ namespace scripting
|
|||||||
array::array(std::unordered_map<std::string, script_value> values)
|
array::array(std::unordered_map<std::string, script_value> values)
|
||||||
{
|
{
|
||||||
this->id_ = make_array();
|
this->id_ = make_array();
|
||||||
this->add();
|
|
||||||
|
|
||||||
for (const auto& value : values)
|
for (const auto& value : values)
|
||||||
{
|
{
|
||||||
|
@ -327,4 +327,15 @@ namespace game
|
|||||||
int flags;
|
int flags;
|
||||||
char __pad2[0xEC];
|
char __pad2[0xEC];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct client_s
|
||||||
|
{
|
||||||
|
char __pad0[0x41CB2];
|
||||||
|
unsigned __int16 scriptId; // 269490
|
||||||
|
int bIsTestClient; // 269492
|
||||||
|
int serverId; // 269496
|
||||||
|
char __pad1[0x369DC];
|
||||||
|
};
|
||||||
|
|
||||||
|
static_assert(sizeof(client_s) == 0x78698);
|
||||||
}
|
}
|
@ -79,13 +79,15 @@ namespace game
|
|||||||
WEAK symbol<gentity_s> g_entities{0x1A66E28};
|
WEAK symbol<gentity_s> g_entities{0x1A66E28};
|
||||||
WEAK symbol<unsigned int> levelEntityId{0x208E1A4};
|
WEAK symbol<unsigned int> levelEntityId{0x208E1A4};
|
||||||
|
|
||||||
|
WEAK symbol<client_s> svs_clients{0x4B5CF90};
|
||||||
|
|
||||||
namespace plutonium
|
namespace plutonium
|
||||||
{
|
{
|
||||||
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> function_map_rev{0x20693038};
|
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> function_map_rev{0x206964D0};
|
||||||
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> method_map_rev{0x20693058};
|
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> method_map_rev{0x206964F0};
|
||||||
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> token_map_rev{0x20693098};
|
WEAK symbol<std::unordered_map<std::string, std::uint16_t>> token_map_rev{0x20696530};
|
||||||
WEAK symbol<int(const char* fmt, ...)> printf{0x208879B0};
|
WEAK symbol<int(const char* fmt, ...)> printf{0x20887840};
|
||||||
WEAK symbol<void*> function_table{0x2068BCF0};
|
WEAK symbol<void*> function_table{0x2068F210};
|
||||||
WEAK symbol<void*> method_table{0x2068C4C0};
|
WEAK symbol<void*> method_table{0x2068F9E0};
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user