Files
GTA4RP/scripts/client/native/connected.js
2022-01-09 05:23:49 -06:00

70 lines
2.1 KiB
JavaScript

// ===========================================================================
// 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);
}
// ===========================================================================