Skip to content

Commit

Permalink
client: add new event
Browse files Browse the repository at this point in the history
  • Loading branch information
martonp96 committed Jun 29, 2023
1 parent 505e0d6 commit 2d6c68f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions client/src/events/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "cpp-sdk/events/CPlayerWeaponChangeEvent.h"
#include "cpp-sdk/events/CWeaponDamageEvent.h"
#include "cpp-sdk/events/CEntityHitEntityEvent.h"
#include "cpp-sdk/events/CPlayerBulletHitEvent.h"

#include "cpp-sdk/SDK.h"

Expand Down Expand Up @@ -69,10 +70,20 @@ V8_LOCAL_EVENT_HANDLER playerWeaponShoot(EventType::PLAYER_WEAPON_SHOOT_EVENT,
args.push_back(V8Helpers::JSValue(ev->GetWeapon()));
args.push_back(V8Helpers::JSValue(ev->GetTotalAmmo()));
args.push_back(V8Helpers::JSValue(ev->GetAmmoInClip()));
args.push_back(resource->GetBaseObjectOrNull(ev->GetVictim()));
args.push_back(resource->CreateVector3(ev->GetPosition()));
});

V8_LOCAL_EVENT_HANDLER playerWeaponShoot(EventType::PLAYER_BULLET_HIT_EVENT,
"playerBulletHit",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
{
auto ev = static_cast<const alt::CPlayerBulletHitEvent*>(e);
v8::Isolate* isolate = resource->GetIsolate();

args.push_back(V8Helpers::JSValue(ev->GetWeapon()));
args.push_back(resource->GetBaseObjectOrNull(ev->GetVictim()));
args.push_back(resource->CreateVector3(ev->GetPosition()));
});

V8_LOCAL_EVENT_HANDLER playerWeaponChange(EventType::PLAYER_WEAPON_CHANGE,
"playerWeaponChange",
[](V8ResourceImpl* resource, const alt::CEvent* e, std::vector<v8::Local<v8::Value>>& args)
Expand Down
2 changes: 1 addition & 1 deletion shared/deps/cpp-sdk

0 comments on commit 2d6c68f

Please sign in to comment.