Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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: 10 additions & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2481,16 +2481,25 @@ bool CLuaPedDefs::SetPedExitVehicle(CClientPed* pPed)
return pPed->ExitVehicle();
}

bool CLuaPedDefs::killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully) noexcept
bool CLuaPedDefs::killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully)
{
switch (taskType)
{
case taskType::PRIMARY_TASK:
{
if (taskNumber == TASK_PRIORITY_DEFAULT)
throw LuaFunctionError("Killing TASK_PRIORITY_DEFAULT is not allowed");

if (taskNumber > TASK_PRIORITY_MAX)
throw LuaFunctionError("Invalid task slot number");

return ped->KillTask(taskNumber, gracefully.value_or(true));
}
case taskType::SECONDARY_TASK:
{
if (taskNumber > TASK_SECONDARY_MAX)
throw LuaFunctionError("Invalid task slot number");

return ped->KillTaskSecondary(taskNumber, gracefully.value_or(true));
}
default:
Expand Down
2 changes: 1 addition & 1 deletion Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,5 @@ class CLuaPedDefs : public CLuaDefs
static bool IsPedBleeding(CClientPed* ped);
static bool SetPedBleeding(CClientPed* ped, bool bleeding);

static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully) noexcept;
static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional<bool> gracefully);
};
Loading