EasyScript

3.5k Downloads

Vehicle eject in VehicleEnterEvent doesn't work

rubenvde opened this issue ยท 0 comments

commented

I got some problems to use the eject() function in this example below. I got no errors but it doesn't work.

function onPlayerVehicleEntered(e) {
    var player = e.getEntered();
    var vehicle = e.getVehicle();
    var location = vehicle.getLocation();

    /* dynamically in the future */
    if(location.getX() == 198.5 && location.getZ() > 189.35079821219165 && location.getZ() < 202.65619492131655)
    {
        player.sendMessage("Not allowed");
        vehicle.eject();  // THIS DOESN'T WORK
    }
    else
    {
        log.info("There is something wrong \n x: " + location.getX() + "\n y: " + location.getY() + "\n z: " + location.getZ());
    }
}

/* RegisterEvent to Function */
plugin.registerEvent(VehicleEnterEvent, onPlayerVehicleEntered);