Has anyone discovered a way to detect whether or not a player is inside a vehicle (either driver or passenger)? I've been digging about, nothing has turned up yet.
[DOUBLEPOST=1452663838][/DOUBLEPOST]Here's what I came up with, in case anyone needs it.
Code:private bool PlayerIsInsideVehicle(PlayerInfo curPlayer) { if (curPlayer.session.WorldPlayerEntity.GetComponent<PlayerStatManager>().Motor.InsideVehicle != null) { return true; } return false; }
Solved Checking if a player is in a vehicle
Discussion in 'Hurtworld Development' started by Incisus, Jan 13, 2016.
-
Code:
var component = player.WorldPlayerEntity.GetComponent<CharacterMotorSimple>(); if (component.InsideVehicle != null) { SendChatMessage(player, "Нельзя отправить запрос на телепортацию <color=#ffa754>находясь в транспорте</color>."); return; }
-
Wulf Community Admin
We'll be adding some hooks for detecting when they attempt to get a in a vehicle and such too.