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

Fixed GetPlayerVehicleID returning INVALID_VEHICLE_ID. #788

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Server/Components/Pawn/Scripting/Player/Natives.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -665,14 +665,14 @@ SCRIPT_API(GetPlayerSpecialAction, int(IPlayer& player))
return player.getAction();
}

SCRIPT_API_FAILRET(GetPlayerVehicleID, INVALID_VEHICLE_ID, int(IPlayerVehicleData& data))
SCRIPT_API_FAILRET(GetPlayerVehicleID, 0, int(IPlayerVehicleData& data))
{
IVehicle* vehicle = data.getVehicle();
if (vehicle)
{
return vehicle->getID();
}
return 0;
return FailRet;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return INVALID_VEHICLE_ID here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's strange, but if you input an invalid player ID (a player who is not on the server) into GetPlayerVehicleID, it will return 65535 (INVALID_PLAYER_ID).

And if no player is in the vehicle, it will return 0.

}

SCRIPT_API_FAILRET(GetPlayerVehicleSeat, SEAT_NONE, int(IPlayerVehicleData& data))
Expand Down