My idea:
So you want to check if someone is a passenger by a command for example. This command uses:
1. IsPlayerInAnyVehicle(playerid) to check if there is a need to execute the command. If yes:
2. GetPlayerVehicleID(playerid) to get the id, which will be saved somewhere.
3. Checks if the car ID was already saved by this command. If yes, two (or more) players are in the same vehicle, so there is one driver, one passenger or 2 passengers.
4. umumumumu?
Another idea:
Similar to previous example, you will save each players vehicle somewhere. It will be saved & checked when the player is entering the car.
So:
1. Player A enters the car (ID: 1). Script saves the car ID and checks, if the ID is saved already. No. So vehicle ID 1 is now occupied by a driver and saved.
2. Player B wants to enter the same car. Script saves and checks. ID 1 is already marked, so sorry for B, but you are the passenger!