gc8 981 Posted February 6, 2017 Hi I have always used the vehicle command to detect if player is inside a vehicle but today I noticed something odd going on. If I put player in a tank as driver the player variable is different from (vehicle player) like it should be. But if you put player as commander in tank then: player == (vehicle player) ! does anybody know why is this? maybe this is a bug in the vehicle command? And what are valid ways to detect if unit is in any vehicle? thx! Share this post Link to post Share on other sites
gc8 981 Posted February 6, 2017 Nevermind. I found out that even the unit names are same the "(vehicle player) != player" still works. Share this post Link to post Share on other sites
ShadowRanger24 50 Posted February 7, 2017 I use a newer, faster command for checking if a player is in a vehicle. This is how some people do it: !isNull objectParent player 1 Share this post Link to post Share on other sites
killzone_kid 1333 Posted February 7, 2017 On 2/6/2017 at 12:04 PM, gc8 said: Nevermind. I found out that even the unit names are same the "(vehicle player) != player" still works. Wait, what? You just said player == vehicle player true, and now vehicle player != player also true? Did I miss something? Share this post Link to post Share on other sites
gc8 981 Posted February 7, 2017 On 2/7/2017 at 11:01 AM, killzone_kid said: Wait, what? You just said player == vehicle player true, and now vehicle player != player also true? Did I miss something? what I mean was that (str player) == (str (vehicle player)) because I put both lines vehicle & vehicle player in the debug console and they have same value. But vehicle player != player is still true also. because it compares the objects that happen to have same name. here's a screenshot of what I mean (player being inside a turret): Share this post Link to post Share on other sites
stuguy 15 Posted February 8, 2017 vehicle player returns the vehicle the player is in. vehicle player != player is always true if the player is in a vehicle. It is false if the player is not in a vehicle. I just tested: if(vehicle player != player) then {hint "player in vehicle";}else{hint "player not in vehicle";}; In a car, truck, tank, helicopter, and enemy tank in the VR. When I was in a vehicle, the "player in vehicle" fired off. When I was a foot mobile, the "player not in vehicle" fired off. It may be possible that your tank is a mod and is not properly setup in its class configs. Share this post Link to post Share on other sites
gc8 981 Posted February 8, 2017 On 2/8/2017 at 1:47 AM, stuguy said: It may be possible that your tank is a mod and is not properly setup in its class configs. the confusion was just that the tank has same name as the commander. as shown in the screenshot I posted. but yeah (vehicle player != player) works Share this post Link to post Share on other sites
stuguy 15 Posted February 8, 2017 On 2/8/2017 at 6:08 AM, gc8 said: the confusion was just that the tank has same name as the commander That's why I always use unique variables or I select units or vehicles through logic. Share this post Link to post Share on other sites