Skip to content

GetVehicleLastDriver should return INVALID_PLAYER_ID if invalid vehicle id is passed as argument #614

Closed

Description

@xunder-matth

If we pass invalid vehicleid as an argument to GetVehicleLastDriver (and probably more) function we get 0 as returned value.

main() {
 CreateVehicle(400, 0.0, 0.0, 0.0, 0.0, -1, -1, -1); // creating vehicle id 1
 printf("%d", GetVehicleLastDriver(1)); // INVALID_PLAYER_ID
 printf("%d", GetVehicleLastDriver(2 /*Not created veh*/)); // 0
}

Currently every failed validation will return 0. Since 0 is valid player id it can be confusing if scripters doesn't validate it using IsValidVehicle.

Activity

  1. changed the title [-]GetVehicleDriver and GetVehicleLastDriver should return INVALID_PLAYER_ID if invalid vehicle id is passed as argument[/-] [+]GetVehicleLastDriver should return INVALID_PLAYER_ID if invalid vehicle id is passed as argument[/+] on Jan 14, 2023
  2. AmyrAhmady commented on Jan 14, 2023

    @AmyrAhmady
    Member

    Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions