Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
add steamid function
Browse files Browse the repository at this point in the history
  • Loading branch information
huoji120 committed Oct 10, 2023
1 parent 4af3ba8 commit 0266a48
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 0 additions & 3 deletions csgo2/hooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ void __fastcall hook_GameFrame(void* rcx, bool simulating, bool bFirstTick,
* true | game is ticking
* false | game is not ticking
*/
if (global::GlobalVars == nullptr) {
global::GlobalVars = GetGameGlobals();
}
if (global::GlobalVars != nullptr) {
if (simulating && global::HasTicked) {
global::m_flUniversalTime +=
Expand Down
11 changes: 11 additions & 0 deletions csgo2/script_apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,16 @@ auto luaApi_RunServerCommand(lua_State* luaVm) -> int {
lua_pop(luaVm, 1);
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 {
const auto playerIndex = lua_tointeger(luaVm, 1);
const auto reason = lua_tostring(luaVm, 2);
Expand Down Expand Up @@ -827,6 +837,7 @@ auto initFunciton(lua_State* luaVm) -> void {
lua_register(luaVm, "luaApi_KickPlayer", luaApi_KickPlayer);
lua_register(luaVm, "luaApi_HttpGet", luaApi_HttpGet);
lua_register(luaVm, "luaApi_HttpPost", luaApi_HttpPost);
lua_register(luaVm, "luaApi_GetPlayerSteamId", luaApi_GetPlayerSteamId);

luabridge::getGlobalNamespace(luaVm)
.beginClass<_luaApi_WeaponInfo>("WeaponInfo")
Expand Down

0 comments on commit 0266a48

Please sign in to comment.