From 8e2c69c1b1b5a739713fdbbf920bab39cfd66b4a Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 15 Mar 2022 04:16:13 -0500 Subject: [PATCH] Wrap some native stuff --- scripts/client/native/connected.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/scripts/client/native/connected.js b/scripts/client/native/connected.js index f62b24bc..72054b5f 100644 --- a/scripts/client/native/connected.js +++ b/scripts/client/native/connected.js @@ -20,7 +20,11 @@ function getPlayerPosition() { // =========================================================================== function setPlayerPosition(position) { - localPlayer.position = position; + if(getGame() == VRR_GAME_GTA_IV) { + natives.setCharCoordinates(localPlayer, position); + } else { + localPlayer.position = position; + } } // =========================================================================== @@ -141,4 +145,21 @@ function getVehiclesInRange(position, range) { return inRangeVehicles; } +// =========================================================================== + +function createGameBlip(blipModel, position, name = "") { + if(getGame() == VRR_GAME_GTA_IV) { + let blipId = natives.addBlipForCoord(position); + if(blipId) { + natives.changeBlipSprite(blipId, blipModel); + natives.setBlipMarkerLongDistance(blipId, false); + natives.setBlipAsShortRange(blipId, true); + natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`); + return blipId; + } + } + + return -1; +} + // =========================================================================== \ No newline at end of file