Add wrappers for native funcs

This commit is contained in:
VortrexFTW
2020-09-12 13:18:16 -05:00
parent 843f59435d
commit de71b4686f

67
scripts/server/native.js Normal file
View File

@@ -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;
}
// ---------------------------------------------------------------------------