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

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
huoji120 committed Oct 19, 2023
2 parents af727ea + f5413c4 commit fe85314
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions csgo2/script_apis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,13 +414,14 @@ auto luaApi_GivePlayerWeapon(lua_State* luaVm) -> int {
const auto playerIndex = lua_tointeger(luaVm, 1);
const auto weaponName = lua_tostring(luaVm, 2);
auto isSuccess = false;
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
if (playerController->m_bPawnIsAlive() == false) {
return;
}
isSuccess =
GameWeapons::ParseWeaponCommand(playerController, weaponName);
});
if (weaponName != nullptr) {
ExcutePlayerAction(playerIndex, [&](CCSPlayerController* playerController) {
if (playerController->m_bPawnIsAlive() == false) {
return;
}
isSuccess = GameWeapons::ParseWeaponCommand(playerController, weaponName);
});
}
lua_pop(luaVm, 2);
lua_pushboolean(luaVm, isSuccess);
return 1;
Expand Down

0 comments on commit fe85314

Please sign in to comment.