Add clientside natives file for connected mods

This commit is contained in:
Vortrex
2022-01-09 05:23:49 -06:00
parent dc6fad074b
commit baa1b6ed82

View File

@@ -0,0 +1,70 @@
// ===========================================================================
// Vortrex's Roleplay Resource
// https://github.com/VortrexFTW/gtac_roleplay
// ===========================================================================
// FILE: connected.js
// DESC: Provides wrapped natives for GTA Connected and Mafia Connected mods
// TYPE: Server (JavaScript)
// ===========================================================================
function sendNetworkEventToPlayer(networkEvent, client, ...args) {
triggerNetworkEvent.apply(null, networkEvent, client, args);
}
// ===========================================================================
function getPlayerPosition() {
return localPlayer.position;
}
// ===========================================================================
function setPlayerPosition(position) {
localPlayer.position = position;
}
// ===========================================================================
function getElementPosition(element) {
return element.position;
}
// ===========================================================================
function setElementPosition(element, position) {
if(!element.isSyncer) {
return false;
}
element.position = position;
}
// ===========================================================================
function deleteGameElement(element, position) {
if(!element.isOwner) {
return false;
}
destroyGameElement(element);
}
// ===========================================================================
function createGameVehicle(modelIndex, position, heading) {
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
}
// ===========================================================================
function addNetworkEventHandler(eventName, ...args) {
addNetworkHandler.apply(null, eventName, args);
}
// ===========================================================================
function sendNetworkEventToServer(eventName, ...args) {
triggerNetworkEvent.apply(null, eventName, args);
}
// ===========================================================================