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

[Discussion] [Scripting] Human:getVehicleSeat() could returns nil instead of -1 #113

Open
Deewarz opened this issue Jan 12, 2025 · 1 comment

Comments

@Deewarz
Copy link
Contributor

Deewarz commented Jan 12, 2025

Description

When the player is not in a vehicle, could we return nil instead of -1?

int Human::GetVehicleSeat() 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 updateData->carPassenger.seatId;
}
return -1;
}

What do you think about it?

Reproduction

When not in vehicle:

listenEvent("onChatCommand", function (player, message, command, args)
  if command == "seat" then
    local seat = player:getVehicleSeat() -- returns -1
  end
end)
@Kamzik123
Copy link

Doesn't it return -1 in the original game's lua too? I know it does in Mafia 2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

2 participants