![]() |
|
HUD Linked vehicle on TSCM Chairs - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Starfall (https://teamscm.co.uk/forum-7.html) +--- Thread: HUD Linked vehicle on TSCM Chairs (/thread-3592.html) |
HUD Linked vehicle on TSCM Chairs - 57e11a - 17-01-2021 So I'm using a HUD, linked to a TSCM Chair, and I'm trying to add some hooks that will only run on clients when they're sitting in the linked vehicle. My current code:
This works for normal chairs, but when using hud.getLinkedVehicle() on a hud that is linked to a TSCM Chair, it returns a prop_vehicle_prisoner_pod, even though the seat is a chair_ghost (and it's an entity, so there's no Vehicle methods/fields)
RE: HUD Linked vehicle on TSCM Chairs - The17thDoctor - 17-01-2021 To be clear, everything is an entity, and a vehicle is just a special case of entities. Moreover, when using hud.getLinkedVehicle() I get the chair_ghost and not any prop_vehicle_prisoner_pod. However the chair_ghost is indeed not considered as a vehicle by Starfall which is kind of problematic. RE: HUD Linked vehicle on TSCM Chairs - 57e11a - 17-01-2021 Are you running hud.getLinkedVehicle() on the server or the client? I'm running it on the client and I'm getting a prop_vehicle_prisoner_pod RE: HUD Linked vehicle on TSCM Chairs - Person8880 - 18-01-2021 Chairs positions aren't vehicles, they behave a bit differently. I've added hud.isLinkedToVehicle( Entity ) which will deal with the difference between chair positions and real vehicles for you, it'll be available after the next restart. RE: HUD Linked vehicle on TSCM Chairs - 57e11a - 18-01-2021 Thank you! It works great! RE: HUD Linked vehicle on TSCM Chairs - 57e11a - 20-01-2021 It appears that the hud forgets the linked seat (still linked, but the hud.isLinkedToVehicle function returns false) after duplication RE: HUD Linked vehicle on TSCM Chairs - Person8880 - 23-01-2021 Restoring links after dupe should be fixed after the next restart. |