From de71b4686f30caf134be4bc3880246e4c8475fa9 Mon Sep 17 00:00:00 2001 From: VortrexFTW Date: Sat, 12 Sep 2020 13:18:16 -0500 Subject: [PATCH] Add wrappers for native funcs --- scripts/server/native.js | 67 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 scripts/server/native.js diff --git a/scripts/server/native.js b/scripts/server/native.js new file mode 100644 index 00000000..a285e5ff --- /dev/null +++ b/scripts/server/native.js @@ -0,0 +1,67 @@ +// =========================================================================== +// Asshat Gaming RP +// http://asshatgaming.com +// © 2020 Asshat Gaming +// --------------------------------------------------------------------------- +// FILE: native.js +// DESC: Provides util function to wrap mod-specific stuff +// TYPE: Server (JavaScript) +// =========================================================================== + +// Use data for each because args are probably gonna be way different for each mod + +// --------------------------------------------------------------------------- + +function agSpawnPlayer(client, subAccountData) { + return spawnPlayer(client, subAccountData.spawnPosition, subAccountData.spawnRotation, subAccountData.skin); +} + +// --------------------------------------------------------------------------- + +function agCreateVehicle(vehicleData) { + return createVehicle(vehicleData.model, vehicleData.spawnPosition); +} + +// --------------------------------------------------------------------------- + +function agSetVehiclePosition(vehicle, position) { + vehicle.position = position; +} + +// --------------------------------------------------------------------------- + +function agSetVehicleRotation(vehicle, heading) { + vehicle.heading = heading; +} + +// --------------------------------------------------------------------------- + +function getServerGame() { + return server.game; +} + +// --------------------------------------------------------------------------- + +function agGetPedPosition(ped) { + return ped.position; +} + +// --------------------------------------------------------------------------- + +function agGetPedRotation(ped) { + return ped.heading; +} + +// --------------------------------------------------------------------------- + +function agGetPedSkin(ped) { + return ped.modelIndex; +} + +// --------------------------------------------------------------------------- + +function agSetPedSkin(ped, skinId) { + return ped.modelIndex = skinId; +} + +// --------------------------------------------------------------------------- \ No newline at end of file