Skip to content

Commit be3959b

Browse files
committed
Implement for serverside too
1 parent 7d620b2 commit be3959b

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
213213
lua_classfunction(luaVM, "setExitVehicle", "setPedExitVehicle");
214214
lua_classfunction(luaVM, "setBleeding", "setPedBleeding");
215215
lua_classfunction(luaVM, "playVoiceLine", "playPedVoiceLine");
216+
lua_classfunction(luaVM, "isEnteringToVehicle", "isPedEnteringToVehicle");
217+
lua_classfunction(luaVM, "isExitingFromVehicle", "isPedExitingFromVehicle");
216218

217219
lua_classvariable(luaVM, "vehicle", OOP_WarpPedIntoVehicle, GetPedOccupiedVehicle);
218220
lua_classvariable(luaVM, "vehicleSeat", NULL, "getPedOccupiedVehicleSeat");

Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ void CLuaPedDefs::LoadFunctions()
4949
{"getPedOccupiedVehicleSeat", GetPedOccupiedVehicleSeat},
5050
{"isPedInVehicle", IsPedInVehicle},
5151
{"isPedReloadingWeapon", ArgumentParser<IsPedReloadingWeapon>},
52+
{"isPedEnteringToVehicle", ArgumentParser<IsPedEnteringToVehicle>},
53+
{"isPedExitingFromVehicle", ArgumentParser<IsPedExitingFromVehicle>},
5254

5355
// Ped set functions
5456
{"setPedArmor", ArgumentParserWarn<false, SetPedArmor>},
@@ -120,6 +122,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
120122
lua_classfunction(luaVM, "isHeadless", "isPedHeadless");
121123
lua_classfunction(luaVM, "isWearingJetpack", "isPedWearingJetpack"); // introduced in 1.5.5-9.13846
122124
lua_classfunction(luaVM, "isReloadingWeapon", "isPedReloadingWeapon");
125+
lua_classfunction(luaVM, "isEnteringToVehicle", "isPedEnteringToVehicle");
126+
lua_classfunction(luaVM, "isExitingFromVehicle", "isPedExitingFromVehicle");
123127

124128
lua_classfunction(luaVM, "getArmor", "getPedArmor");
125129
lua_classfunction(luaVM, "getFightingStyle", "getPedFightingStyle");
@@ -1555,3 +1559,13 @@ int CLuaPedDefs::TakeAllWeapons(lua_State* luaVM)
15551559
lua_pushboolean(luaVM, false);
15561560
return 1;
15571561
}
1562+
1563+
bool CLuaPedDefs::IsPedEnteringToVehicle(CPed* const ped) noexcept
1564+
{
1565+
return ped->GetVehicleAction() == CPed::VEHICLEACTION_ENTERING;
1566+
}
1567+
1568+
bool CLuaPedDefs::IsPedExitingFromVehicle(CPed* const ped) noexcept
1569+
{
1570+
return ped->GetVehicleAction() == CPed::VEHICLEACTION_EXITING;
1571+
}

Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,6 @@ class CLuaPedDefs : public CLuaDefs
8080
LUA_DECLARE(SetPedHeadless);
8181
LUA_DECLARE(SetPedFrozen);
8282
static bool ReloadPedWeapon(lua_State* vm, CPed* const ped) noexcept;
83+
bool IsPedEnteringToVehicle(CPed* const ped) noexcept;
84+
bool IsPedExitingFromVehicle(CPed* const ped) noexcept;
8385
};

0 commit comments

Comments
 (0)