add steamid function

This commit is contained in:
Huoji's
2023-10-10 21:15:42 +08:00
parent 4af3ba8ffb
commit 0266a48c88
2 changed files with 11 additions and 3 deletions

View File

@@ -56,9 +56,6 @@ void __fastcall hook_GameFrame(void* rcx, bool simulating, bool bFirstTick,
* true | game is ticking * true | game is ticking
* false | game is not ticking * false | game is not ticking
*/ */
if (global::GlobalVars == nullptr) {
global::GlobalVars = GetGameGlobals();
}
if (global::GlobalVars != nullptr) { if (global::GlobalVars != nullptr) {
if (simulating && global::HasTicked) { if (simulating && global::HasTicked) {
global::m_flUniversalTime += global::m_flUniversalTime +=

View File

@@ -714,6 +714,16 @@ auto luaApi_RunServerCommand(lua_State* luaVm) -> int {
lua_pop(luaVm, 1); lua_pop(luaVm, 1);
return 0; return 0;
} }
auto luaApi_GetPlayerSteamId(lua_State* luaVm) -> int {
const auto playerIndex = lua_tointeger(luaVm, 1);
uint64_t steamid;
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
steamid = playerController->m_steamID();
});
lua_pop(luaVm, 1);
lua_pushinteger(luaVm, steamid);
return 1;
}
auto luaApi_KickPlayer(lua_State* luaVm) -> int { auto luaApi_KickPlayer(lua_State* luaVm) -> int {
const auto playerIndex = lua_tointeger(luaVm, 1); const auto playerIndex = lua_tointeger(luaVm, 1);
const auto reason = lua_tostring(luaVm, 2); const auto reason = lua_tostring(luaVm, 2);
@@ -827,6 +837,7 @@ auto initFunciton(lua_State* luaVm) -> void {
lua_register(luaVm, "luaApi_KickPlayer", luaApi_KickPlayer); lua_register(luaVm, "luaApi_KickPlayer", luaApi_KickPlayer);
lua_register(luaVm, "luaApi_HttpGet", luaApi_HttpGet); lua_register(luaVm, "luaApi_HttpGet", luaApi_HttpGet);
lua_register(luaVm, "luaApi_HttpPost", luaApi_HttpPost); lua_register(luaVm, "luaApi_HttpPost", luaApi_HttpPost);
lua_register(luaVm, "luaApi_GetPlayerSteamId", luaApi_GetPlayerSteamId);
luabridge::getGlobalNamespace(luaVm) luabridge::getGlobalNamespace(luaVm)
.beginClass<_luaApi_WeaponInfo>("WeaponInfo") .beginClass<_luaApi_WeaponInfo>("WeaponInfo")