Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add killPedTask function #3808

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
15 changes: 15 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ void CLuaPedDefs::LoadFunctions()
{"isPedDucked", IsPedDucked},
{"isPedDead", IsPedDead},
{"isPedReloadingWeapon", IsPedReloadingWeapon},
{"killPedTask", ArgumentParser<killPedTask>},
};

// Add functions
Expand Down Expand Up @@ -2493,3 +2494,17 @@ bool CLuaPedDefs::SetPedExitVehicle(CClientPed* pPed)
{
return pPed->ExitVehicle();
}

bool CLuaPedDefs::killPedTask(CClientPed* ped, std::string taskType, std::uint8_t taskNumber, bool gracefully) noexcept
{
if (taskType == "primary") // PRIMARY
{
return ped->KillTask(taskNumber, gracefully);
}
else if (taskType == "secondary") // SECONDARY
{
return ped->KillTaskSecondary(taskNumber, gracefully);
}

return false;
}
2 changes: 2 additions & 0 deletions Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,6 @@ class CLuaPedDefs : public CLuaDefs
static bool SetPedExitVehicle(CClientPed* pPed);
static bool IsPedBleeding(CClientPed* ped);
static bool SetPedBleeding(CClientPed* ped, bool bleeding);

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