Skip to content

Commit

Permalink
Fix #111
Browse files Browse the repository at this point in the history
  • Loading branch information
Segfaultd committed Feb 20, 2025
1 parent c45bddf commit 95d9cf7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions code/server/src/core/builtins/human.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ namespace MafiaMP::Scripting {
FW_SEND_SERVER_COMPONENT_GAME_RPC(MafiaMP::Shared::RPC::HumanSetProps, _ent, msg);
}

Vehicle Human::GetVehicle() const {
sol::optional<Vehicle> Human::GetVehicle() const {
const auto updateData = _ent.get<MafiaMP::Shared::Modules::HumanSync::UpdateData>();
const auto carEnt = flecs::entity(_ent.world(), updateData->carPassenger.carId);
if (carEnt.is_valid() && carEnt.is_alive()) {
return Vehicle(carEnt);
}
return Vehicle(-1);
return sol::nullopt;
}

int Human::GetVehicleSeatIndex() const {
Expand Down
2 changes: 1 addition & 1 deletion code/server/src/core/builtins/human.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace MafiaMP::Scripting {

void SetHealth(float health);

Vehicle GetVehicle() const;
sol::optional<Vehicle> GetVehicle() const;

int GetVehicleSeatIndex() const;

Expand Down

0 comments on commit 95d9cf7

Please sign in to comment.