From 3e0642faeeb02176bcf62786c8512aaf899012f2 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Wed, 19 Jan 2022 13:02:14 -0600 Subject: [PATCH] Wrap & fix some MP mod natives --- scripts/server/native/connected.js | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/scripts/server/native/connected.js b/scripts/server/native/connected.js index b4c77cf6..5d3beed4 100644 --- a/scripts/server/native/connected.js +++ b/scripts/server/native/connected.js @@ -210,12 +210,13 @@ function getPlayerSkin(client) { function setPlayerHealth(client, health) { logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to ${health}`); sendPlayerSetHealth(client, health); + getServerData(client).health = health; } // =========================================================================== function getPlayerHealth(client) { - return client.player.health; + return getServerData(client).health; } // =========================================================================== @@ -965,4 +966,28 @@ function getClosestElementByType(elementType, position) { return getElementsByType(elementType).reduce((i, j) => (getDistance(position, getElementPosition(i)) <= getDistance(position, getElementPosition(j))) ? i : j); } +// =========================================================================== + +function getVehicleFirstEmptySeat(vehicle) { + for(let i = 0; i <= 4; i++) { + if(vehicle.getOccupant(i) == null) { + return i; + } + } + + return false; +} + +// =========================================================================== + +function isVehicleTrain(vehicle) { + if(getGame() == VRR_GAME_GTA_III) { + if(vehicle.modelIndex == 124) { + return true; + } + } + + return false +} + // =========================================================================== \ No newline at end of file