Skip to content

Commit

Permalink
ALTV-626 - make CPlayerDimensionChangeEvent shared (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
Doxoh authored and OlegT committed Jan 9, 2025
1 parent 416e2e3 commit 07a2ead
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 4 additions & 0 deletions client/js/compatibility/events/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,7 @@ registerEventHandler(alt.Enums.EventType.PLAYER_STOP_TALKING, "playerStopTalking
registerEventHandler(alt.Enums.EventType.PLAYER_CHANGE_INTERIOR_EVENT, "playerInteriorChange", ({ player, oldInterior, newInterior }) => {
return [player, oldInterior, newInterior];
});

registerEventHandler(alt.Enums.EventType.PLAYER_DIMENSION_CHANGE, "playerDimensionChange", ({ player, oldDimension, newDimension }) => {
return [player, oldDimension, newDimension];
});
1 change: 0 additions & 1 deletion server/js/events/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Event.register(alt.Enums.EventType.PLAYER_DAMAGE, "PlayerDamage");
Event.register(alt.Enums.EventType.PLAYER_DEATH, "PlayerDeath");
Event.register(alt.Enums.EventType.PLAYER_HEAL, "PlayerHeal");
Event.register(alt.Enums.EventType.PLAYER_REQUEST_CONTROL, "PlayerControlRequest");
Event.register(alt.Enums.EventType.PLAYER_DIMENSION_CHANGE, "PlayerDimensionChange");
Event.register(alt.Enums.EventType.REQUEST_SYNCED_SCENE, "PlayerSyncedSceneRequest");
Event.register(alt.Enums.EventType.START_SYNCED_SCENE, "PlayerSyncedSceneStart");
Event.register(alt.Enums.EventType.STOP_SYNCED_SCENE, "PlayerSyncedSceneStop");
Expand Down
9 changes: 0 additions & 9 deletions server/src/events/PlayerEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,6 @@ static js::Event playerRequestControlEvent(alt::CEvent::Type::PLAYER_REQUEST_CON
args.Set("target", e->GetTarget());
});

static js::Event playerDimensionChangeEvent(alt::CEvent::Type::PLAYER_DIMENSION_CHANGE, [](const alt::CEvent* ev, js::Event::EventArgs& args)
{
auto e = static_cast<const alt::CPlayerDimensionChangeEvent*>(ev);

args.Set("player", e->GetTarget());
args.Set("oldDimension", e->GetOldDimension());
args.Set("newDimension", e->GetNewDimension());
});

static js::Event playerWeaponChangeEvent(alt::CEvent::Type::PLAYER_WEAPON_CHANGE, [](const alt::CEvent* ev, js::Event::EventArgs& args)
{
auto e = static_cast<const alt::CPlayerWeaponChangeEvent*>(ev);
Expand Down
1 change: 1 addition & 0 deletions shared/js/events/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ Event.register(alt.Enums.EventType.PLAYER_ENTER_VEHICLE, "PlayerVehicleEntered")
Event.register(alt.Enums.EventType.PLAYER_LEAVE_VEHICLE, "PlayerVehicleLeft");
Event.register(alt.Enums.EventType.PLAYER_CHANGE_VEHICLE_SEAT, "PlayerVehicleSeatChange");
Event.register(alt.Enums.EventType.PLAYER_CHANGE_INTERIOR_EVENT, "PlayerInteriorChange");
Event.register(alt.Enums.EventType.PLAYER_DIMENSION_CHANGE, "PlayerDimensionChange");
Event.register(alt.Enums.EventType.PLAYER_START_TALKING, "PlayerStartTalking");
Event.register(alt.Enums.EventType.PLAYER_STOP_TALKING, "PlayerStopTalking");
9 changes: 9 additions & 0 deletions shared/src/events/PlayerEvent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ static js::Event playerInteriorChangeEvent(alt::CEvent::Type::PLAYER_CHANGE_INTE
args.Set("oldInterior", e->GetOldInteriorLocation());
args.Set("newInterior", e->GetNewInteriorLocation());
});

static js::Event playerDimensionChangeEvent(alt::CEvent::Type::PLAYER_DIMENSION_CHANGE, [](const alt::CEvent* ev, js::Event::EventArgs& args)
{
auto e = static_cast<const alt::CPlayerDimensionChangeEvent*>(ev);

args.Set("player", e->GetTarget());
args.Set("oldDimension", e->GetOldDimension());
args.Set("newDimension", e->GetNewDimension());
});

0 comments on commit 07a2ead

Please sign in to comment.