Solved isInsideVehicle to false?

Discussion in 'Plugin Development' started by KittyKatt, Aug 21, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    KittyKatt

    Code:
    Player player = (Player) event.getPlayer();
     
    if(player.isInsideVehicle()) {
        player.sendMessage("Removing your vehicle!");
        player.getVehicle().setPassenger(null);
        player.getVehicle().remove();
    }
     
    if(player.isInsideVehicle()) {
        player.sendMessage("You are still in a vehicle!");
    }
     
    return;
    Even if I set the vehicle passanger to null and remove the vehicle, the player still get isinsidevehicle to true.. ??
     
  2. Offline

    Tarestudio

    KittyKatt
    Maybe it takes a tick for the method to update the return-value
     
  3. Offline

    Chinwe

    Try vehicle.eject() ?
     
    KittyKatt likes this.
  4. Offline

    KittyKatt

    eject worked, thanks!
     
Thread Status:
Not open for further replies.

Share This Page