I know what I did, now. There is no typo in the block of code (the first one), which I tested again.
UnitInVehicle() inside the event handler UNIT_EXITED_VEHICLE would never return "true" because, when this event is fired, a player is no longer in a vehicle, which I could not understand. Before, I tried to test the whole handler by adding `print(UnitInVehicle("player"))` in front of `if` and this is where I must have made a typo.
I was confused and assumed that perhaps UnitInVehicle() is not available (as I got nil before). It's total newbie thing! I hope someone else can learn from my mistake!
|