Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2450,6 +2450,17 @@ bool CStaticFunctionDefinitions::SetPedOnFire(CClientEntity& Entity, bool bOnFir
return false;
}

bool CStaticFunctionDefinitions::SetPedArmor(CClientPed& Ped, float fArmor)
{
if (Ped.IsLocalEntity())
{
Ped.SetArmor(fArmor);
return true;
}

return false;
}

bool CStaticFunctionDefinitions::SetPedOxygenLevel(CClientEntity& Entity, float fOxygen)
{
if (IS_PED(&Entity))
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/CStaticFunctionDefinitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ class CStaticFunctionDefinitions
static bool RemovePedFromVehicle(CClientPed* pPed);
static bool WarpPedIntoVehicle(CClientPed* pPed, CClientVehicle* pVehicle, unsigned int uiSeat);
static bool SetPedOxygenLevel(CClientEntity& Entity, float fOxygen);
static bool SetPedArmor(CClientPed& Ped, float fArmor);

// Extra Clothes functions
static bool GetBodyPartName(unsigned char ucID, SString& strOutName);
Expand Down
21 changes: 20 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ void CLuaPedDefs::LoadFunctions()
{"warpPedIntoVehicle", WarpPedIntoVehicle},
{"removePedFromVehicle", RemovePedFromVehicle},
{"setPedOxygenLevel", SetPedOxygenLevel},
{"setPedArmor", SetPedArmor},
{"givePedWeapon", GivePedWeapon},
{"isPedReloadingWeapon", IsPedReloadingWeapon},
};
Expand Down Expand Up @@ -167,6 +168,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
lua_classfunction(luaVM, "setControlState", "setPedControlState");
lua_classfunction(luaVM, "warpIntoVehicle", "warpPedIntoVehicle");
lua_classfunction(luaVM, "setOxygenLevel", "setPedOxygenLevel");
lua_classfunction(luaVM, "setArmor", "setPedArmor");
lua_classfunction(luaVM, "setWeaponSlot", "setPedWeaponSlot");
lua_classfunction(luaVM, "setDoingGangDriveby", "setPedDoingGangDriveby");
lua_classfunction(luaVM, "setFightingStyle", "setPedFightingStyle");
Expand All @@ -187,7 +189,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM)
lua_classvariable(luaVM, "canBeKnockedOffBike", "setPedCanBeKnockedOffBike", "canPedBeKnockedOffBike");
lua_classvariable(luaVM, "hasJetPack", NULL, "doesPedHaveJetPack");
lua_classvariable(luaVM, "jetpack", NULL, "isPedWearingJetpack"); // introduced in 1.5.5-9.13846
lua_classvariable(luaVM, "armor", NULL, "getPedArmor");
lua_classvariable(luaVM, "armor", "setPedArmor", "getPedArmor");
lua_classvariable(luaVM, "fightingStyle", "setPedFightingStyle", "getPedFightingStyle");
lua_classvariable(luaVM, "cameraRotation", "setPedCameraRotation", "getPedCameraRotation");
lua_classvariable(luaVM, "contactElement", NULL, "getPedContactElement");
Expand Down Expand Up @@ -2138,6 +2140,23 @@ int CLuaPedDefs::SetPedMoveAnim(lua_State* luaVM)
return 1;
}

int CLuaPedDefs::SetPedArmor(lua_State* luaVM)
{
CClientPed* pPed;
float fArmor;
CScriptArgReader argStream(luaVM);
argStream.ReadUserData(pPed);
argStream.ReadNumber(fArmor);

if (argStream.HasErrors())
{
return luaL_error(luaVM, argStream.GetFullErrorMessage());
}

lua_pushboolean(luaVM, CStaticFunctionDefinitions::SetPedArmor(*pPed, fArmor));
return 1;
}

int CLuaPedDefs::SetPedOxygenLevel(lua_State* luaVM)
{
// Verify the argument
Expand Down
1 change: 1 addition & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ class CLuaPedDefs : public CLuaDefs
LUA_DECLARE(SetPedAnimationProgress);
LUA_DECLARE(SetPedAnimationSpeed);
LUA_DECLARE(SetPedMoveAnim);
LUA_DECLARE(SetPedArmor);
LUA_DECLARE(SetPedWeaponSlot);
LUA_DECLARE(GivePedWeapon);
LUA_DECLARE(IsPedReloadingWeapon);
Expand Down