-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
shared: update sdk and add ped events
- Loading branch information
Showing
8 changed files
with
106 additions
and
4 deletions.
There are no files selected for viewing
Submodule cpp-sdk
updated
6 files
+3 −0 | SDK.h | |
+4 −0 | events/CEvent.h | |
+40 −0 | events/CPedDamageEvent.h | |
+34 −0 | events/CPedDeathEvent.h | |
+41 −0 | events/CPedHealEvent.h | |
+1 −0 | objects/IPlayer.h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const { Event } = requireBinding("shared/events.js"); | ||
|
||
Event.register(alt.Enums.EventType.PED_HEAL, "PedHeal"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#include "Event.h" | ||
|
||
// clang-format off | ||
static js::Event pedHealEvent(alt::CEvent::Type::PED_HEAL, [](const alt::CEvent* ev, js::Event::EventArgs& args) | ||
{ | ||
auto e = static_cast<const alt::CPedHealEvent*>(ev); | ||
|
||
args.Set("ped", e->GetTarget()); | ||
args.Set("newHealth", e->GetNewHealth()); | ||
args.Set("oldHealth", e->GetOldHealth()); | ||
|
||
args.Set("newArmour", e->GetNewArmour()); | ||
args.Set("oldArmour", e->GetOldArmour()); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
const { Event } = requireBinding("shared/events.js"); | ||
|
||
Event.register(alt.Enums.EventType.PED_DEATH, "PedDeath"); | ||
Event.register(alt.Enums.EventType.PED_DAMAGE, "PedDamage"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#include "Event.h" | ||
|
||
// clang-format off | ||
static js::Event pedDeathEvent(alt::CEvent::Type::PED_DEATH, [](const alt::CEvent* ev, js::Event::EventArgs& args) | ||
{ | ||
auto e = static_cast<const alt::CPedDeathEvent*>(ev); | ||
|
||
args.Set("ped", e->GetTarget()); | ||
args.Set("killer", e->GetKiller()); | ||
args.Set("weapon", e->GetWeapon()); | ||
}); | ||
|
||
static js::Event pedDamageEvent(alt::CEvent::Type::PED_DAMAGE, [](const alt::CEvent* ev, js::Event::EventArgs& args) | ||
{ | ||
auto e = static_cast<const alt::CPedDamageEvent*>(ev); | ||
|
||
args.Set("ped", e->GetTarget()); | ||
args.Set("attacker", e->GetAttacker()); | ||
args.Set("healthDamage", e->GetHealthDamage()); | ||
args.Set("armourDamage", e->GetArmourDamage()); | ||
args.Set("weapon", e->GetWeapon()); | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters