Reorganize some utils, change dividing lines
This commit is contained in:
4
TODO.md
4
TODO.md
@@ -28,4 +28,6 @@ For grand opening:
|
||||
* Add display for player's actual time (like Steam overlay has)
|
||||
------------------------------------------------------
|
||||
* Change structure of item types to include only **one** set of items
|
||||
* Use a new table for game-specific data (model, obj pos/rot/scale, etc)
|
||||
* Use a new table for game-specific data (model, obj pos/rot/scale, etc)
|
||||
------------------------------------------------------
|
||||
* Change pizza delivery job to pick a random house door instead of pre-established places on the street.
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: afk.js
|
||||
// DESC: Provides AFK detection
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: chatbox.js
|
||||
// DESC: Provides extra chatbox features
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let chatBoxHistory = [];
|
||||
let bottomMessageIndex = 0;
|
||||
@@ -17,12 +17,12 @@ let maxChatBoxHistory = 500;
|
||||
let scrollAmount = 1;
|
||||
let maxChatBoxLines = 6;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
bindKey(SDLK_PAGEUP, KEYSTATE_DOWN, chatBoxScrollUp);
|
||||
bindKey(SDLK_PAGEDOWN, KEYSTATE_DOWN, chatBoxScrollDown);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.m", function(messageString, colour) {
|
||||
message(messageString, colour);
|
||||
@@ -30,13 +30,13 @@ addNetworkHandler("ag.m", function(messageString, colour) {
|
||||
bottomMessageIndex = chatBoxHistory.length-1;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addToChatBoxHistory(messageString, colour) {
|
||||
chatBoxHistory.push([messageString, colour]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function chatBoxScrollUp() {
|
||||
if(bottomMessageIndex > maxChatBoxLines) {
|
||||
@@ -45,7 +45,7 @@ function chatBoxScrollUp() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function chatBoxScrollDown() {
|
||||
if(bottomMessageIndex < chatBoxHistory.length-1) {
|
||||
@@ -54,7 +54,7 @@ function chatBoxScrollDown() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearChatBox() {
|
||||
for(let i = 0 ; i <= maxChatBoxLines ; i++) {
|
||||
@@ -62,7 +62,7 @@ function clearChatBox() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updateChatBox() {
|
||||
clearChatBox();
|
||||
@@ -75,4 +75,4 @@ function updateChatBox() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: gui.js
|
||||
// DESC: Provides GUI functionality and styles (using MexUI)
|
||||
// TYPE: Client (JavaScript)
|
||||
@@ -1166,7 +1166,7 @@ app.init = function()
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created login GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating two factor auth GUI ...`);
|
||||
twoFactorAuth.window = mexui.window(game.width/2-150, game.height/2-129, 300, 258, 'LOGIN', {
|
||||
@@ -1244,7 +1244,7 @@ app.init = function()
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created two factor auth GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating new character GUI ...`);
|
||||
|
||||
@@ -1450,7 +1450,7 @@ app.init = function()
|
||||
}, checkNewCharacter);
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created new character GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating register GUI ...`);
|
||||
register.window = mexui.window(game.width/2-130, game.height/2-125, 300, 250, 'Register', {
|
||||
@@ -1563,7 +1563,7 @@ app.init = function()
|
||||
}, checkRegistration);
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created register GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating error GUI ...`);
|
||||
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'ERROR', {
|
||||
@@ -1609,7 +1609,7 @@ app.init = function()
|
||||
}, closeErrorDialog);
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created error GUI ...`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created prompt GUI ...`);
|
||||
yesNoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Question', {
|
||||
@@ -1668,7 +1668,7 @@ app.init = function()
|
||||
}, yesNoDialogAnswerNo);
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created prompt GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating info dialog GUI ...`);
|
||||
infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', {
|
||||
@@ -1713,7 +1713,7 @@ app.init = function()
|
||||
}, closeInfoDialog);
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created info dialog GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating list dialog GUI ...`);
|
||||
listDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 500, 'List', {
|
||||
@@ -1771,7 +1771,7 @@ app.init = function()
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created list dialog GUI`);
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Creating character select GUI ...`);
|
||||
characterSelect.window = mexui.window(game.width/2-215, game.height/2-83, 430, 166, 'Select Character', {
|
||||
@@ -1897,20 +1897,20 @@ app.init = function()
|
||||
});
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Created character select GUI`);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] All GUI created successfully!`);
|
||||
closeAllWindows();
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let checkLogin = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Checking login with server ...`);
|
||||
triggerNetworkEvent("ag.checkLogin", login.passwordInput.lines[0]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let loginFailed = function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports login failed`);
|
||||
@@ -1919,21 +1919,21 @@ let loginFailed = function(errorMessage) {
|
||||
login.passwordInput.text = "";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let loginSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports login was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let checkRegistration = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Checking registration with server ...`);
|
||||
triggerNetworkEvent("ag.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let checkNewCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Checking new character with server ...`);
|
||||
@@ -1964,7 +1964,7 @@ let checkNewCharacter = function() {
|
||||
);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let registrationFailed = function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports registration failed. Reason: ${errorMessage}`);
|
||||
@@ -1975,14 +1975,14 @@ let registrationFailed = function(errorMessage) {
|
||||
register.emailInput.text = "";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let registrationSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports registration was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let twoFactorAuthFailed = function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports two-factor authentication failed. Reason: ${errorMessage}`);
|
||||
@@ -1991,28 +1991,28 @@ let twoFactorAuthFailed = function(errorMessage) {
|
||||
login.passwordInput.text = "";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let twoFactorAuthSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports two-factor authentication was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let checkTwoFactorAuth = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Checking two-factor authentication with server ...`);
|
||||
triggerNetworkEvent("ag.checkTwoFactorAuth", twoFactorAuth.codeInput.lines[0]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let characterSelectSuccess = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Server reports character selection was successful`);
|
||||
closeAllWindows();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let closeErrorDialog = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Closing error dialog`);
|
||||
@@ -2020,7 +2020,7 @@ let closeErrorDialog = function() {
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let closeInfoDialog = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Closing info dialog`);
|
||||
@@ -2028,7 +2028,7 @@ let closeInfoDialog = function() {
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let closeAllWindows = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Closing all GUI windows`);
|
||||
@@ -2044,21 +2044,21 @@ let closeAllWindows = function() {
|
||||
mexui.setInput(false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let yesNoDialogAnswerNo = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Responding with answer NO to server prompt`);
|
||||
triggerNetworkEvent("ag.promptAnswerNo");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let yesNoDialogAnswerYes = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Responding with answer YES to server prompt`);
|
||||
triggerNetworkEvent("ag.promptAnswerYes");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showRegistration = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Showing registration window`);
|
||||
@@ -2068,7 +2068,7 @@ let showRegistration = function() {
|
||||
register.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showLogin = function() {
|
||||
closeAllWindows();
|
||||
@@ -2078,7 +2078,7 @@ let showLogin = function() {
|
||||
login.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showTwoFactorAuth = function() {
|
||||
closeAllWindows();
|
||||
@@ -2088,7 +2088,7 @@ let showTwoFactorAuth = function() {
|
||||
twoFactorAuth.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showCharacterSelect = function(firstName, lastName, placeOfOrigin, dateOfBirth, skinId) {
|
||||
closeAllWindows();
|
||||
@@ -2102,7 +2102,7 @@ let showCharacterSelect = function(firstName, lastName, placeOfOrigin, dateOfBir
|
||||
characterSelect.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showError = function(errorMessage, errorTitle) {
|
||||
closeAllWindows();
|
||||
@@ -2113,7 +2113,7 @@ let showError = function(errorMessage, errorTitle) {
|
||||
errorDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showYesNo = function(promptMessage, promptTitle) {
|
||||
closeAllWindows();
|
||||
@@ -2123,7 +2123,7 @@ let showYesNo = function(promptMessage, promptTitle) {
|
||||
yesNoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showInfo = function(infoMessage, infoTitle) {
|
||||
closeAllWindows();
|
||||
@@ -2133,7 +2133,7 @@ let showInfo = function(infoMessage, infoTitle) {
|
||||
infoDialog.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let showNewCharacter = function() {
|
||||
closeAllWindows();
|
||||
@@ -2143,28 +2143,28 @@ let showNewCharacter = function() {
|
||||
newCharacter.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let selectNextCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Requesting next character info from server for character select window`);
|
||||
triggerNetworkEvent("ag.nextCharacter");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let selectPreviousCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Requesting previous character info from server for character select window`);
|
||||
triggerNetworkEvent("ag.previousCharacter");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let selectThisCharacter = function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Tell server the current shown character was selected in character select window`);
|
||||
triggerNetworkEvent("ag.selectCharacter");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let switchCharacterSelect = function(firstName, lastName, placeOfOrigin, dateOfBirth, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Updating character info with data from server`);
|
||||
@@ -2177,70 +2177,70 @@ let switchCharacterSelect = function(firstName, lastName, placeOfOrigin, dateOfB
|
||||
characterSelect.window.shown = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showLogin", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show login window`);
|
||||
showLogin();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showRegistration", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show registration window`);
|
||||
showRegistration();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showNewCharacter", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show new character window`);
|
||||
showNewCharacter();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showCharacterSelect", function(firstName, lastName, placeOfOrigin, dateOfBirth, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show character selection window`);
|
||||
showCharacterSelect(firstName, lastName, placeOfOrigin, dateOfBirth, skinId);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.switchCharacterSelect", function(firstName, lastName, placeOfOrigin, dateOfBirth, skinId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to update character selection window with new info`);
|
||||
switchCharacterSelect(firstName, lastName, placeOfOrigin, dateOfBirth, skinId);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showError", function(errorMessage, errorTitle) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show error window`);
|
||||
showError(errorMessage, errorTitle);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showPrompt", function(promptMessage, promptTitle) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show prompt window`);
|
||||
showYesNo(promptMessage, promptTitle);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showInfo", function(infoMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received request from server to show info dialog`);
|
||||
showInfo(infoMessage);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.loginSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received signal of successful login from server`);
|
||||
loginSuccess();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.characterSelectSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received signal of successful character selection from server`);
|
||||
@@ -2248,28 +2248,28 @@ addNetworkHandler("ag.characterSelectSuccess", function() {
|
||||
setChatWindowEnabled(true);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.loginFailed", function(remainingAttempts) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received signal of failed login from server`);
|
||||
loginFailed(remainingAttempts);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.registrationSuccess", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received signal of successful registration from server`);
|
||||
registrationSuccess();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.registrationFailed", function(errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received signal of failed registration from server`);
|
||||
registrationFailed(errorMessage);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.guiColour", function(red, green, blue) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Received new GUI colours from server`);
|
||||
@@ -2277,7 +2277,7 @@ addNetworkHandler("ag.guiColour", function(red, green, blue) {
|
||||
focusedColour = [red+focusedColourOffset, green+focusedColourOffset, blue+focusedColourOffset];
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.guiInit", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.GUI] Initializing MexUI app`);
|
||||
@@ -2285,4 +2285,4 @@ addNetworkHandler("ag.guiInit", function() {
|
||||
triggerNetworkEvent("ag.guiReady", true);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: keybind.js
|
||||
// DESC: Provides keybind features
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: labels.js
|
||||
// DESC: Provides functionality for world labels (3D labels)
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: main.js
|
||||
// DESC: Main client script (will be reorganized into individual files later)
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let bigMessageFont = null;
|
||||
let logoImage = null;
|
||||
@@ -70,7 +70,7 @@ let controlsEnabled = false;
|
||||
|
||||
let usingSkinSelector = false;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEvent("OnLocalPlayerEnterSphere", 1);
|
||||
addEvent("OnLocalPlayerExitSphere", 1);
|
||||
@@ -78,7 +78,7 @@ addEvent("OnLocalPlayerEnteredVehicle", 1);
|
||||
addEvent("OnLocalPlayerExitedVehicle", 1);
|
||||
addEvent("OnLocalPlayerSwitchWeapon", 2);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
bindEventHandler("onResourceReady", thisResource, function(event, resource) {
|
||||
if(resource == thisResource) {
|
||||
@@ -101,7 +101,7 @@ bindEventHandler("onResourceReady", thisResource, function(event, resource) {
|
||||
openAllGarages();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
bindEventHandler("onResourceStart", thisResource, function(event, resource) {
|
||||
if(gta.game == GAME_GTA_SA) {
|
||||
@@ -115,13 +115,13 @@ bindEventHandler("onResourceStart", thisResource, function(event, resource) {
|
||||
addEventHandler("onProcess", processEvent);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
bindEventHandler("onResourceStop", thisResource, function(event, resource) {
|
||||
removeEventHandler("onProcess");
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("onKeyUp", function(event, virtualKey, physicalKey, keyModifiers) {
|
||||
if(usingSkinSelector) {
|
||||
@@ -142,21 +142,21 @@ addEventHandler("onKeyUp", function(event, virtualKey, physicalKey, keyModifiers
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.cameraLookAt", function(cameraPosition, cameraLookat) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Set camera to look at ${cameraPosition.x}, ${cameraPosition.y}, ${cameraPosition.z}`);
|
||||
gta.setCameraLookAt(cameraPosition, cameraLookat, true);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.restoreCamera", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Camera restored`);
|
||||
gta.restoreCamera(true);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.clearPeds", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Clearing all self-owned peds ...`);
|
||||
@@ -164,14 +164,14 @@ addNetworkHandler("ag.clearPeds", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] All self-owned peds cleared`);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.logo", function(state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
||||
renderLogo = state;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.ambience", function(state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
|
||||
@@ -183,7 +183,7 @@ addNetworkHandler("ag.ambience", function(state) {
|
||||
clearSelfOwnedPeds();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.runCode", function(code, returnTo) {
|
||||
let returnValue = "Nothing";
|
||||
@@ -223,7 +223,7 @@ addNetworkHandler("ag.clearWeapons", function() {
|
||||
forceWeaponClipAmmo = 0;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.giveWeapon", function(weaponId, ammo, active) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Giving weapon ${weaponId} with ${ammo} ammo`);
|
||||
@@ -233,7 +233,7 @@ addNetworkHandler("ag.giveWeapon", function(weaponId, ammo, active) {
|
||||
forceWeapon = weaponId;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnElementStreamIn", function(event, element) {
|
||||
switch(element.type) {
|
||||
@@ -258,7 +258,7 @@ addEventHandler("OnElementStreamIn", function(event, element) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.blips", function(blipData) {
|
||||
for(let i in blipData) {
|
||||
@@ -266,7 +266,7 @@ addNetworkHandler("ag.blips", function(blipData) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showIslandBlips() {
|
||||
for(let i in allServerBlips) {
|
||||
@@ -278,7 +278,7 @@ function showIslandBlips() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getIslandFromPosition(position) {
|
||||
switch(gta.game) {
|
||||
@@ -295,28 +295,28 @@ function getIslandFromPosition(position) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.position", function(position) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
localPlayer.position = position;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.position", function(position) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
localPlayer.position = position;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.heading", function(heading) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting heading to ${heading}`);
|
||||
localPlayer.heading = heading;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.interior", function(interior) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Interior set to ${interior}`);
|
||||
@@ -324,14 +324,14 @@ addNetworkHandler("ag.interior", function(interior) {
|
||||
gta.cameraInterior = interior;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.removeFromVehicle", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Removing local player from vehicle`);
|
||||
localPlayer.removeFromVehicle();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function processEvent(event, deltaTime) {
|
||||
if(gta.game != GAME_GTA_IV) {
|
||||
@@ -430,7 +430,7 @@ function processEvent(event, deltaTime) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnDrawnHUD", function (event) {
|
||||
if(!renderHUD) {
|
||||
@@ -489,7 +489,7 @@ addEventHandler("OnDrawnHUD", function (event) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function openAllGarages() {
|
||||
switch(gta.game) {
|
||||
@@ -518,7 +518,7 @@ function openAllGarages() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function closeAllGarages() {
|
||||
switch(gta.game) {
|
||||
@@ -547,14 +547,14 @@ function closeAllGarages() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.freeze", function(state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting frozen state to ${state}`);
|
||||
gui.showCursor(state, !state);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.control", function(controlState, cursorState = false) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting control state to ${controlState} (Cursor: ${cursorState})`);
|
||||
@@ -564,21 +564,21 @@ addNetworkHandler("ag.control", function(controlState, cursorState = false) {
|
||||
localPlayer.invincible = false;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.fadeCamera", function(state, time) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Fading camera ${(state)?"in":"out"} for ${time} seconds`);
|
||||
gta.fadeCamera(state, time);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnPedWasted", function(event, wastedPed, killerPed, weapon, pedPiece) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Ped ${wastedPed.name} died`);
|
||||
wastedPed.clearWeapons();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showBusStop", function(position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Showing bus stop`);
|
||||
@@ -592,7 +592,7 @@ addNetworkHandler("ag.showBusStop", function(position, colour) {
|
||||
jobRouteStopBlip = gta.createBlip(position, 0, 2, colour);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.snow", function(fallingSnow, groundSnow) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting falling snow to ${fallingSnow} and ground snow to ${groundSnow}`);
|
||||
@@ -602,28 +602,28 @@ addNetworkHandler("ag.snow", function(fallingSnow, groundSnow) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.money", function(amount) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting local player money`);
|
||||
localPlayer.money = amount;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.removeWorldObject", function(model, position, range) {
|
||||
logToConsole(LOG_DEBUG, `Removing world object ${model} at X: ${position.x}, Y: ${position.x}, Z: ${position.x} with range of ${range}`);
|
||||
gta.removeWorldObject(model, position, range);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.excludeGroundSnow", function(model) {
|
||||
logToConsole(LOG_DEBUG, `Disabling ground snow for object model ${model}`);
|
||||
groundSnow.excludeModel(model);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnLocalPlayerEnterSphere", function(event, sphere) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Local player entered sphere`);
|
||||
@@ -632,7 +632,7 @@ addEventHandler("OnLocalPlayerEnterSphere", function(event, sphere) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.smallGameMessage", function(text, colour, duration) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Showing small game message '${text}' for ${duration}ms`);
|
||||
@@ -650,7 +650,7 @@ addNetworkHandler("ag.smallGameMessage", function(text, colour, duration) {
|
||||
}, duration);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enteredJobRouteSphere() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Entered job route sphere`);
|
||||
@@ -661,21 +661,21 @@ function enteredJobRouteSphere() {
|
||||
jobRouteStopBlip = null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.jobType", function(tempJobType) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Set local player job type to ${tempJobType}`);
|
||||
localPlayerJobType = tempJobType;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.working", function(tempWorking) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting working state to ${tempWorking}`);
|
||||
localPlayerWorking = tempWorking;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.spawned", function(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Setting spawned state to ${state}`);
|
||||
@@ -716,21 +716,21 @@ addNetworkHandler("ag.spawned", function(client, state) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.weaponDamageEvent", function(clientName, eventType) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Set ${clientName} damage event type to ${eventType}`);
|
||||
weaponDamageEvent[clientName] = eventType;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.weaponDamageEnabled", function(clientName, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] ${(state)?"Enabled":"Disabled"} damage from ${clientName}`);
|
||||
weaponDamageEnabled[clientName] = state;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.mouseCamera", function(state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] ${(state)?"Enabled":"Disabled"} mouse camera`);
|
||||
@@ -738,14 +738,14 @@ addNetworkHandler("ag.mouseCamera", function(state) {
|
||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.mouseCursor", function(state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] ${(state)?"Enabled":"Disabled"} mouse cursor`);
|
||||
gui.showCursor(state, !state);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearSelfOwnedPeds() {
|
||||
logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
|
||||
@@ -756,7 +756,7 @@ function clearSelfOwnedPeds() {
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.set2DRendering", function(hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||
@@ -770,7 +770,7 @@ addNetworkHandler("ag.set2DRendering", function(hudState, labelState, smallGameM
|
||||
renderItemActionDelay = itemActionDelayState;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getLocalPlayerVehicleSeat() {
|
||||
for(let i = 0 ; i <= 4 ; i++) {
|
||||
@@ -780,7 +780,7 @@ function getLocalPlayerVehicleSeat() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnPedInflictDamage", function(event, damagedEntity, damagerEntity, weaponId, healthLoss, pedPiece) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] ${damagerEntity.name} (${damagerEntity.name}, ${damagerEntity.type} - ${typeof damagerEntity}) damaged ${damagedEntity} (${damagedEntity.name}, ${damagedEntity.type} - ${typeof damagedEntity}) at part ${pedPiece} with weapon ${weaponId}`);
|
||||
@@ -796,7 +796,7 @@ addEventHandler("OnPedInflictDamage", function(event, damagedEntity, damagerEnti
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnLocalPlayerExitedVehicle", function(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Local player exited vehicle`);
|
||||
@@ -807,7 +807,7 @@ addEventHandler("OnLocalPlayerExitedVehicle", function(event, vehicle, seat) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("OnLocalPlayerEnteredVehicle", function(event, vehicle, seat) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Local player entered vehicle`);
|
||||
@@ -824,7 +824,7 @@ addEventHandler("OnLocalPlayerEnteredVehicle", function(event, vehicle, seat) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.showItemActionDelay", function(duration) {
|
||||
itemActionDelayDuration = duration;
|
||||
@@ -833,13 +833,13 @@ addNetworkHandler("ag.showItemActionDelay", function(duration) {
|
||||
logToConsole(LOG_DEBUG, `Item action delay started. Duration: ${itemActionDelayDuration}, Start: ${itemActionDelayStart}, Rendering Enabled: ${renderItemActionDelay}`);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getWeaponSlot(weaponId) {
|
||||
return getGameData().weaponSlots[gta.game][weaponId];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.drunkEffect", function(amount, duration) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Drunk effect set to ${amount} for ${duration}ms`);
|
||||
@@ -855,27 +855,27 @@ addNetworkHandler("ag.drunkEffect", function(amount, duration) {
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.clearPedState", function() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Clearing local ped state`);
|
||||
localPlayer.clearObjective();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.pedSpeech", function(pedName, speechId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Making ${pedName}'s ped talk (${speechId})`);
|
||||
gta.SET_CHAR_SAY(int, int)
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.hotbar", function(activeSlot, itemsArray) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Main] Updating hotbar`);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPedFromNetworkEvent(ped) {
|
||||
//let peds = getPeds();
|
||||
@@ -886,7 +886,7 @@ function getPedFromNetworkEvent(ped) {
|
||||
return getElementFromId(ped);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.skinSelect", function() {
|
||||
usingSkinSelector = true;
|
||||
@@ -898,4 +898,10 @@ addNetworkHandler("ag.skinSelect", function() {
|
||||
localPlayer.collisionsEnabled = false;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isSnowEnabled() {
|
||||
return (typeof snowing != "undefined");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -3,7 +3,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: mouse-camera.js
|
||||
// DESC: Provides a freelook camera similar to SA for III and VC
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: nametags.js
|
||||
// DESC: Provides nametag rendering
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: scoreboard.js
|
||||
// DESC: Provides scoreboard features and rendering
|
||||
// TYPE: Client (JavaScript)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: sync.js
|
||||
// DESC: Provides some elements and data sync
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addEventHandler("onProcess", function(event, deltaTime) {
|
||||
if(localPlayer != null && isSpawned) {
|
||||
@@ -24,25 +24,25 @@ addEventHandler("onProcess", function(event, deltaTime) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.veh.engine", function(vehicle, state) {
|
||||
vehicle.engine = state;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.veh.lights", function(vehicle, state) {
|
||||
vehicle.lights = state;
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.veh.repair", function(syncId) {
|
||||
getVehicleFromSyncId(syncId).fix();
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.veh.sync", function(event, vehicle) {
|
||||
if(vehicle != null) {
|
||||
@@ -50,7 +50,7 @@ addNetworkHandler("ag.veh.sync", function(event, vehicle) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.civ.sync", function(event, civilian) {
|
||||
if(civilian != null) {
|
||||
@@ -58,7 +58,7 @@ addNetworkHandler("ag.civ.sync", function(event, civilian) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.player.sync", function(event, player) {
|
||||
if(player != null) {
|
||||
@@ -66,7 +66,7 @@ addNetworkHandler("ag.player.sync", function(event, player) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addNetworkHandler("ag.obj.sync", function(event, object) {
|
||||
if(object != null) {
|
||||
@@ -74,7 +74,7 @@ addNetworkHandler("ag.obj.sync", function(event, object) {
|
||||
}
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(doesEntityDataExist(vehicle, "ag.panelStatus")) {
|
||||
@@ -122,7 +122,7 @@ function syncVehicleProperties(vehicle) {
|
||||
//gta.REMOVE_UPSIDEDOWN_CAR_CHECK(gta.GET_VEHICLE_ID(vehicle));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncCivilianProperties(civilian) {
|
||||
if(doesEntityDataExist(civilian, "ag.scale")) {
|
||||
@@ -164,7 +164,7 @@ function syncCivilianProperties(civilian) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(player) {
|
||||
if(doesEntityDataExist(player, "ag.scale")) {
|
||||
@@ -203,7 +203,7 @@ function syncPlayerProperties(player) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncObjectProperties(object) {
|
||||
if(doesEntityDataExist(object, "ag.scale")) {
|
||||
@@ -217,4 +217,4 @@ function syncObjectProperties(object) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,28 +2,28 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: client.js
|
||||
// DESC: Provides wrapped client natives for GTAC
|
||||
// TYPE: Natives (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientGame() {
|
||||
return gta.game;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendToServer(eventName, ...args) {
|
||||
triggerNetworkEvent.call(eventName, args);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function receiveFromServer(eventName, handlerFunction) {
|
||||
addNetworkHandler(eventName, handlerFunction);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: native.js
|
||||
// DESC: Provides util function to wrap mod-specific stuff
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
// Use data for each because args are probably gonna be way different for each mod
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getServerGame() {
|
||||
return server.game;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerPosition(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -28,14 +28,14 @@ function getPlayerPosition(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerPosition(client, position) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
sendPlayerSetPosition(client, position);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHeading(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -47,14 +47,14 @@ function getPlayerHeading(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerHeading(client, heading) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s heading to ${heading}`);
|
||||
sendPlayerSetHeading(client, heading);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -67,13 +67,13 @@ function getPlayerVehicle(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerDimension(client) {
|
||||
return client.player.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerInterior(client) {
|
||||
if(getPlayerData(client)) {
|
||||
@@ -83,14 +83,14 @@ function getPlayerInterior(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerDimension(client, dimension) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
||||
client.player.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerInterior(client, interior) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
||||
@@ -98,7 +98,7 @@ function setPlayerInterior(client, interior) {
|
||||
getPlayerCurrentSubAccount(client).interior = interior;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -108,7 +108,7 @@ function isPlayerInAnyVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicleSeat(client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -124,37 +124,37 @@ function getPlayerVehicleSeat(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSpawned(client) {
|
||||
return (client.player != null);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehiclePosition(vehicle) {
|
||||
return vehicle.position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleHeading(vehicle) {
|
||||
return vehicle.heading;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleSyncer(vehicle) {
|
||||
return getElementSyncer(vehicle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleForNetworkEvent(vehicle) {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGameElement(element) {
|
||||
logToConsole(LOG_DEBUG, `Destroying game element ${element.id} (Type: ${element.type})`);
|
||||
@@ -165,13 +165,13 @@ function deleteGameElement(element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInFrontVehicleSeat(client) {
|
||||
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromVehicle(client) {
|
||||
logToConsole(LOG_DEBUG, `Removing ${getPlayerDisplayForConsole(client)} from their vehicle`);
|
||||
@@ -179,20 +179,20 @@ function removePlayerFromVehicle(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerSkin(client, skin) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${skin} (${getSkinNameFromId(skin)})`);
|
||||
client.player.modelIndex = skin;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerSkin(client) {
|
||||
return client.player.modelIndex;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function disconnectPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `Disconnecting (kicking) ${getPlayerDisplayForConsole(client)}`);
|
||||
@@ -200,44 +200,44 @@ function disconnectPlayer(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementSyncer(element) {
|
||||
return getClients()[element.syncer];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerWeaponAmmo(client) {
|
||||
return client.player.weaponAmmunition;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerVelocity(client, velocity) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
||||
client.player.velocity = velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVelocity(client, velocity) {
|
||||
return client.player.velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementDimension(element) {
|
||||
return element.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setElementDimension(element, dimension) {
|
||||
return element.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerHealth(client, amount) {
|
||||
if(getPlayerHealth(client)+amount > 100) {
|
||||
@@ -249,7 +249,7 @@ function givePlayerHealth(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerArmour(client, amount) {
|
||||
if(getPlayerArmour(client)+amount > 100) {
|
||||
@@ -261,16 +261,16 @@ function givePlayerArmour(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendToClient(client, eventName, ...args) {
|
||||
triggerNetworkEvent.call(client, eventName, args);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function receiveFromClient(eventName, handlerFunction) {
|
||||
addNetworkHandler(eventName, handlerFunction);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: native.js
|
||||
// DESC: Provides util funcs for native wrapping
|
||||
// TYPE: Shared (JavaScript)
|
||||
@@ -11,97 +11,97 @@
|
||||
"use strict";
|
||||
setErrorMode(RESOURCEERRORMODE_STRICT);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function and(var1, var2) {
|
||||
return (var1 && var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function or(var1, var2) {
|
||||
return (var1 || var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function not(var1) {
|
||||
return !var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitAnd(var1, var2) {
|
||||
return var1 & var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitOr(var1, var2) {
|
||||
return var1 | var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitXor(var1, var2) {
|
||||
return var1 ^ var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitNot(var1) {
|
||||
return ~var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitLeftShift(var1, var2) {
|
||||
return var1 << var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitRightShift(var1, var2) {
|
||||
return var1 >> var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThan(var1, var2) {
|
||||
return var1 > var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThan(var1, var2) {
|
||||
return (var1 < var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThanOrEqualTo(var1, var2) {
|
||||
return (var1 >= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThanOrEqualTo(var1, var2) {
|
||||
return (var1 <= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function equals(var1, var2) {
|
||||
return (var1 == var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function modulo(var1, var2) {
|
||||
return var1 % var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function add(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -109,7 +109,7 @@ function add(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function subtract(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -117,7 +117,7 @@ function subtract(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function multiply(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -125,7 +125,7 @@ function multiply(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function divide(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -133,55 +133,55 @@ function divide(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toArray(...args) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toInteger(val) {
|
||||
return Number(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toFloat(val, fixed = 2) {
|
||||
return parseFloat((val).toFixed(fixed));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toString(val) {
|
||||
return String(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector3(x, y, z) {
|
||||
return new Vec3(x, y, z);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector2(x, y) {
|
||||
return new Vec2(x, y);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toUpperCase(val) {
|
||||
return String(val).toUpperCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toLowerCase(val) {
|
||||
return String(val).toLowerCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isNull(val) {
|
||||
if(val == null) {
|
||||
@@ -195,7 +195,7 @@ function isNull(val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -206,7 +206,7 @@ function getEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
@@ -218,7 +218,7 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -227,7 +227,7 @@ function removeEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesEntityDataExist(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -236,7 +236,7 @@ function doesEntityDataExist(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getDistance(vec1, vec2) {
|
||||
if(isNull(vec1) || isNull(vec2)) {
|
||||
@@ -245,7 +245,7 @@ function getDistance(vec1, vec2) {
|
||||
return vec1.distance(vec2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isConsole(client) {
|
||||
if(client == null) {
|
||||
@@ -255,7 +255,7 @@ function isConsole(client) {
|
||||
return client.console;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function logToConsole(tempLogLevel, text) {
|
||||
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
|
||||
@@ -273,13 +273,13 @@ function logToConsole(tempLogLevel, text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isSamePlayer(client1, client2) {
|
||||
return (client1 == client2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientFromIndex(index) {
|
||||
let clients = getClients();
|
||||
@@ -290,7 +290,7 @@ function getClientFromIndex(index) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getConsoleClient() {
|
||||
let clients = getClients();
|
||||
@@ -301,7 +301,7 @@ function getConsoleClient() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFromParams(params) {
|
||||
let clients = getPlayers();
|
||||
@@ -326,7 +326,7 @@ function getPlayerFromParams(params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayers() {
|
||||
return getClients();
|
||||
|
||||
@@ -2,28 +2,28 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: client.js
|
||||
// DESC: Provides wrapped client natives for RAGEMP
|
||||
// TYPE: Natives (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientGame() {
|
||||
return AG_GAME_GTA_V;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendToServer(eventName, ...args) {
|
||||
mp.events.call(eventName, args);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function receiveFromServer(eventName, handlerFunction) {
|
||||
mp.events.add(eventName, handlerFunction);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,32 +2,32 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: server.js
|
||||
// DESC: Provides wrapped server natives for RAGEMP
|
||||
// TYPE: Natives (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getServerGame() {
|
||||
return AG_GAME_GTA_V;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerPosition(client) {
|
||||
return client.player.position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerPosition(client, position) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
client.position = position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHeading(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -39,14 +39,14 @@ function getPlayerHeading(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerHeading(client, heading) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s heading to ${heading}`);
|
||||
sendPlayerSetHeading(client, heading);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -59,13 +59,13 @@ function getPlayerVehicle(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerDimension(client) {
|
||||
return client.player.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerInterior(client) {
|
||||
if(getPlayerData(client)) {
|
||||
@@ -75,14 +75,14 @@ function getPlayerInterior(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerDimension(client, dimension) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
||||
client.player.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerInterior(client, interior) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
||||
@@ -90,7 +90,7 @@ function setPlayerInterior(client, interior) {
|
||||
getPlayerCurrentSubAccount(client).interior = interior;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -100,7 +100,7 @@ function isPlayerInAnyVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicleSeat(client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -116,37 +116,37 @@ function getPlayerVehicleSeat(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSpawned(client) {
|
||||
return (client.player != null);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehiclePosition(vehicle) {
|
||||
return vehicle.position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleHeading(vehicle) {
|
||||
return vehicle.heading;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleSyncer(vehicle) {
|
||||
return getElementSyncer(vehicle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleForNetworkEvent(vehicle) {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGameElement(element) {
|
||||
logToConsole(LOG_DEBUG, `Destroying game element ${element.id} (Type: ${element.type})`);
|
||||
@@ -157,13 +157,13 @@ function deleteGameElement(element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInFrontVehicleSeat(client) {
|
||||
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromVehicle(client) {
|
||||
logToConsole(LOG_DEBUG, `Removing ${getPlayerDisplayForConsole(client)} from their vehicle`);
|
||||
@@ -171,20 +171,20 @@ function removePlayerFromVehicle(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerSkin(client, skin) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${skin} (${getSkinNameFromId(skin)})`);
|
||||
client.player.modelIndex = skin;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerSkin(client) {
|
||||
return client.player.modelIndex;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function disconnectPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `Disconnecting (kicking) ${getPlayerDisplayForConsole(client)}`);
|
||||
@@ -192,44 +192,44 @@ function disconnectPlayer(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementSyncer(element) {
|
||||
return getClients()[element.syncer];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerWeaponAmmo(client) {
|
||||
return client.player.weaponAmmunition;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerVelocity(client, velocity) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
||||
client.player.velocity = velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVelocity(client, velocity) {
|
||||
return client.player.velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementDimension(element) {
|
||||
return element.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setElementDimension(element, dimension) {
|
||||
return element.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerHealth(client, amount) {
|
||||
if(getPlayerHealth(client)+amount > 100) {
|
||||
@@ -241,7 +241,7 @@ function givePlayerHealth(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerArmour(client, amount) {
|
||||
if(getPlayerArmour(client)+amount > 100) {
|
||||
@@ -253,4 +253,4 @@ function givePlayerArmour(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: native.js
|
||||
// DESC: Provides util funcs for native wrapping
|
||||
// TYPE: Shared (JavaScript)
|
||||
@@ -11,97 +11,97 @@
|
||||
"use strict";
|
||||
setErrorMode(RESOURCEERRORMODE_STRICT);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function and(var1, var2) {
|
||||
return (var1 && var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function or(var1, var2) {
|
||||
return (var1 || var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function not(var1) {
|
||||
return !var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitAnd(var1, var2) {
|
||||
return var1 & var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitOr(var1, var2) {
|
||||
return var1 | var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitXor(var1, var2) {
|
||||
return var1 ^ var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitNot(var1) {
|
||||
return ~var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitLeftShift(var1, var2) {
|
||||
return var1 << var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitRightShift(var1, var2) {
|
||||
return var1 >> var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThan(var1, var2) {
|
||||
return var1 > var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThan(var1, var2) {
|
||||
return (var1 < var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThanOrEqualTo(var1, var2) {
|
||||
return (var1 >= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThanOrEqualTo(var1, var2) {
|
||||
return (var1 <= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function equals(var1, var2) {
|
||||
return (var1 == var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function modulo(var1, var2) {
|
||||
return var1 % var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function add(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -109,7 +109,7 @@ function add(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function subtract(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -117,7 +117,7 @@ function subtract(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function multiply(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -125,7 +125,7 @@ function multiply(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function divide(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -133,55 +133,55 @@ function divide(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toArray(...args) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toInteger(val) {
|
||||
return Number(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toFloat(val, fixed = 2) {
|
||||
return parseFloat((val).toFixed(fixed));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toString(val) {
|
||||
return String(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector3(x, y, z) {
|
||||
return new Vec3(x, y, z);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector2(x, y) {
|
||||
return new Vec2(x, y);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toUpperCase(val) {
|
||||
return String(val).toUpperCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toLowerCase(val) {
|
||||
return String(val).toLowerCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isNull(val) {
|
||||
if(val == null) {
|
||||
@@ -195,7 +195,7 @@ function isNull(val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -206,7 +206,7 @@ function getEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
@@ -218,7 +218,7 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -227,7 +227,7 @@ function removeEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesEntityDataExist(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -236,7 +236,7 @@ function doesEntityDataExist(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getDistance(vec1, vec2) {
|
||||
if(isNull(vec1) || isNull(vec2)) {
|
||||
@@ -245,7 +245,7 @@ function getDistance(vec1, vec2) {
|
||||
return vec1.distance(vec2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isConsole(client) {
|
||||
if(client == null) {
|
||||
@@ -255,7 +255,7 @@ function isConsole(client) {
|
||||
return client.console;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function logToConsole(tempLogLevel, text) {
|
||||
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
|
||||
@@ -273,13 +273,13 @@ function logToConsole(tempLogLevel, text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isSamePlayer(client1, client2) {
|
||||
return (client1 == client2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientFromIndex(index) {
|
||||
let clients = getClients();
|
||||
@@ -290,7 +290,7 @@ function getClientFromIndex(index) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getConsoleClient() {
|
||||
let clients = getClients();
|
||||
@@ -301,7 +301,7 @@ function getConsoleClient() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFromParams(params) {
|
||||
let clients = getClients();
|
||||
@@ -326,10 +326,10 @@ function getPlayerFromParams(params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayers() {
|
||||
return getClients();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: accent.js
|
||||
// DESC: Provides accent functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -33,10 +33,10 @@ let accents = [
|
||||
"Sicilian",
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerAccentText(client) {
|
||||
return getPlayerCurrentSubAccount(client).accent;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: account.js
|
||||
// DESC: Provides account functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -13,7 +13,7 @@ function initAccountScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Account]: Account script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loginCommand(command, params, client) {
|
||||
if(!isPlayerRegistered(client)) {
|
||||
@@ -30,7 +30,7 @@ function loginCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function autoLoginByIPCommand(command, params, client) {
|
||||
let flagValue = getAccountSettingsFlagValue("autoLoginIP");
|
||||
@@ -45,7 +45,7 @@ function autoLoginByIPCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function autoSelectLastCharacterCommand(command, params, client) {
|
||||
let flagValue = getAccountSettingsFlagValue("autoSelectLastCharacter");
|
||||
@@ -60,7 +60,7 @@ function autoSelectLastCharacterCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleAccountGUICommand(command, params, client) {
|
||||
let flagValue = getAccountSettingsFlagValue("noGUI");
|
||||
@@ -97,7 +97,7 @@ function toggleAccountGUICommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleAccountServerLogoCommand(command, params, client) {
|
||||
let flagValue = getAccountSettingsFlagValue("noServerLogo");
|
||||
@@ -119,7 +119,7 @@ function toggleAccountServerLogoCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
// UNFINISHED!
|
||||
// TO-DO: Make GUI, add command to generate code to add to auth app and command to input code returned by auth app
|
||||
@@ -152,7 +152,7 @@ function toggleAccountTwoFactorAuthCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function registerCommand(command, params, client) {
|
||||
if(isPlayerRegistered(client)) {
|
||||
@@ -171,7 +171,7 @@ function registerCommand(command, params, client) {
|
||||
//messagePlayerAlert(client, "To play on the server, you will need to make a character.");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function changePasswordCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -198,7 +198,7 @@ function changePasswordCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, "Your password has been changed!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAccountEmailCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -236,7 +236,7 @@ function setAccountEmailCommand(command, params, client) {
|
||||
saveAccountToDatabase(getPlayerData(client).accountData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function verifyAccountEmailCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -268,7 +268,7 @@ function verifyAccountEmailCommand(command, params, client) {
|
||||
saveAccountToDatabase(getPlayerData(client).accountData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAccountDiscordCommand(command, params, client) {
|
||||
messagePlayerError(client, `This command is not yet finished and will be available soon!`);
|
||||
@@ -292,7 +292,7 @@ function setAccountDiscordCommand(command, params, client) {
|
||||
//messagePlayerSuccess(client, "Your discord account has been attached to your game account!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerLoggedIn(client) {
|
||||
if(isConsole(client)) {
|
||||
@@ -306,7 +306,7 @@ function isPlayerLoggedIn(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerRegistered(client) {
|
||||
if(isConsole(client)) {
|
||||
@@ -322,14 +322,14 @@ function isPlayerRegistered(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPasswordMeetRequirements(password) {
|
||||
// Will be added soon
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountPasswordCorrect(accountData, password) {
|
||||
if(accountData.password == password) {
|
||||
@@ -339,7 +339,7 @@ function isAccountPasswordCorrect(accountData, password) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountFromName(accountName, fullLoad = false) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -367,7 +367,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountFromId(accountId, fullLoad = false) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -393,7 +393,7 @@ function loadAccountFromId(accountId, fullLoad = false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getAccountHashingFunction() {
|
||||
switch(toLowerCase(getGlobalConfig().accountPasswordHash)) {
|
||||
@@ -432,7 +432,7 @@ function getAccountHashingFunction() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isNameRegistered(name) {
|
||||
let accountData = loadAccountFromName(name, true);
|
||||
@@ -443,7 +443,7 @@ function isNameRegistered(name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function hashAccountPassword(name, password) {
|
||||
let hashFunction = getAccountHashingFunction();
|
||||
@@ -451,13 +451,13 @@ function hashAccountPassword(name, password) {
|
||||
return hashFunction(saltedInfo);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saltAccountInfo(name, password) {
|
||||
return "ag.gaming." + toString(accountSaltHash) + "." + toString(name) + "." + toString(password);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loginSuccess(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account] ${getPlayerDisplayForConsole(client)} successfully logged in.`);
|
||||
@@ -489,7 +489,7 @@ function loginSuccess(client) {
|
||||
messagePlayerNormal(null, `👋 ${client.name} has joined the server`, getColourByName("softYellow"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAccountToDatabase(accountData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -525,7 +525,7 @@ function saveAccountToDatabase(accountData) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAccountKeyBindsDatabase(keyBindData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -548,7 +548,7 @@ function saveAccountKeyBindsDatabase(keyBindData) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAccountStaffNotesDatabase(staffNoteData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -566,7 +566,7 @@ function saveAccountStaffNotesDatabase(staffNoteData) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
/*
|
||||
function saveAccountContactsDatabase(accountContactData) {
|
||||
@@ -589,7 +589,7 @@ function saveAccountContactsDatabase(accountContactData) {
|
||||
}
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAccount(name, password, email = "") {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -610,7 +610,7 @@ function createAccount(name, password, email = "") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkLogin(client, password) {
|
||||
getPlayerData(client).loginAttemptsRemaining = getPlayerData(client).loginAttemptsRemaining-1;
|
||||
@@ -672,7 +672,7 @@ function checkLogin(client, password) {
|
||||
loginSuccess(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkRegistration(client, password, confirmPassword = "", emailAddress = "") {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Account]: Checking registration for " + toString(client.name));
|
||||
@@ -769,13 +769,13 @@ function checkRegistration(client, password, confirmPassword = "", emailAddress
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isValidEmailAddress(emailAddress) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllClientsToDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Account]: Saving all clients to database ...");
|
||||
@@ -785,7 +785,7 @@ function saveAllClientsToDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Account]: All clients saved to database successfully!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function savePlayerToDatabase(client) {
|
||||
if(getPlayerData(client) == null) {
|
||||
@@ -815,7 +815,7 @@ function savePlayerToDatabase(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initClient(client) {
|
||||
if(isConsole(client)) {
|
||||
@@ -867,14 +867,14 @@ function initClient(client) {
|
||||
}, 2500);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveConnectionToDatabase(client) {
|
||||
let dbQueryString = `INSERT INTO conn_main (conn_when_connect, conn_server, conn_script_version, conn_game_version, conn_client_version) VALUES (UNIX_TIMESTAMP(), ${getServerConfig().databaseId}, '${scriptVersion}', '${client.gameVersion}', '0.0.0')`;
|
||||
return quickDatabaseQuery(dbQueryString);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createDefaultKeybindsForAccount(accountDatabaseId) {
|
||||
for(let i in getGlobalConfig().defaultKeybinds) {
|
||||
@@ -883,7 +883,7 @@ function createDefaultKeybindsForAccount(accountDatabaseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account]: Loading account keybinds for account ${accountDatabaseID} from database ...`);
|
||||
@@ -912,7 +912,7 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
||||
return tempAccountKeybinds;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account]: Loading account staff notes for account ${accountDatabaseID} from database ...`);
|
||||
@@ -941,7 +941,7 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
||||
return tempAccountStaffNotes;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account]: Loading account contacts for account ${accountDatabaseID} from database ...`);
|
||||
@@ -970,7 +970,7 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
|
||||
return tempAccountContacts;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account]: Loading account messages for account ${accountDatabaseID} from database ...`);
|
||||
@@ -999,7 +999,7 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
||||
return tempAccountMessages;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountAutoIPLoginEnabled(accountData) {
|
||||
let accountSettings = accountData.settings;
|
||||
@@ -1007,7 +1007,7 @@ function isAccountAutoIPLoginEnabled(accountData) {
|
||||
return hasBitFlag(accountSettings, flagValue);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveGUIEnabled(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("noGUI"))) {
|
||||
@@ -1017,7 +1017,7 @@ function doesPlayerHaveGUIEnabled(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveLogoEnabled(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("noServerLogo"))) {
|
||||
@@ -1027,7 +1027,7 @@ function doesPlayerHaveLogoEnabled(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveAutoLoginByIPEnabled(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("autoLoginIP"))) {
|
||||
@@ -1037,7 +1037,7 @@ function doesPlayerHaveAutoLoginByIPEnabled(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveAutoSelectLastCharacterEnabled(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("autoSelectLastCharacter"))) {
|
||||
@@ -1047,44 +1047,44 @@ function doesPlayerHaveAutoSelectLastCharacterEnabled(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerStaffTitle(client) {
|
||||
return getPlayerData(client).accountData.staffTitle;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountEmailVerified(accountData) {
|
||||
return hasBitFlag(accountData.flags.moderation, getModerationFlagValue("emailVerified"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountTwoFactorAuthenticationVerified(accountData) {
|
||||
return hasBitFlag(accountData.flags.moderation, getModerationFlagValue("twoFactorAuthVerified"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAccountEmail(accountData, emailAddress) {
|
||||
accountData.emailAddress = emailAddress;
|
||||
accountData.emailVerificationCode = module.hashing.sha512(emailVerificationCode);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAccountEmailVerificationCode(accountData, emailVerificationCode) {
|
||||
accountData.emailVerificationCode = module.hashing.sha512(emailVerificationCode);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function generateEmailVerificationCode() {
|
||||
return generateRandomString(10);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendEmailVerificationEmail(client, emailVerificationCode) {
|
||||
let emailBodyText = getGlobalConfig().emailBody.confirmEmail;
|
||||
@@ -1093,7 +1093,7 @@ function sendEmailVerificationEmail(client, emailVerificationCode) {
|
||||
sendEmail(getPlayerData(client).accountData.emailAddress, getPlayerData(client).accountData.name, `Confirm email on Asshat Gaming RP`, emailBodyText);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function verifyAccountEmail(accountData, verificationCode) {
|
||||
let emailVerificationCode = generateRandomString(10);
|
||||
@@ -1107,4 +1107,4 @@ function verifyAccountEmail(accountData, verificationCode) {
|
||||
getPlayerData(client).accountData.emailVerificationCode = module.hashing.sha512(emailVerificationCode);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: anticheat.js
|
||||
// DESC: Provides anticheat functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -14,7 +14,7 @@ function initAntiCheatScript() {
|
||||
getServerData().antiCheat.blackListedGameScripts = loadAntiCheatGameScriptBlackListFromDatabase();
|
||||
logToConsole(LOG_DEBUG, "[Asshat.AntiCheat]: Anticheat script initialized!");
|
||||
}
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAntiCheatGameScriptWhiteListFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.AntiCheat] Loading whitelisted game scripts ...`);
|
||||
@@ -38,7 +38,7 @@ function loadAntiCheatGameScriptWhiteListFromDatabase() {
|
||||
return tempWhiteListedGameScripts;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAntiCheatGameScriptBlackListFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.AntiCheat] Loading blacklisted game scripts ...`);
|
||||
@@ -62,7 +62,7 @@ function loadAntiCheatGameScriptBlackListFromDatabase() {
|
||||
return tempBlackListedGameScripts;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerStateToEnterExitProperty(client) {
|
||||
if(getPlayerData(client).pedState != AG_PEDSTATE_READY) {
|
||||
@@ -75,4 +75,4 @@ function clearPlayerStateToEnterExitProperty(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,20 +2,20 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: bans.js
|
||||
// DESC: Provides ban functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initBanScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Ban]: Initializing ban script ...");
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Ban]: Ban script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function accountBanCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -34,7 +34,7 @@ function accountBanCommand(command, params, client) {
|
||||
disconnectPlayer(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -57,7 +57,7 @@ function subAccountBanCommand(command, params, client, fromDiscord) {
|
||||
disconnectPlayer(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function ipBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -81,7 +81,7 @@ function ipBanCommand(command, params, client, fromDiscord) {
|
||||
targetClient.disconnect();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function subNetBanCommand(command, params, client, fromDiscord) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -104,7 +104,7 @@ function subNetBanCommand(command, params, client, fromDiscord) {
|
||||
banSubNet(targetClient.ip, getSubNet(targetClient.ip, octetAmount), getPlayerData(client).accountData.databaseId, reason);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function banAccount(accountId, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -119,7 +119,7 @@ function banAccount(accountId, adminAccountId, reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function banSubAccount(subAccountId, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -134,7 +134,7 @@ function banSubAccount(subAccountId, adminAccountId, reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function banIPAddress(ipAddress, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -149,7 +149,7 @@ function banIPAddress(ipAddress, adminAccountId, reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -164,7 +164,7 @@ function banSubNet(ipAddressStart, ipAddressEnd, adminAccountId, reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unbanAccount(accountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -178,7 +178,7 @@ function unbanAccount(accountId, adminAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubAccount(subAccountId, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -192,7 +192,7 @@ function unbanSubAccount(subAccountId, adminAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unbanIPAddress(ipAddress, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -206,7 +206,7 @@ function unbanIPAddress(ipAddress, adminAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -220,7 +220,7 @@ function unbanSubNet(ipAddressStart, ipAddressEnd, adminAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isAccountBanned(accountId) {
|
||||
let bans = getServerData().bans;
|
||||
@@ -235,7 +235,7 @@ function isAccountBanned(accountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isSubAccountBanned(subAccountId) {
|
||||
let bans = getServerData().bans;
|
||||
@@ -250,7 +250,7 @@ function isSubAccountBanned(subAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isIpAddressBanned(ipAddress) {
|
||||
let bans = getServerData().bans;
|
||||
@@ -265,5 +265,5 @@ function isIpAddressBanned(ipAddress) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: bitflags.js
|
||||
// DESC: Provides bitwise operations, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let serverBitFlags = {
|
||||
staffFlags: {},
|
||||
@@ -20,7 +20,7 @@ let serverBitFlags = {
|
||||
accountFlags: {},
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let serverBitFlagKeys = {
|
||||
staffFlagKeys: [
|
||||
@@ -119,7 +119,7 @@ let serverBitFlagKeys = {
|
||||
subAccountSettingsFlagKeys: [],
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initBitFlagScript() {
|
||||
serverBitFlags.staffFlags = createBitFlagTable(serverBitFlagKeys.staffFlagKeys);
|
||||
@@ -132,13 +132,13 @@ function initBitFlagScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addBitFlagCommandHandlers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBitFlagTable(keyNames) {
|
||||
let bitVal = 0;
|
||||
@@ -154,7 +154,7 @@ function createBitFlagTable(keyNames) {
|
||||
return bitTable;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function hasBitFlag(allFlags, checkForFlag) {
|
||||
if(allFlags == 0) {
|
||||
@@ -168,7 +168,7 @@ function hasBitFlag(allFlags, checkForFlag) {
|
||||
return (allFlags & checkForFlag);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveStaffPermission(client, requiredFlags) {
|
||||
if(isConsole(client)) {
|
||||
@@ -196,7 +196,7 @@ function doesPlayerHaveStaffPermission(client, requiredFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveClanPermission(client, requiredFlags) {
|
||||
if(isConsole(client)) {
|
||||
@@ -226,7 +226,7 @@ function doesPlayerHaveClanPermission(client, requiredFlags) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getStaffFlagValue(flagName) {
|
||||
if(flagName == "all") {
|
||||
@@ -240,7 +240,7 @@ function getStaffFlagValue(flagName) {
|
||||
return serverBitFlags.staffFlags[flagName];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClanFlagValue(flagName) {
|
||||
if(flagName == "all") {
|
||||
@@ -254,7 +254,7 @@ function getClanFlagValue(flagName) {
|
||||
return getServerBitFlags().clanFlags[flagName];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getAccountSettingsFlagValue(flagName) {
|
||||
if(flagName == "all") {
|
||||
@@ -268,7 +268,7 @@ function getAccountSettingsFlagValue(flagName) {
|
||||
return serverBitFlags.accountSettingsFlags[flagName];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getModerationFlagValue(flagName) {
|
||||
if(flagName == "all") {
|
||||
@@ -282,7 +282,7 @@ function getModerationFlagValue(flagName) {
|
||||
return serverBitFlags.moderationFlags[flagName];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerStaffFlag(client, flagName) {
|
||||
if(!getStaffFlagValue(flagName)) {
|
||||
@@ -293,7 +293,7 @@ function givePlayerStaffFlag(client, flagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takePlayerStaffFlag(client, flagName) {
|
||||
if(!getStaffFlagValue(flagName)) {
|
||||
@@ -304,19 +304,19 @@ function takePlayerStaffFlag(client, flagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addBitFlag(allFlags, flagValue) {
|
||||
return allFlags | flagValue;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeBitFlag(allFlags, flagValue) {
|
||||
return allFlags & ~flagValue;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takePlayerStaffFlag(client, flagName) {
|
||||
if(!getStaffFlagValue(flagName)) {
|
||||
@@ -327,23 +327,39 @@ function takePlayerStaffFlag(client, flagName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerStaffFlags(client) {
|
||||
getPlayerData(client).accountData.flags.admin = getStaffFlagValue("none");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getServerBitFlags() {
|
||||
return serverBitFlags;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getServerBitFlagKeys() {
|
||||
return serverBitFlagKeys;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBitwiseTable(tableKeys) {
|
||||
let bitVal = 0;
|
||||
let bitTable = {};
|
||||
let incVal = 1;
|
||||
|
||||
for(let i in tableKeys) {
|
||||
let key = tableKeys[i];
|
||||
bitTable[key] = bitVal;
|
||||
bitVal = 1 << incVal;
|
||||
incVal++;
|
||||
}
|
||||
return bitTable;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: business.js
|
||||
// DESC: Provides business functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -26,7 +26,7 @@ function initBusinessScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadBusinessFromId(businessId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -44,7 +44,7 @@ function loadBusinessFromId(businessId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadBusinessesFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Business]: Loading businesses from database ...");
|
||||
@@ -74,7 +74,7 @@ function loadBusinessesFromDatabase() {
|
||||
return tempBusinesses;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadBusinessLocationsFromDatabase(businessId) {
|
||||
//logToConsole(LOG_DEBUG, "[Asshat.Business]: Loading locations from database ...");
|
||||
@@ -103,7 +103,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
||||
return tempBusinessLocations;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessCommand(command, params, client) {
|
||||
let tempBusinessData = createBusiness(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].business, getGameConfig().blipSprites[getServerGame()].business, getPlayerInterior(client), getPlayerDimension(client));
|
||||
@@ -119,7 +119,7 @@ function createBusinessCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created business [#0099FF]${tempBusinessData.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessLocationCommand(command, params, client) {
|
||||
if(!isPlayerSpawned(client)) {
|
||||
@@ -145,7 +145,7 @@ function createBusinessLocationCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created location [#0099FF]${params} [#FFFFFF]for business [#0099FF]${tempBusinessData.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1) {
|
||||
let tempBusinessData = new serverClasses.businessData(false);
|
||||
@@ -168,7 +168,7 @@ function createBusiness(name, entrancePosition, exitPosition, entrancePickupMode
|
||||
return tempBusinessData;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -186,7 +186,7 @@ function deleteBusinessCommand(command, params, client) {
|
||||
deleteBusiness(businessId, getPlayerData(client).accountData.databaseId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessLocationCommand(command, params, client) {
|
||||
//let businessId = toInteger(splitParams[1]);
|
||||
@@ -194,7 +194,7 @@ function deleteBusinessLocationCommand(command, params, client) {
|
||||
//messagePlayerSuccess(client, `Business '${tempBusinessData.name} deleted!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessNameCommand(command, params, client) {
|
||||
let newBusinessName = toString(params);
|
||||
@@ -212,7 +212,7 @@ function setBusinessNameCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]renamed business [#0099FF]${oldBusinessName} [#FFFFFF]to [#0099FF]${newBusinessName}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessOwnerCommand(command, params, client) {
|
||||
let newBusinessOwner = getPlayerFromParams(params);
|
||||
@@ -233,7 +233,7 @@ function setBusinessOwnerCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]owner to [#AAAAAA]${newBusinessOwner.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessClanCommand(command, params, client) {
|
||||
let clanId = getClanFromParams(params);
|
||||
@@ -254,7 +254,7 @@ function setBusinessClanCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]owner to the [#FF9900]${getClanData(clanId).name} [#FFFFFF]clan`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessJobCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -285,7 +285,7 @@ function setBusinessJobCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]owner to the [#FFFF00]${getJobData(jobId).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessPublicCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -304,7 +304,7 @@ function setBusinessPublicCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]owner set to [#AAAAAA]public`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lockBusinessCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -323,7 +323,7 @@ function lockBusinessCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -339,7 +339,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]entrance fee to [#AAAAAAA]$${entranceFee}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessInfoCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -380,7 +380,7 @@ function getBusinessInfoCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `🏢 [#0099FF][Business Info] [#FFFFFF]Name: [#AAAAAA]${getBusinessData(businessId).name}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getBusinessOwnerTypeText(getBusinessData(businessId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getBusinessData(businessId).locked))}, [#FFFFFF]ID: [#AAAAAA]${businessId}/${getBusinessData(businessId).databaseId}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessPickupCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -412,7 +412,7 @@ function setBusinessPickupCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}'!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -461,7 +461,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
||||
createBusinessExitPickup(businessId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessBlipCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -494,7 +494,7 @@ function setBusinessBlipCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function withdrawFromBusinessCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -523,7 +523,7 @@ function withdrawFromBusinessCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You withdrew $${amount} from business [#0099FF]${getBusinessData(businessId).name} till`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessBuyPriceCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -551,7 +551,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `[#FFFFFF]You set the [#0099FF]${getBusinessData(businessId).name} business's for-sale price to [#AAAAAA]$${amount}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function depositIntoBusinessCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -580,7 +580,7 @@ function depositIntoBusinessCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You deposited $${amount} into business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]till`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function orderItemForBusinessCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -625,7 +625,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
||||
showPlayerPrompt(client, AG_PROMPT_BIZORDER, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${pricePerItem} each will cost a total of $${orderTotalCost}`, "Business Order Cost");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function orderItemForBusiness(businessId, itemType, amount) {
|
||||
if(getBusinessData(businessId).till < orderTotalCost) {
|
||||
@@ -639,7 +639,7 @@ function orderItemForBusiness(businessId, itemType, amount) {
|
||||
//messagePlayerSuccess(client, `You ordered ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${getItemTypeData(itemType).orderPrice} each for business [#0099FF]${getBusinessData(businessId).name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function viewBusinessTillAmountCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -656,7 +656,7 @@ function viewBusinessTillAmountCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `Business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]till has [#AAAAAA]$${getBusinessData(businessId).till}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function moveBusinessEntranceCommand(command, params, client) {
|
||||
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
|
||||
@@ -683,7 +683,7 @@ function moveBusinessEntranceCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]entrance to their position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function moveBusinessExitCommand(command, params, client) {
|
||||
let businessId = toInteger((isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client)));
|
||||
@@ -710,7 +710,7 @@ function moveBusinessExitCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved business [#0099FF]${getBusinessData(businessId).name} [#FFFFFF]exit to their position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessDataFromDatabaseId(databaseId) {
|
||||
let matchingBusinesses = getServerData().businesses.filter(b => b.databaseId == businessId)
|
||||
@@ -720,7 +720,7 @@ function getBusinessDataFromDatabaseId(databaseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestBusinessEntrance(position) {
|
||||
let closest = 0;
|
||||
@@ -732,7 +732,7 @@ function getClosestBusinessEntrance(position) {
|
||||
return closest;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyBusiness(client) {
|
||||
if(doesEntityDataExist(client, "ag.inBusiness")) {
|
||||
@@ -742,7 +742,7 @@ function isPlayerInAnyBusiness(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerBusiness(client) {
|
||||
if(doesEntityDataExist(client, "ag.inBusiness")) {
|
||||
@@ -752,7 +752,7 @@ function getPlayerBusiness(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllBusinessesToDatabase() {
|
||||
for(let i in getServerData().businesses) {
|
||||
@@ -760,7 +760,7 @@ function saveAllBusinessesToDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveBusinessToDatabase(businessId) {
|
||||
let tempBusinessData = getServerData().businesses[businessId]
|
||||
@@ -854,7 +854,7 @@ function saveBusinessToDatabase(businessId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllBusinessPickups() {
|
||||
for(let i in getServerData().businesses) {
|
||||
@@ -863,7 +863,7 @@ function createAllBusinessPickups() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllBusinessBlips() {
|
||||
for(let i in getServerData().businesses) {
|
||||
@@ -872,7 +872,7 @@ function createAllBusinessBlips() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(getBusinessData(businessId).entrancePickupModel != -1) {
|
||||
@@ -897,7 +897,7 @@ function createBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if(getBusinessData(businessId).entranceBlipModel != -1) {
|
||||
@@ -917,7 +917,7 @@ function createBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessExitPickup(businessId) {
|
||||
if(getBusinessData(businessId).hasInterior) {
|
||||
@@ -940,7 +940,7 @@ function createBusinessExitPickup(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessExitBlip(businessId) {
|
||||
if(getBusinessData(businessId).hasInterior) {
|
||||
@@ -962,7 +962,7 @@ function createBusinessExitBlip(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusiness(businessId, deletedBy = 0) {
|
||||
let tempBusinessData = getServerData().businesses[businessId];
|
||||
@@ -989,7 +989,7 @@ function deleteBusiness(businessId, deletedBy = 0) {
|
||||
getServerData().businesses.splice(businessId, 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayersFromBusiness(businessId) {
|
||||
getClients().forEach(function(client) {
|
||||
@@ -1003,7 +1003,7 @@ function removePlayersFromBusiness(businessId) {
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromBusinesses(client) {
|
||||
if(isPlayerInAnyBusiness(client)) {
|
||||
@@ -1011,7 +1011,7 @@ function removePlayerFromBusinesses(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function exitBusiness(client) {
|
||||
let businessId = getEntityData(client, "ag.inBusiness");
|
||||
@@ -1023,7 +1023,7 @@ function exitBusiness(client) {
|
||||
removeEntityData(client, "ag.inBusiness");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessOwnerTypeText(ownerType) {
|
||||
switch(ownerType) {
|
||||
@@ -1045,7 +1045,7 @@ function getBusinessOwnerTypeText(ownerType) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessData(businessId) {
|
||||
if(typeof getServerData().businesses[businessId] != null) {
|
||||
@@ -1054,13 +1054,13 @@ function getBusinessData(businessId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesBusinessHaveInterior(businessId) {
|
||||
return getBusinessData(businessId).hasInterior;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntrancePickup(businessId) {
|
||||
if(getBusinessData(businessId).entrancePickup != null) {
|
||||
@@ -1070,7 +1070,7 @@ function deleteBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitPickup(businessId) {
|
||||
if(getBusinessData(businessId).exitPickup != null) {
|
||||
@@ -1080,7 +1080,7 @@ function deleteBusinessExitPickup(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntranceBlip(businessId) {
|
||||
if(getBusinessData(businessId).entranceBlip != null) {
|
||||
@@ -1090,7 +1090,7 @@ function deleteBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitBlip(businessId) {
|
||||
if(getBusinessData(businessId).exitBlip != null) {
|
||||
@@ -1100,7 +1100,7 @@ function deleteBusinessExitBlip(businessId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadAllBusinessesCommand(command, params, client) {
|
||||
let clients = getClients();
|
||||
@@ -1126,7 +1126,7 @@ function reloadAllBusinessesCommand(command, params, client) {
|
||||
messageAdminAction(`All businesses have been reloaded by an admin!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAllBusinessIndexes() {
|
||||
for(let i in getServerData().businesses) {
|
||||
@@ -1134,7 +1134,7 @@ function setAllBusinessIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
|
||||
let tempItemData = new serverClasses.itemData(false);
|
||||
@@ -1152,7 +1152,7 @@ function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
|
||||
getServerData().items[index].index = index;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function buyFromBusinessCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -1201,7 +1201,7 @@ function buyFromBusinessCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You bought ${amount} [#AAAAAA]${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot])).name} [#FFFFFF]for $${getBusinessData(businessId).floorItemCache[itemSlot].buyPrice*amount}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setBusinessItemSellPriceCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -1236,7 +1236,7 @@ function setBusinessItemSellPriceCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You changed the price of the ${getItemTypeData(getItemData(getBusinessData(businessId).floorItemCache[itemSlot])).name}s in slot ${itemSlot} from $${oldPrice} to $${newPrice}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function storeItemInBusinessStorageCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -1272,7 +1272,7 @@ function storeItemInBusinessStorageCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot])).name}s in slot ${itemSlot} to the business storage in slot ${firstSlot}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stockItemOnBusinessFloorCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -1308,7 +1308,7 @@ function stockItemOnBusinessFloorCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You moved the ${getItemTypeData(getItemData(getBusinessData(businessId).storageItemCache[firstSlot])).name}s in slot ${itemSlot} of the business storage to the business floor slot ${firstSlot}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessStorageFirstFreeItemSlot(businessId) {
|
||||
for(let i in getBusinessData(businessId).storageItemCache) {
|
||||
@@ -1320,7 +1320,7 @@ function getBusinessStorageFirstFreeItemSlot(businessId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusinessFloorFirstFreeItemSlot(businessId) {
|
||||
for(let i in getBusinessData(businessId).floorItemCache) {
|
||||
@@ -1332,7 +1332,7 @@ function getBusinessFloorFirstFreeItemSlot(businessId) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function cacheAllBusinessItems() {
|
||||
for(let i in getServerData().businesses) {
|
||||
@@ -1346,4 +1346,4 @@ function cacheAllBusinessItems() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: bakery.js
|
||||
// DESC: Provides bakery business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: bar.js
|
||||
// DESC: Provides bar/pub business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: burger.js
|
||||
// DESC: Provides burger joint (McDonalds?) business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: clothing.js
|
||||
// DESC: Provides clothing (skin) business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: club.js
|
||||
// DESC: Provides club/nightclub business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: fuel.js
|
||||
// DESC: Provides fuel/petrol business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: mechanic.js
|
||||
// DESC: Provides mechanic/vehicle repair business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: pizza.js
|
||||
// DESC: Provides pizza restaurant business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: restaurant.js
|
||||
// DESC: Provides generic restaurant business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: vehicle.js
|
||||
// DESC: Provides vehicle dealership business functions and usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: weapon.js
|
||||
// DESC: Provides weapon (ammunations & illegal gunshops) business usage
|
||||
// TYPE: Business (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: chat.js
|
||||
// DESC: Provides chat functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -14,7 +14,7 @@ function initChatScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function meActionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -26,7 +26,7 @@ function meActionCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doActionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -38,7 +38,7 @@ function doActionCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function shoutCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -50,7 +50,7 @@ function shoutCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function talkCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -62,7 +62,7 @@ function talkCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function whisperCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -74,7 +74,7 @@ function whisperCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function adminChatCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -85,7 +85,7 @@ function adminChatCommand(command, params, client) {
|
||||
messageAdmins(`[#FFFF00][Admin Chat] [#AAAAAA]${client.name} [#CCCCCC](${getPlayerStaffTitle(client)})[#FFFFFF]: ${params}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clanChatCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -96,7 +96,7 @@ function clanChatCommand(command, params, client) {
|
||||
clanChat(client, params);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function talkToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
||||
@@ -107,7 +107,7 @@ function talkToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function phoneOutgoingToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
||||
@@ -116,7 +116,7 @@ function phoneOutgoingToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function phoneIncomingToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().radioSpeakerDistance);
|
||||
@@ -125,7 +125,7 @@ function phoneIncomingToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function whisperToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
||||
@@ -136,7 +136,7 @@ function whisperToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function shoutToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().shoutDistance);
|
||||
@@ -147,7 +147,7 @@ function shoutToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doActionToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().doActionDistance);
|
||||
@@ -158,7 +158,7 @@ function doActionToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function meActionToNearbyPlayers(client, messageText) {
|
||||
let clients = getClientsInRange(getPlayerPosition(client), getGlobalConfig().meActionDistance);
|
||||
@@ -169,7 +169,7 @@ function meActionToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clanChat(client, messageText) {
|
||||
let clients = getClients();
|
||||
@@ -180,4 +180,4 @@ function clanChat(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: clan.js
|
||||
// DESC: Provides clan functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -16,7 +16,7 @@ function initClanScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadClansFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Clan]: Loading clans from database ...");
|
||||
@@ -606,7 +606,7 @@ function saveAllClansToDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAllClanDataIndexes() {
|
||||
for(let i in getServerData().clans) {
|
||||
@@ -624,7 +624,7 @@ function setAllClanDataIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function arePlayersInSameClan(client1, client2) {
|
||||
if(getPlayerClan(client1) == getPlayerClan(client2)) {
|
||||
@@ -634,4 +634,4 @@ function arePlayersInSameClan(client1, client2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: class.js
|
||||
// DESC: Provides classes
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -10,12 +10,12 @@
|
||||
|
||||
let serverClasses = initClassTable();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initClassScript() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initClassTable() {
|
||||
let tempClasses = {
|
||||
@@ -1132,16 +1132,16 @@ function initClassTable() {
|
||||
return tempClasses;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClasses() {
|
||||
return serverClasses;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClass(className) {
|
||||
return serverClasses[className];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: client.js
|
||||
// DESC: Provides client communication and cross-endpoint operations
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -14,7 +14,7 @@ function initClientScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Clan]: Initializing client script ...");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addAllNetworkHandlers() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Client]: Adding network handlers ...");
|
||||
@@ -67,14 +67,14 @@ function addAllNetworkHandlers() {
|
||||
addNetworkHandler("ag.player.heading", updateHeadingInPlayerData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerNameTag(client) {
|
||||
//logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
|
||||
triggerNetworkEvent("ag.nametag", null, client.name, getPlayerNameForNameTag(client), getPlayerColour(client), false, client.ping);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updateAllPlayerNameTags() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending updated nametags to all players`);
|
||||
@@ -84,14 +84,14 @@ function updateAllPlayerNameTags() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerPing(client) {
|
||||
//logToConsole(LOG_DEBUG, `[Asshat.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
|
||||
triggerNetworkEvent("ag.ping", null, client.name, client.ping);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerClientReady(client) {
|
||||
setEntityData(client, "ag.isReady", true, false);
|
||||
@@ -101,14 +101,14 @@ function playerClientReady(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerGUIReady(client) {
|
||||
setEntityData(client, "ag.guiReady", true, false);
|
||||
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerClientStarted(client) {
|
||||
setEntityData(client, "ag.isStarted", true, false);
|
||||
@@ -118,56 +118,56 @@ function playerClientStarted(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showGameMessage(client, text, colour, duration) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
|
||||
triggerNetworkEvent("ag.smallGameMessage", client, text, colour, duration);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enableCityAmbienceForPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
triggerNetworkEvent("ag.ambience", client, true);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function disableCityAmbienceForPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
|
||||
triggerNetworkEvent("ag.ambience", client, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerOwnedPeds(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.clearPeds", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerSpawnedState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
triggerNetworkEvent("ag.spawned", client, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerControlState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
triggerNetworkEvent("ag.control", client, state, !state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerShowLogoState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
|
||||
triggerNetworkEvent("ag.logo", client, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function restorePlayerCamera(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
|
||||
@@ -180,14 +180,14 @@ function setPlayer2DRendering(client, hudState = false, labelState = false, smal
|
||||
triggerNetworkEvent("ag.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerProperties(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
|
||||
triggerNetworkEvent("ag.player.sync", null, client.player);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerSnowState(client) {
|
||||
if(doesGameHaveSnow(getServerGame())) {
|
||||
@@ -196,7 +196,7 @@ function updatePlayerSnowState(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendExcludedModelsForGroundSnowToPlayer(client) {
|
||||
if(getGameConfig().excludedGroundSnowModels[getServerGame()].length > 0) {
|
||||
@@ -207,7 +207,7 @@ function sendExcludedModelsForGroundSnowToPlayer(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendRemovedWorldObjectsToPlayer(client) {
|
||||
if(getGameConfig().removedWorldObjects[getServerGame()].length > 0) {
|
||||
@@ -219,7 +219,7 @@ function sendRemovedWorldObjectsToPlayer(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerHotBar(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||
@@ -242,14 +242,14 @@ function updatePlayerHotBar(client) {
|
||||
triggerNetworkEvent("ag.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEnabled(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
triggerNetworkEvent("ag.weaponDamageEnabled", null, client.name, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEvent(client, eventType) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
|
||||
@@ -257,244 +257,244 @@ function setPlayerWeaponDamageEvent(client, eventType) {
|
||||
getPlayerData(client).weaponDamageEvent = eventType;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendJobRouteStopToPlayer(client, position, colour) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.showJobRouteStop", client, position, colour);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.loginSuccess", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.loginFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.registrationSuccess", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.registrationFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerGUIColours(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.guiColour", client, getServerConfig().guiColour[0], getServerConfig().guiColour[1], getServerConfig().guiColour[2]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerGUIInit(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.guiInit", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerLoginGUI(client, errorMessage = "") {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.showLogin", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerRegistrationGUI(client, errorMessage = "") {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.showRegistration", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerNewCharacterGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.showNewCharacter", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectGUI(client, firstName, lastName, placeOfOrigin, dateOfBirth, skin) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.showCharacterSelect", client, firstName, lastName, placeOfOrigin, dateOfBirth, skin);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerCharacterSelectGUI(client, firstName, lastName, placeOfOrigin, dateOfBirth, skin) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.switchCharacterSelect", client, firstName, lastName, placeOfOrigin, dateOfBirth, skin);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectSuccessGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.characterSelectSuccess", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerCharacterSelectFailedGUI(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.characterSelectFailed", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerPromptGUI(client, promptMessage, promptTitle) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage})`);
|
||||
triggerNetworkEvent("ag.showPrompt", client, promptMessage, promptTitle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerInfoGUI(client, infoMessage, infoTitle) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
|
||||
triggerNetworkEvent("ag.showInfo", client, infoMessage, infoTitle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerErrorGUI(client, errorMessage, errorTitle) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
|
||||
triggerNetworkEvent("ag.showInfo", client, errorMessage, errorTitle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendRunCodeToClient(client, code, returnTo) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
|
||||
triggerNetworkEvent("ag.runCode", client, code, returnTo);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerWorkingState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.working", client, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerJobType(client, jobType) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.jobType", client, jobType);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerStopJobRoute(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.stopJobRoute", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerMouseCameraToggle(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.mouseCamera", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerMouseCursorToggle(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.mouseCursor", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendAddAccountKeyBindToClient(client, key, keyState) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${sdl.getKeyName(key)}, State: ${(keyState) ? "down" : "up"})`);
|
||||
triggerNetworkEvent("ag.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendRemoveAccountKeyBindToClient(client, key) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${sdl.getKeyName(key)})`);
|
||||
triggerNetworkEvent("ag.delKeyBind", client, toInteger(key));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetPosition(client, position) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
|
||||
triggerNetworkEvent("ag.position", client, position);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetHeading(client, heading) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
|
||||
triggerNetworkEvent("ag.heading", client, heading);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerSetInterior(client, interior) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
|
||||
triggerNetworkEvent("ag.interior", client, interior);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerFrozenState(client, state) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
|
||||
triggerNetworkEvent("ag.frozen", client, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerWeapon(client, weaponId, ammo, active) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
|
||||
triggerNetworkEvent("ag.giveWeapon", client, weaponId, ammo, active);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerWeapons(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
|
||||
triggerNetworkEvent("ag.clearWeapons", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.newCharacterFailed", client, errorMessage);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerRemoveFromVehicle(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.removeFromVehicle", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendChatBoxMessageToPlayer(client, message, colour) {
|
||||
triggerNetworkEvent("ag.m", client, message, colour)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemTakeDelay(client, itemId) {
|
||||
if(getItemData(itemId)) {
|
||||
@@ -509,7 +509,7 @@ function showPlayerItemTakeDelay(client, itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemUseDelay(client, itemSlot) {
|
||||
if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
@@ -524,7 +524,7 @@ function showPlayerItemUseDelay(client, itemSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemDropDelay(client, itemSlot) {
|
||||
if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
@@ -539,7 +539,7 @@ function showPlayerItemDropDelay(client, itemSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemPickupDelay(client, itemId) {
|
||||
if(getItemData(itemId)) {
|
||||
@@ -554,7 +554,7 @@ function showPlayerItemPickupDelay(client, itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemPutDelay(client, itemSlot) {
|
||||
if(getItemData(getPlayerData(client).hotBarItems[itemSlot])) {
|
||||
@@ -569,7 +569,7 @@ function showPlayerItemPutDelay(client, itemSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerItemSwitchDelay(client, itemSlot) {
|
||||
if(itemSlot != -1) {
|
||||
@@ -586,21 +586,21 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerDrunkEffect(client, amount, duration) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
|
||||
triggerNetworkEvent("ag.drunkEffect", client, amount, duration);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerClearPedState(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
|
||||
triggerNetworkEvent("ag.clearPedState", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, healthLoss) {
|
||||
let damagerEntity = getClientByName(damagerEntityName);
|
||||
@@ -639,38 +639,38 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerCameraLookAt(client, cameraPosition, lookAtPosition) {
|
||||
triggerNetworkEvent("ag.cameraLookAt", client, cameraPosition, lookAtPosition);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setTimeMinuteDuration(client, minuteDuration) {
|
||||
triggerNetworkEvent("ag.minuteDuration", client, minuteDuration);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePositionInPlayerData(client, position) {
|
||||
getPlayerData(client).syncPosition = position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updateHeadingInPlayerData(client, heading) {
|
||||
getPlayerData(client).syncHeading = heading;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function forcePlayerIntoSkinItemSelect(client, itemId) {
|
||||
getPlayerData(client).itemActionItem = itemId;
|
||||
triggerNetworkEvent("ag.skinSelect", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerSkinItemSelectComplete(client, skinId) {
|
||||
getPlayerCurrentSubAccount(client).skin = skinId;
|
||||
@@ -681,4 +681,124 @@ function playerSkinItemSelectComplete(client, skinId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerCash(client) {
|
||||
triggerNetworkEvent("ag.money", client, getPlayerCurrentSubAccount(client).cash);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllPoliceStationBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].policeStation != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().policeStations[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].policeStation,
|
||||
getServerData().policeStations[getServerGame()][i].position.x,
|
||||
getServerData().policeStations[getServerGame()][i].position.y,
|
||||
getServerData().policeStations[getServerGame()][i].position.z,
|
||||
3,
|
||||
getColourByName("policeBlue"),
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllFireStationBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].fireStation != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().fireStations[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].fireStation,
|
||||
getServerData().fireStations[getServerGame()][i].position.x,
|
||||
getServerData().fireStations[getServerGame()][i].position.y,
|
||||
getServerData().fireStations[getServerGame()][i].position.z,
|
||||
3,
|
||||
getColourByName("firefighterRed"),
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllHospitalBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].hospital != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().hospitals[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].hospital,
|
||||
getServerData().hospitals[getServerGame()][i].position.x,
|
||||
getServerData().hospitals[getServerGame()][i].position.y,
|
||||
getServerData().hospitals[getServerGame()][i].position.z,
|
||||
3,
|
||||
getColourByName("medicPink"),
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllAmmunationBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].ammunation != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().ammunations[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].ammunation,
|
||||
getServerData().ammunations[getServerGame()][i].position.x,
|
||||
getServerData().ammunations[getServerGame()][i].position.y,
|
||||
getServerData().ammunations[getServerGame()][i].position.z,
|
||||
3,
|
||||
0
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllPayAndSprayBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].payAndSpray != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().payAndSprays[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].payAndSpray,
|
||||
getServerData().payAndSprays[getServerGame()][i].position.x,
|
||||
getServerData().payAndSprays[getServerGame()][i].position.y,
|
||||
getServerData().payAndSprays[getServerGame()][i].position.z,
|
||||
3,
|
||||
0
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendAllFuelStationBlips(client) {
|
||||
if(getGameConfig().blipSprites[getServerGame()].fuelStation != -1) {
|
||||
let tempBlips = [];
|
||||
for(let i in getServerData().fuelStations[getServerGame()]) {
|
||||
tempBlips.push([
|
||||
getGameConfig().blipSprites[getServerGame()].fuelStation,
|
||||
getServerData().fuelStations[getServerGame()][i].position.x,
|
||||
getServerData().fuelStations[getServerGame()][i].position.y,
|
||||
getServerData().fuelStations[getServerGame()][i].position.z,
|
||||
3,
|
||||
getColourByName("burntOrange"),
|
||||
]);
|
||||
}
|
||||
triggerNetworkEvent("ag.blips", client, tempBlips);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: colour.js
|
||||
// DESC: Provides colours, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -71,7 +71,7 @@ function getColourByName(colourName) {
|
||||
return getServerColours().byName[colourName];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerColour(client) {
|
||||
if(getPlayerData(client) != false) {
|
||||
@@ -87,13 +87,13 @@ function getPlayerColour(client) {
|
||||
return getColourByName("civilianWhite");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBoolRedGreenInlineColour(boolVal) {
|
||||
return (!boolVal) ? "[#cd3c3c]" : "[#32cd32]";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function hexToRgb(h) {
|
||||
return [
|
||||
@@ -103,10 +103,33 @@ function hexToRgb(h) {
|
||||
];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function rgbToHex(r, g, b) {
|
||||
return "#"+((1<<24)+(r<<16)+(g<<8)+ b).toString(16).slice(1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientChatColour(client) {
|
||||
let tempJob = getPlayerCurrentSubAccount(client).job;
|
||||
if(tempJob != -1) {
|
||||
if(getPlayerData(client).isWorking) {
|
||||
return getJobData(tempJob).jobColour;
|
||||
}
|
||||
}
|
||||
return getColourByName("white");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomRGB() {
|
||||
return toColour.apply(null, [
|
||||
getRandom(0, 255),
|
||||
getRandom(0, 255),
|
||||
getRandom(0, 255),
|
||||
255
|
||||
]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: command.js
|
||||
// DESC: Provides command data, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -23,7 +23,7 @@ let builtInCommands = [
|
||||
"dumpdoc",
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initCommandScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Command]: Initializing commands script ...");
|
||||
@@ -32,7 +32,7 @@ function initCommandScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Command]: Initialized commands script!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadCommands() {
|
||||
return {
|
||||
@@ -363,7 +363,7 @@ function loadCommands() {
|
||||
};
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addAllCommandHandlers() {
|
||||
for(let i in serverCommands) {
|
||||
@@ -373,7 +373,7 @@ function addAllCommandHandlers() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCommand(command) {
|
||||
let commandGroups = getCommands()
|
||||
@@ -389,49 +389,49 @@ function getCommand(command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCommandData(command) {
|
||||
return getCommand(command);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCommands() {
|
||||
return serverCommands;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function commandData(command, handlerFunction, syntaxString = "", requiredStaffFlags = getStaffFlagValue("none"), requireLogin = true, allowOnDiscord = true, usageHelpMessage) {
|
||||
return new serverClasses.commandData(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, usageHelpMessage);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesCommandRequireLogin(command) {
|
||||
return getCommand(command).requireLogin;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCommandRequiredPermissions(command) {
|
||||
return getCommand(command).requiredStaffFlags;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCommandSyntaxText(command) {
|
||||
return `/${command} ${getCommand(command).syntaxString}`;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isCommandAllowedOnDiscord(command) {
|
||||
return getCommand(command).allowOnDiscord;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function disableCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -451,7 +451,7 @@ function disableCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enableCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -471,7 +471,7 @@ function enableCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function disableAllCommandsByType(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -494,7 +494,7 @@ function disableAllCommandsByType(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enableAllCommandsByType(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -517,14 +517,14 @@ function enableAllCommandsByType(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerCommand(event, client, command, params) {
|
||||
processPlayerCommand(command, params, client)
|
||||
}
|
||||
addEventHandler("OnPlayerCommand", onPlayerCommand);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function processPlayerCommand(command, params, client) {
|
||||
if(builtInCommands.indexOf(toLowerCase(command)) != -1) {
|
||||
@@ -578,7 +578,7 @@ function processPlayerCommand(command, params, client) {
|
||||
commandData.handlerFunction(toLowerCase(command), params, client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
addCommandHandler("cmd", function(command, params, client) {
|
||||
if(!isConsole(client)) {
|
||||
@@ -592,7 +592,7 @@ addCommandHandler("cmd", function(command, params, client) {
|
||||
getCommand(newCommand).handlerFunction(newCommand, newParams, client);
|
||||
});
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listAllCommands() {
|
||||
for(let i in serverCommands) {
|
||||
@@ -602,7 +602,7 @@ function listAllCommands() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesCommandExist(command) {
|
||||
if(getCommandData(command)) {
|
||||
@@ -612,4 +612,4 @@ function doesCommandExist(command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: config.js
|
||||
// DESC: Provides server configuration
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -576,7 +576,7 @@ function initConfigScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Config]: Config script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -596,7 +596,7 @@ function loadServerConfigFromGameAndPort(gameId, port) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromId(tempServerId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -714,7 +714,7 @@ function setMinuteDurationCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setWeatherCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -738,7 +738,7 @@ function setWeatherCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setSnowingCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -760,7 +760,7 @@ function setSnowingCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleServerLogoCommand(command, params, client) {
|
||||
getServerConfig().useLogo = !getServerConfig().useLogo;
|
||||
@@ -772,7 +772,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleAntiCheatScriptWhitelist(command, params, client) {
|
||||
getServerConfig().antiCheat.gameScriptWhiteListEnabled = !getServerConfig().antiCheat.gameScriptWhiteListEnabled;
|
||||
@@ -784,7 +784,7 @@ function toggleAntiCheatScriptWhitelist(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleAntiCheatScriptBlacklist(command, params, client) {
|
||||
getServerConfig().antiCheat.gameScriptBlackListEnabled = !getServerConfig().antiCheat.gameScriptBlackListEnabled;
|
||||
@@ -796,7 +796,7 @@ function toggleAntiCheatScriptBlacklist(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleServerGUICommand(command, params, client) {
|
||||
getServerConfig().useGUI = !getServerConfig().useGUI;
|
||||
@@ -806,7 +806,7 @@ function toggleServerGUICommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadServerConfigurationCommand(command, params, client) {
|
||||
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port);
|
||||
@@ -818,7 +818,7 @@ function reloadServerConfigurationCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadEmailConfigurationCommand(command, params, client) {
|
||||
emailConfig = loadEmailConfigFromGameAndPort(server.game, server.port);
|
||||
@@ -828,7 +828,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadEmailConfigurationCommand(command, params, client) {
|
||||
emailConfig = loadEmailConfig();
|
||||
@@ -836,7 +836,7 @@ function reloadEmailConfigurationCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadDatabaseConfigurationCommand(command, params, client) {
|
||||
//if(!databaseInUse) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: const.js
|
||||
// DESC: Provides constants
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: core.js
|
||||
// DESC: Provides core data structures, function, and operations
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: database.js
|
||||
// DESC: Provides database handling, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: developer.js
|
||||
// DESC: Provides developer operation, commands, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -22,7 +22,7 @@ function initDeveloperScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function p(params) {
|
||||
return getPlayerFromParams(params);
|
||||
@@ -88,7 +88,7 @@ function pvd(params) {
|
||||
return getVehicleData(getPlayerVehicle(getPlayerFromParams(params)));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addServerLogLevelCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -126,7 +126,7 @@ function addServerLogLevelCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeServerLogLevelCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -164,7 +164,7 @@ function removeServerLogLevelCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function simulateCommandForPlayerCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
@@ -205,7 +205,7 @@ function simulateCommandForPlayerCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function simulateCommandForAllPlayersCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
@@ -245,7 +245,7 @@ function simulateCommandForAllPlayersCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function executeServerCodeCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -267,7 +267,7 @@ function executeServerCodeCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function executeClientCodeCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -296,7 +296,7 @@ function executeClientCodeCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllServerDataCommand(command, params, client) {
|
||||
messageAdmins(`[#FF9900]Saving all server data to database ...`);
|
||||
@@ -305,14 +305,14 @@ function saveAllServerDataCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function testEmailCommand(command, params, client) {
|
||||
sendEmail(params, "Player", "Test email", "Just testing the SMTP module for the server!");
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function restartGameModeCommand(command, params, client) {
|
||||
messagePlayerNormal(null, `[#FF9900]The server game mode is restarting!`, getColourByName("orange"));
|
||||
@@ -321,7 +321,7 @@ function restartGameModeCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clientRunCodeFail(client, returnTo, code) {
|
||||
let returnClient = getClientFromIndex(returnTo);
|
||||
@@ -333,7 +333,7 @@ function clientRunCodeFail(client, returnTo, code) {
|
||||
messagePlayerNormal(returnClient, `Code: ${code}`, getColourByName("yellow"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clientRunCodeSuccess(client, returnTo, returnVal, code) {
|
||||
let returnClient = getClientFromIndex(returnTo);
|
||||
@@ -346,7 +346,7 @@ function clientRunCodeSuccess(client, returnTo, returnVal, code) {
|
||||
messagePlayerNormal(returnClient, `Returns: ${returnVal}`, getColourByName("yellow"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function submitIdea(client, ideaText) {
|
||||
let position = (getPlayerVehicle(client)) ? getVehiclePosition(getPlayerVehicle(client)) : getPlayerPosition(client);
|
||||
@@ -367,7 +367,7 @@ function submitIdea(client, ideaText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function submitBugReport(client, bugText) {
|
||||
let position = (getPlayerVehicle(client)) ? getVehiclePosition(getPlayerVehicle(client)) : getPlayerPosition(client);
|
||||
@@ -388,10 +388,10 @@ function submitBugReport(client, bugText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isDevelopmentServer() {
|
||||
return intToBool(server.getCVar("devserver") || 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: discord.js
|
||||
// DESC: Provides discord bridging and connection functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -31,7 +31,7 @@ addEventHandler("OnDiscordCommand", function(command, params, discordUser) {
|
||||
});
|
||||
*/
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordUser(discordUser, messageText) {
|
||||
let socketData = JSON.stringify({
|
||||
@@ -44,7 +44,7 @@ function messageDiscordUser(discordUser, messageText) {
|
||||
sendDiscordSocketData(socketData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendDiscordSocketData(socketData) {
|
||||
if(!getDiscordSocket()) {
|
||||
@@ -54,7 +54,7 @@ function sendDiscordSocketData(socketData) {
|
||||
getDiscordSocket().send(module.hash.encodeBase64(socketData) + "\r\n");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isClientFromDiscord(client) {
|
||||
if(client == null) {
|
||||
@@ -68,34 +68,34 @@ function isClientFromDiscord(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordSocket() {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getDiscordUserData(discordUserId) {
|
||||
return loadAccountFromDiscordUserId(discordUserId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordChatChannel(message) {
|
||||
let gameEmoji = getGameEmojiForDiscord(getServerGame());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordAdminChannel(message) {
|
||||
let gameEmoji = getGameEmojiForDiscord(getServerGame());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageDiscordEventChannel(message) {
|
||||
let gameEmoji = getGameEmojiForDiscord(getServerGame());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
23
scripts/server/economy.js
Normal file
23
scripts/server/economy.js
Normal file
@@ -0,0 +1,23 @@
|
||||
// ===========================================================================
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ===========================================================================
|
||||
// FILE: economy.js
|
||||
// DESC: Provides economy/financial utils, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getTimeDisplayUntilPlayerPayDay(client) {
|
||||
return getTimeDifferenceDisplay(sdl.ticks-getPlayerData(client).payDayTickStart);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function applyServerInflationMultiplier(value) {
|
||||
return value*getServerConfig().inflationMultiplier;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: email.js
|
||||
// DESC: Provides email handling, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: event.js
|
||||
// DESC: Provides handlers for built in GTAC and Asshat-Gaming created events
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initEventScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Event]: Initializing event script ...");
|
||||
@@ -16,7 +16,7 @@ function initEventScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Event]: Event script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addAllEventHandlers() {
|
||||
addEventHandler("onResourceStart", onResourceStart);
|
||||
@@ -35,7 +35,7 @@ function addAllEventHandlers() {
|
||||
addEventHandler("onPedExitVehicle", onPedExitingVehicle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerConnect(event, ipAddress, port) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Event] Client connecting (IP: ${ipAddress})`);
|
||||
@@ -45,19 +45,19 @@ function onPlayerConnect(event, ipAddress, port) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerJoin(event, client) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerJoined(event, client) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerQuit(event, client, quitReasonId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Event] ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
@@ -69,7 +69,7 @@ function onPlayerQuit(event, client, quitReasonId) {
|
||||
messagePlayerNormal(null, `👋 ${client.name} has left the server (${disconnectReasons[quitReasonId]})`, getColourByName("softYellow"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerChat(event, client, messageText) {
|
||||
event.preventDefault();
|
||||
@@ -85,7 +85,7 @@ function onPlayerChat(event, client, messageText) {
|
||||
messagePlayerNormal(null, `${getCharacterFullName(client)}: [#FFFFFF]${messageText}`, getPlayerColour(client));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onProcess(event, deltaTime) {
|
||||
checkVehicleBuying();
|
||||
@@ -94,7 +94,7 @@ function onProcess(event, deltaTime) {
|
||||
//checkVehicleBurning();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
@@ -122,7 +122,7 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPedExitingVehicle(event, ped, vehicle) {
|
||||
if(ped.isType(ELEMENT_PLAYER)) {
|
||||
@@ -131,7 +131,7 @@ function onPedExitingVehicle(event, ped, vehicle) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStart(event, resource) {
|
||||
logToConsole(LOG_WARN, `[Asshat.Event] ${resource.name} started!`);
|
||||
@@ -141,7 +141,7 @@ function onResourceStart(event, resource) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onResourceStop(event, resource) {
|
||||
logToConsole(LOG_WARN, `[Asshat.Event] ${resource.name} stopped!`);
|
||||
@@ -155,19 +155,19 @@ function onResourceStop(event, resource) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerEnteredSphere(client, sphere) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerExitedSphere(client, sphere) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
async function onPlayerEnteredVehicle(client) {
|
||||
if(client.player == null) {
|
||||
@@ -238,7 +238,7 @@ async function onPlayerEnteredVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerExitedVehicle(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_READY;
|
||||
@@ -260,7 +260,7 @@ function onPlayerExitedVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerDeath(client, position) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_DEAD;
|
||||
@@ -293,7 +293,7 @@ function onPlayerDeath(client, position) {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPedSpawn(ped) {
|
||||
//if(ped.type == ELEMENT_PLAYER) {
|
||||
@@ -301,7 +301,7 @@ function onPedSpawn(ped) {
|
||||
//}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Event] Checking for ${getPlayerDisplayForConsole(client)}'s player ped`);
|
||||
@@ -399,4 +399,4 @@ function onPlayerSpawn(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_READY;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: fishing.js
|
||||
// DESC: Provides fishing functions and commands
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -37,7 +37,7 @@ let fishingLocations = [
|
||||
],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
let fishingCatchables = [
|
||||
// Fish
|
||||
@@ -65,4 +65,4 @@ let fishingCatchables = [
|
||||
["Soggy Dildo", 0, 0, 0, 0],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: gui.js
|
||||
// DESC: Provides GUI functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNo(client) {
|
||||
if(getPlayerData(client).promptType == AG_PROMPT_NONE) {
|
||||
@@ -43,7 +43,7 @@ function playerPromptAnswerNo(client) {
|
||||
getPlayerData(client).promptType = AG_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYes(client) {
|
||||
if(getPlayerData(client).promptType == AG_PROMPT_NONE) {
|
||||
@@ -87,22 +87,22 @@ function playerPromptAnswerYes(client) {
|
||||
getPlayerData(client).promptType = AG_PROMPT_NONE;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseGUI(client) {
|
||||
return (getServerConfig().useGUI && doesPlayerHaveGUIEnabled(client));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerYesCommand(command, params, client) {
|
||||
playerPromptAnswerYes(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPromptAnswerNoCommand(command, params, client) {
|
||||
playerPromptAnswerNo(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: help.js
|
||||
// DESC: Provides update info, help commands, and documentation
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: house.js
|
||||
// DESC: Provides house commands, functions, and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -25,7 +25,7 @@ function initHouseScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadHousesFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.House]: Loading houses from database ...");
|
||||
@@ -51,7 +51,7 @@ function loadHousesFromDatabase() {
|
||||
return tempHouses;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseCommand(command, params, client) {
|
||||
let tempHouseData = createHouse(params, getPlayerPosition(client), toVector3(0.0, 0.0, 0.0), getGameConfig().pickupModels[getServerGame()].house, getGameConfig().blipSprites[getServerGame()].house, getPlayerInterior(client), getPlayerDimension(client));
|
||||
@@ -65,7 +65,7 @@ function createHouseCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created house [#11CC11]${tempHouseData.description}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lockUnlockHouseCommand(command, params, client) {
|
||||
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
|
||||
@@ -80,7 +80,7 @@ function lockUnlockHouseCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `House '${getHouseData(houseId).description}' ${getLockedUnlockedTextFromBool((getHouseData(houseId).locked))}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHouseDescriptionCommand(command, params, client) {
|
||||
let newHouseDescription = toString(params);
|
||||
@@ -98,7 +98,7 @@ function setHouseDescriptionCommand(command, params, client) {
|
||||
messageAdmins(`${client.name} renamed house [#11CC11]${oldDescription} [#FFFFFF]to [#11CC11]${getHouseData(houseId).description}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHouseOwnerCommand(command, params, client) {
|
||||
let newHouseOwner = getPlayerFromParams(params);
|
||||
@@ -119,7 +119,7 @@ function setHouseOwnerCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]owner to [#AAAAAA]${newHouseOwner.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHouseClanCommand(command, params, client) {
|
||||
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
|
||||
@@ -141,7 +141,7 @@ function setHouseClanCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]owner to the [#FF9900]${getClanData(clanId).name} [#FFFFFF]clan!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHousePickupCommand(command, params, client) {
|
||||
let typeParam = params || "house";
|
||||
@@ -175,7 +175,7 @@ function setHousePickupCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]pickup display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHouseInteriorTypeCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -225,7 +225,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]interior type to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setHouseBlipCommand(command, params, client) {
|
||||
let typeParam = params || "house";
|
||||
@@ -259,7 +259,7 @@ function setHouseBlipCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]blip display to [#AAAAAA]${toLowerCase(typeParam)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function moveHouseEntranceCommand(command, params, client) {
|
||||
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
|
||||
@@ -282,7 +282,7 @@ function moveHouseEntranceCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]entrance to their position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function moveHouseExitCommand(command, params, client) {
|
||||
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
|
||||
@@ -305,7 +305,7 @@ function moveHouseExitCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]moved house [#11CC11]${getHouseData(houseId).description} [#FFFFFF]exit to their position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseCommand(command, params, client) {
|
||||
let houseId = toInteger((isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client)));
|
||||
@@ -320,7 +320,7 @@ function deleteHouseCommand(command, params, client) {
|
||||
deleteHouse(houseId, getPlayerData(client).accountData.databaseId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouse(houseId, whoDeleted = 0) {
|
||||
let tempHouseData = getServerData().houses[houseId];
|
||||
@@ -347,7 +347,7 @@ function deleteHouse(houseId, whoDeleted = 0) {
|
||||
getServerData().houses.splice(houseId, 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromHouses(client) {
|
||||
if(isPlayerInAnyHouse(client)) {
|
||||
@@ -355,7 +355,7 @@ function removePlayerFromHouses(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouse(description, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1) {
|
||||
let tempHouseData = new serverClasses.houseData(false);
|
||||
@@ -378,7 +378,7 @@ function createHouse(description, entrancePosition, exitPosition, entrancePickup
|
||||
return tempHouseData;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getHouseDataFromDatabaseId(databaseId) {
|
||||
let matchingHouses = getServerData().houses.filter(b => b.databaseId == databaseId)
|
||||
@@ -388,7 +388,7 @@ function getHouseDataFromDatabaseId(databaseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestHouseEntrance(position) {
|
||||
let houses = getServerData().houses;
|
||||
@@ -401,7 +401,7 @@ function getClosestHouseEntrance(position) {
|
||||
return closest;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHouse(client) {
|
||||
if(doesEntityDataExist(client, "ag.inHouse")) {
|
||||
@@ -411,7 +411,7 @@ function getPlayerHouse(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllHousesToDatabase() {
|
||||
for(let i in getServerData().houses) {
|
||||
@@ -419,7 +419,7 @@ function saveAllHousesToDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveHouseToDatabase(houseId) {
|
||||
let tempHouseData = getServerData().houses[houseId];
|
||||
@@ -472,7 +472,7 @@ function saveHouseToDatabase(houseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllHousePickups() {
|
||||
for(let i in getServerData().houses) {
|
||||
@@ -481,7 +481,7 @@ function createAllHousePickups() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllHouseBlips() {
|
||||
for(let i in getServerData().houses) {
|
||||
@@ -490,7 +490,7 @@ function createAllHouseBlips() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseEntrancePickup(houseId) {
|
||||
if(getHouseData(houseId).entrancePickupModel != -1) {
|
||||
@@ -515,7 +515,7 @@ function createHouseEntrancePickup(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseEntranceBlip(houseId) {
|
||||
if(getHouseData(houseId).entranceBlipModel != -1) {
|
||||
@@ -534,7 +534,7 @@ function createHouseEntranceBlip(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseExitPickup(houseId) {
|
||||
if(getHouseData(houseId).hasInterior) {
|
||||
@@ -556,7 +556,7 @@ function createHouseExitPickup(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createHouseExitBlip(houseId) {
|
||||
if(getHouseData(houseId).hasInterior) {
|
||||
@@ -577,7 +577,7 @@ function createHouseExitBlip(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getHouseOwnerTypeText(ownerType) {
|
||||
switch(ownerType) {
|
||||
@@ -601,7 +601,7 @@ function getHouseOwnerTypeText(ownerType) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getHouseInfoCommand(command, params, client) {
|
||||
let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client));
|
||||
@@ -642,13 +642,13 @@ function getHouseInfoCommand(command, params, client) {
|
||||
messagePlayerNormal(client, `🏠 [#11CC11][House Info] [#FFFFFF]Description: [#AAAAAA]${getHouseData(houseId).description}, [#FFFFFF]Owner: [#AAAAAA]${ownerName} (${getHouseOwnerTypeText(getHouseData(houseId).ownerType)}), [#FFFFFF]Locked: [#AAAAAA]${getYesNoFromBool(intToBool(getHouseData(houseId).locked))}, [#FFFFFF]ID: [#AAAAAA]${houseId}/${getHouseData(houseId).databaseId}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyHouse(client) {
|
||||
return doesEntityDataExist(client, "ag.inHouse");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getHouseData(houseId) {
|
||||
if(typeof getServerData().houses[houseId] != "undefined") {
|
||||
@@ -656,13 +656,13 @@ function getHouseData(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesHouseHaveInterior(houseId) {
|
||||
return getHouseData(houseId).hasInterior;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseEntrancePickup(houseId) {
|
||||
if(getHouseData(houseId).entrancePickup != null) {
|
||||
@@ -672,7 +672,7 @@ function deleteHouseEntrancePickup(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseExitPickup(houseId) {
|
||||
if(getHouseData(houseId).exitPickup != null) {
|
||||
@@ -682,7 +682,7 @@ function deleteHouseExitPickup(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseEntranceBlip(houseId) {
|
||||
if(getHouseData(houseId).entranceBlip != null) {
|
||||
@@ -692,7 +692,7 @@ function deleteHouseEntranceBlip(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseExitBlip(houseId) {
|
||||
if(getHouseData(houseId).exitBlip != null) {
|
||||
@@ -702,7 +702,7 @@ function deleteHouseExitBlip(houseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadAllHousesCommand(command, params, client) {
|
||||
let clients = getClients();
|
||||
@@ -727,7 +727,7 @@ function reloadAllHousesCommand(command, params, client) {
|
||||
messageAdminAction(`All houses have been reloaded by an admin!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function exitHouse(client) {
|
||||
let houseId = getPlayerHouse(client);
|
||||
@@ -739,7 +739,7 @@ function exitHouse(client) {
|
||||
removeEntityData(client, "ag.inHouse");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAllHouseIndexes() {
|
||||
for(let i in getServerData().houses) {
|
||||
@@ -747,4 +747,4 @@ function setAllHouseIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: item.js
|
||||
// DESC: Provides item functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -18,7 +18,7 @@ function initItemScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadItemsFromDatabase() {
|
||||
let tempItems = [];
|
||||
@@ -40,7 +40,7 @@ function loadItemsFromDatabase() {
|
||||
return tempItems;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadItemTypesFromDatabase() {
|
||||
let tempItemTypes = [];
|
||||
@@ -63,7 +63,7 @@ function loadItemTypesFromDatabase() {
|
||||
return tempItemTypes;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createItem(itemTypeId, value, ownerType, ownerId, amount=1) {
|
||||
let tempItemData = new serverClasses.itemData(false);
|
||||
@@ -80,7 +80,7 @@ function createItem(itemTypeId, value, ownerType, ownerId, amount=1) {
|
||||
return index;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createGroundItem(itemTypeId, value, position, dimension = 0) {
|
||||
let itemIndex = createItem(itemTypeId, value, AG_ITEM_OWNER_GROUND, 0);
|
||||
@@ -90,7 +90,7 @@ function createGroundItem(itemTypeId, value, position, dimension = 0) {
|
||||
return itemIndex;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createGroundItemObject(itemId) {
|
||||
if(!getItemData(itemId)) {
|
||||
@@ -110,7 +110,7 @@ function createGroundItemObject(itemId) {
|
||||
getServerData().groundItemCache.push(itemId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGroundItemObject(itemId) {
|
||||
if(getServerData().groundItemCache.indexOf(itemId) != -1) {
|
||||
@@ -123,7 +123,7 @@ function deleteGroundItemObject(itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createGroundItemCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -144,7 +144,7 @@ function createGroundItemCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You created a ${getItemTypeData(itemType).name} on the ground at your position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createItemCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -165,7 +165,7 @@ function createItemCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You created a ${getItemTypeData(itemType).name} on the ground at your position`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function useItemCommand(command, params, client) {
|
||||
let hotBarSlot = getPlayerData(client).activeHotBarSlot;
|
||||
@@ -207,7 +207,7 @@ function useItemCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGroundItemCommand(command, params, client) {
|
||||
let itemId = getClosestItemOnGround(getPlayerPosition(client));
|
||||
@@ -229,7 +229,7 @@ function deleteGroundItemCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You deleted the ${tempName} item near you`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function pickupItemCommand(command, params, client) {
|
||||
let itemId = getClosestItemOnGround(getPlayerPosition(client));
|
||||
@@ -268,7 +268,7 @@ function pickupItemCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function dropItemCommand(command, params, client) {
|
||||
let hotBarSlot = getPlayerData(client).activeHotBarSlot;
|
||||
@@ -311,7 +311,7 @@ function dropItemCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function putItemCommand(command, params, client) {
|
||||
let hotBarSlot = toInteger(params);
|
||||
@@ -341,7 +341,7 @@ function putItemCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takeItemCommand(command, params, client) {
|
||||
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
||||
@@ -371,7 +371,7 @@ function takeItemCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerUseItem(client, hotBarSlot) {
|
||||
let closestPlayer;
|
||||
@@ -518,7 +518,7 @@ function playerUseItem(client, hotBarSlot) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerDropItem(client, hotBarSlot) {
|
||||
let itemId = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||
@@ -539,7 +539,7 @@ function playerDropItem(client, hotBarSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPutItem(client, hotBarSlot) {
|
||||
let itemId = getPlayerData(client).hotBarItems[hotBarSlot];
|
||||
@@ -576,7 +576,7 @@ function playerPutItem(client, hotBarSlot) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerPickupItem(client, itemId) {
|
||||
meActionToNearbyPlayers(client, `picks up ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} from the ground`);
|
||||
@@ -594,7 +594,7 @@ function playerPickupItem(client, itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerTakeItem(client, itemId) {
|
||||
switch(bestOwner[1]) {
|
||||
@@ -625,7 +625,7 @@ function playerTakeItem(client, itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerSwitchItem(client, newHotBarSlot) {
|
||||
if(newHotBarSlot < -1 || newHotBarSlot > 9) {
|
||||
@@ -698,7 +698,7 @@ function playerSwitchItem(client, newHotBarSlot) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerSwitchHotBarSlotCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -734,7 +734,7 @@ function playerSwitchHotBarSlotCommand(command, params, client) {
|
||||
clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestItemOnGround(position) {
|
||||
let items = getServerData().groundItemCache;
|
||||
@@ -748,7 +748,7 @@ function getClosestItemOnGround(position) {
|
||||
return items[closest];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setItemDataIndexes() {
|
||||
for(let i in getServerData().items) {
|
||||
@@ -761,7 +761,7 @@ function setItemDataIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllGroundItemObjects() {
|
||||
for(let i in getServerData().groundItemCache) {
|
||||
@@ -769,19 +769,19 @@ function createAllGroundItemObjects() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showItemInventoryToPlayer(client, itemIndex) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function syncPlayerInventoryWeapons(client) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFirstEmptyHotBarSlot(client) {
|
||||
for(let i in getPlayerData(client).hotBarItems) {
|
||||
@@ -793,7 +793,7 @@ function getPlayerFirstEmptyHotBarSlot(client) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function cachePlayerHotBarItems(client) {
|
||||
for(let i in getServerData().items) {
|
||||
@@ -808,7 +808,7 @@ function cachePlayerHotBarItems(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteItem(itemId) {
|
||||
switch(getItemData(itemId).ownerType) {
|
||||
@@ -866,7 +866,7 @@ function deleteItem(itemId) {
|
||||
getServerData().items.splice(itemId, 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBestNewOwnerToPutItem(client) {
|
||||
let closestDistance = 100.0;
|
||||
@@ -890,7 +890,7 @@ function getBestNewOwnerToPutItem(client) {
|
||||
return [AG_ITEM_OWNER_NONE, 0];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBestItemToTake(client, slot) {
|
||||
let closestDistance = 100.0;
|
||||
@@ -931,7 +931,7 @@ function getBestItemToTake(client, slot) {
|
||||
return [ownerType, ownerId, itemId];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listPlayerInventoryCommand(command, params, client) {
|
||||
let itemDisplay = [];
|
||||
@@ -966,7 +966,7 @@ function listPlayerInventoryCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listBusinessStorageInventoryCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -1003,7 +1003,7 @@ function listBusinessStorageInventoryCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listBusinessFloorInventoryCommand(command, params, client) {
|
||||
let businessId = (isPlayerInAnyBusiness(client)) ? getPlayerBusiness(client) : getClosestBusinessEntrance(getPlayerPosition(client));
|
||||
@@ -1040,7 +1040,7 @@ function listBusinessFloorInventoryCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listHouseInventoryCommand(command, params, client) {
|
||||
let houseId = (isPlayerInAnyHouse(client)) ? getPlayerHouse(client) : getClosestHouseEntrance(getPlayerPosition(client));
|
||||
@@ -1077,7 +1077,7 @@ function listHouseInventoryCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listItemInventoryCommand(command, params, client) {
|
||||
let itemId = getClosestItemOnGround(getPlayerPosition(client));
|
||||
@@ -1114,19 +1114,19 @@ function listItemInventoryCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemData(itemId) {
|
||||
return getServerData().items[itemId];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemTypeData(itemTypeId) {
|
||||
return getServerData().itemTypes[itemTypeId];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllItemsToDatabase() {
|
||||
for(let i in getServerData().items) {
|
||||
@@ -1136,7 +1136,7 @@ function saveAllItemsToDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveItemToDatabase(itemId) {
|
||||
let tempItemData = getServerData().items[itemId];
|
||||
@@ -1159,7 +1159,7 @@ function saveItemToDatabase(itemId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function storePlayerItemsInJobLocker(client) {
|
||||
for(let i in getPlayerData(client).hotBarItems) {
|
||||
@@ -1172,7 +1172,7 @@ function storePlayerItemsInJobLocker(client) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function restorePlayerJobLockerItems(client) {
|
||||
for(let i in getPlayerData(client).jobEquipmentCache) {
|
||||
@@ -1191,7 +1191,7 @@ function restorePlayerJobLockerItems(client) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemTypeIndexFromDatabaseId(databaseId) {
|
||||
for(let i in getServerData().itemTypes) {
|
||||
@@ -1201,7 +1201,7 @@ function getItemTypeIndexFromDatabaseId(databaseId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerItemActionDelayComplete(client) {
|
||||
switch(getPlayerData(client).itemActionState) {
|
||||
@@ -1234,13 +1234,13 @@ function playerItemActionDelayComplete(client) {
|
||||
getPlayerData(client).itemActionItem = -1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemValueDisplayForItem(itemId) {
|
||||
return getItemValueDisplay(getItemData(itemId).itemTypeIndex, getItemData(itemId).value);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemValueDisplay(itemType, value) {
|
||||
if(getItemTypeData(itemType).useType == AG_ITEM_USETYPE_SKIN) {
|
||||
@@ -1259,7 +1259,7 @@ function getItemValueDisplay(itemType, value) {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFirstItemSlotByUseType(client, useType) {
|
||||
for(let i in getPlayerData(client).hotBarItems) {
|
||||
@@ -1275,7 +1275,7 @@ function getPlayerFirstItemSlotByUseType(client, useType) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleItemEnabledCommand(command, params, client) {
|
||||
if(!getPlayerActiveItem(client)) {
|
||||
@@ -1292,7 +1292,7 @@ function toggleItemEnabledCommand(command, params, client) {
|
||||
messagePlayerNormal(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} [#FFFFFF]your ${getItemName(getPlayerActiveItem(client))} in slot ${getPlayerActiveItemSlot(client)} [#AAAAAA](${getItemValueDisplayForItem(getPlayerActiveItem(client))}`)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getItemName(itemId) {
|
||||
if(getItemData(itemId)) {
|
||||
@@ -1300,7 +1300,7 @@ function getItemName(itemId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerActiveItem(client) {
|
||||
if(getPlayerData(client).activeHotBarSlot != -1) {
|
||||
@@ -1310,7 +1310,7 @@ function getPlayerActiveItem(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerItemSlot(client, slot) {
|
||||
if(slot != -1) {
|
||||
@@ -1320,7 +1320,7 @@ function getPlayerItemSlot(client, slot) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function resyncWeaponItemAmmo(client) {
|
||||
if(getPlayerData(client).currentHotBarItem != -1) {
|
||||
@@ -1338,19 +1338,19 @@ function resyncWeaponItemAmmo(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getOrderPriceForItemType(itemType) {
|
||||
return getItemTypeData(itemType).orderPrice*getServerConfig().inflationMultiplier*getItemTypeData(itemType).demandMultiplier*getItemTypeData(itemType).supplyMultiplier*getItemTypeData(itemType).riskMultiplier;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerItemActionState(client) {
|
||||
getPlayerData(client).itemActionState = AG_ITEM_ACTION_NONE;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerItemActionStateAfterDelay(client, delay) {
|
||||
setTimeout(function() {
|
||||
@@ -1358,4 +1358,4 @@ function clearPlayerItemActionStateAfterDelay(client, delay) {
|
||||
}, delay);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,10 +2,10 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: drink.js
|
||||
// DESC: Provides features and usage for the drink item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,10 +2,10 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: food.js
|
||||
// DESC: Provides features and usage for the food item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,36 +2,36 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: handcuff.js
|
||||
// DESC: Provides features and usage for the handcuff item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerHandCuffed(client) {
|
||||
return (getPlayerData(client).pedState == AG_PEDSTATE_BINDED);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function handCuffPlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unHandCuffPlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSurrendered(client) {
|
||||
return (getPlayerData(client).pedState == AG_PEDSTATE_TAZED || getPlayerData(client).pedState == AG_PEDSTATE_HANDSUP);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,10 +2,10 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: phone.js
|
||||
// DESC: Provides features and usage for the phone item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,30 +2,30 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: handcuff.js
|
||||
// DESC: Provides features and usage for the handcuff item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerTied(client) {
|
||||
return (getPlayerData(client).pedState == AG_PEDSTATE_BINDED);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function ropeTiePlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_BINDED;
|
||||
setPlayerControlState(client, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function ropeUnTiePlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,19 +2,19 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: tazer.js
|
||||
// DESC: Provides features and usage for the tazer item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerTazed(client) {
|
||||
return (getPlayerData(client).pedState == AG_PEDSTATE_TAZED);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function tazePlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_TAZED;
|
||||
@@ -26,11 +26,11 @@ function tazePlayer(client) {
|
||||
}, getGlobalConfig().tazerEffectDuration);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unTazePlayer(client) {
|
||||
getPlayerData(client).pedState = AG_PEDSTATE_READY;
|
||||
setPlayerControlState(client, true);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: walkie-talkie.js
|
||||
// DESC: Provides features and usage for the walkie-talkie item type
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerActiveWalkieTalkieFrequency(client) {
|
||||
let walkieTalkieSlot = getPlayerFirstItemSlotByUseType(client, AG_ITEM_USETYPE_WALKIETALKIE);
|
||||
@@ -24,7 +24,7 @@ function getPlayerActiveWalkieTalkieFrequency(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||
walkieTalkieOutgoingToNearbyPlayers(transmittingPlayer, messageText);
|
||||
@@ -43,7 +43,7 @@ function walkieTalkieTransmit(radioFrequency, messageText, transmittingPlayer) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieOutgoingToNearbyPlayers(client, messageText) {
|
||||
let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().talkDistance);
|
||||
@@ -52,7 +52,7 @@ function walkieTalkieOutgoingToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieIncomingToNearbyPlayers(client, messageText) {
|
||||
let clients = getPlayersInRange(getPlayerPosition(client), getGlobalConfig().walkieTalkieSpeakerDistance);
|
||||
@@ -61,7 +61,7 @@ function walkieTalkieIncomingToNearbyPlayers(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setWalkieTalkieFrequencyCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -104,7 +104,7 @@ function setWalkieTalkieFrequencyCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You set the frequency of you walkie talkie in slot ${getPlayerData(client).activeHotbarSlot} to ${getItemValueDisplayForItem(getPlayerActiveItem(client))}`)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function walkieTalkieChatCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -120,4 +120,4 @@ function walkieTalkieChatCommand(command, params, client) {
|
||||
walkieTalkieTransmit(getPlayerActiveWalkieTalkieFrequency(client), params, client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: job.js
|
||||
// DESC: Provides job functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -25,7 +25,7 @@ function initJobScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobsFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Job]: Loading jobs from database ...");
|
||||
@@ -57,7 +57,7 @@ function loadJobsFromDatabase() {
|
||||
return tempJobs;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllJobEquipmentFromDatabase() {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -65,7 +65,7 @@ function loadAllJobEquipmentFromDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllJobUniformsFromDatabase() {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -73,7 +73,7 @@ function loadAllJobUniformsFromDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadAllJobLocationsFromDatabase() {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -81,7 +81,7 @@ function loadAllJobLocationsFromDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job]: Loading job equipments for job ${jobDatabaseId} from database ...`);
|
||||
@@ -111,7 +111,7 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
||||
return tempJobEquipments;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job]: Loading job locations for job ${jobDatabaseId} from database ...`);
|
||||
@@ -140,7 +140,7 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
||||
return tempJobLocations;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job]: Loading job uniforms for job ${jobDatabaseId} from database ...`);
|
||||
@@ -169,7 +169,7 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
|
||||
return tempJobUniforms;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job]: Loading job equipment items for job equipment ${jobEquipmentDatabaseId} from database ...`);
|
||||
@@ -198,7 +198,7 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
||||
return tempJobEquipmentItems;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllJobBlips() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job] Spawning all job location blips ...`);
|
||||
@@ -212,7 +212,7 @@ function createAllJobBlips() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job] All job location blips spawned!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createAllJobPickups() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job] Spawning all job location pickups ...`);
|
||||
@@ -238,7 +238,7 @@ function createAllJobPickups() {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Job] All job location pickups (${pickupCount}) spawned!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showJobInformationToPlayer(client, jobType) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -326,7 +326,7 @@ function showJobInformationToPlayer(client, jobType) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takeJobCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -357,7 +357,7 @@ function takeJobCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function startWorkingCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -390,7 +390,7 @@ function startWorkingCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopWorkingCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -414,7 +414,7 @@ function stopWorkingCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function startWorking(client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -468,7 +468,7 @@ function startWorking(client) {
|
||||
//showStartedWorkingTip(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobInfoCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
@@ -476,7 +476,7 @@ function getJobInfoCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `[#FFFF00][Job Info] [#FFFFFF]Name: [#AAAAAA]${getJobData(closestJobLocation.job).name}, [#FFFFFF]Enabled: [#AAAAAA]${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).enabled))}, [#FFFFFF]Whitelisted: [#AAAAAA]${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).whiteListEnabled))}, [#FFFFFF]Blacklisted: [#AAAAAA]${getYesNoFromBool(intToBool(getJobData(closestJobLocation.job).blackListEnabled))}, [#FFFFFF]ID: [#AAAAAA]${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobLocationInfoCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
@@ -484,7 +484,7 @@ function getJobLocationInfoCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `[#FFFF00][Job Location Info] [#FFFFFF]Job: [#AAAAAA]${getJobData(closestJobLocation.job).name} (${getJobData(closestJobLocation.job).id}/${closestJobLocation.job}), [#FFFFFF]Enabled: [#AAAAAA]${getYesNoFromBool(closestJobLocation.enabled)}, [#FFFFFF]Database ID: [#AAAAAA]${closestJobLocation.databaseId}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerJobEquipment(client, equipmentId) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -507,7 +507,7 @@ function givePlayerJobEquipment(client, equipmentId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopWorking(client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -585,7 +585,7 @@ function stopWorking(client) {
|
||||
sendPlayerWorkingState(client, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobUniformCommand(command, params, client) {
|
||||
if(!getPlayerJob(client)) {
|
||||
@@ -627,7 +627,7 @@ function jobUniformCommand(command, params, client) {
|
||||
//updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobEquipmentCommand(command, params, client) {
|
||||
if(!getPlayerJob(client)) {
|
||||
@@ -669,7 +669,7 @@ function jobEquipmentCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You have been given the ${equipments[equipmentId-1].name} equipment`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function quitJobCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -681,7 +681,7 @@ function quitJobCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobRadioCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -691,7 +691,7 @@ function jobRadioCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobDepartmentRadioCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)){
|
||||
@@ -702,19 +702,19 @@ function jobDepartmentRadioCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobType(jobId) {
|
||||
return getJobData(jobId).type;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveJobType(client, jobType) {
|
||||
return (getJobType(getPlayerCurrentSubAccount(client).job) == jobType) ? true : false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobData(jobId) {
|
||||
if(typeof getServerData().jobs[jobId] != "undefined") {
|
||||
@@ -724,7 +724,7 @@ function getJobData(jobId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function quitJob(client) {
|
||||
stopWorking(client);
|
||||
@@ -732,14 +732,14 @@ function quitJob(client) {
|
||||
sendPlayerJobType(client, -1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takeJob(client, jobId) {
|
||||
getPlayerCurrentSubAccount(client).job = getJobData(jobId).databaseId;
|
||||
sendPlayerJobType(client, getJobData(jobId).databaseId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadAllJobsCommand(command, params, client) {
|
||||
forceAllPlayersToStopWorking();
|
||||
@@ -759,7 +759,7 @@ function reloadAllJobsCommand(command, params, client) {
|
||||
messageAdminAction(`All server jobs have been reloaded by an admin!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createJobLocationCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -779,7 +779,7 @@ function createJobLocationCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteJobLocationCommand(command, params, client) {
|
||||
let closestJobLocation = getClosestJobLocation(getPlayerPosition(client));
|
||||
@@ -794,7 +794,7 @@ function deleteJobLocationCommand(command, params, client) {
|
||||
getJobData(tempJob).locations.splice(tempIndex, 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleJobLocationEnabledCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -808,7 +808,7 @@ function toggleJobLocationEnabledCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]${getEnabledDisabledFromBool(closestJobLocation.enabled)} location [#AAAAAA]${closestJobLocation.databaseId} [#FFFFFF]for the [#AAAAAA]${getJobData(closestJobLocation.jobIndex).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleJobEnabledCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -822,7 +822,7 @@ function toggleJobEnabledCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]${getEnabledDisabledFromBool(getJobData(jobId).enabled)} [#FFFFFF]the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleJobWhiteListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -836,7 +836,7 @@ function toggleJobWhiteListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]${getEnabledDisabledFromBool(getJobData(jobId).whiteListEnabled)} [#FFFFFF]the whitelist for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleJobBlackListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -850,7 +850,7 @@ function toggleJobBlackListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]${getEnabledDisabledFromBool(getJobData(jobId).blackListEnabled)} [#FFFFFF]the blacklist for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerToJobBlackListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -880,7 +880,7 @@ function addPlayerToJobBlackListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]added ${getCharacterFullName(targetClient)} [#FFFFFF]to the blacklist for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromJobBlackListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -910,7 +910,7 @@ function removePlayerFromJobBlackListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]removed ${getCharacterFullName(targetClient)} [#FFFFFF]from the blacklist for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerToJobWhiteListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -940,7 +940,7 @@ function addPlayerToJobWhiteListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]added ${getCharacterFullName(targetClient)} [#FFFFFF]to the whitelist for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromJobWhiteListCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -970,7 +970,7 @@ function removePlayerFromJobWhiteListCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]removed ${getCharacterFullName(targetClient)} [#FFFFFF]from the whitelist for the [#AAAAAA]${jobData.name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function forceAllPlayersToStopWorking() {
|
||||
getClients().forEach(function(client) {
|
||||
@@ -980,7 +980,7 @@ function forceAllPlayersToStopWorking() {
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobStartRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -1008,7 +1008,7 @@ function jobStartRouteCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function jobStopRouteCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -1035,7 +1035,7 @@ function jobStopRouteCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInJobVehicle(client) {
|
||||
if(getPlayerVehicle(client)) {
|
||||
@@ -1048,7 +1048,7 @@ function isPlayerInJobVehicle(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerWorking(client) {
|
||||
if(!getPlayerCurrentSubAccount(client)) {
|
||||
@@ -1057,7 +1057,7 @@ function isPlayerWorking(client) {
|
||||
return getPlayerCurrentSubAccount(client).isWorking;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function startJobRoute(client) {
|
||||
if(doesPlayerHaveJobType(client, AG_JOB_BUS)) {
|
||||
@@ -1083,7 +1083,7 @@ function startJobRoute(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopJobRoute(client, successful = false, alertPlayer = true) {
|
||||
stopReturnToJobVehicleCountdown(client);
|
||||
@@ -1122,7 +1122,7 @@ function stopJobRoute(client, successful = false, alertPlayer = true) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerOnJobRoute(client) {
|
||||
if(doesPlayerHaveJobType(client, AG_JOB_BUS)) {
|
||||
@@ -1137,7 +1137,7 @@ function isPlayerOnJobRoute(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJobRouteVehicle(client) {
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
@@ -1151,7 +1151,7 @@ function getPlayerJobRouteVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function startReturnToJobVehicleCountdown(client) {
|
||||
getPlayerData(client).returnToJobVehicleTick = getGlobalConfig().returnToJobVehicleTime;
|
||||
@@ -1170,7 +1170,7 @@ function startReturnToJobVehicleCountdown(client) {
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopReturnToJobVehicleCountdown(client) {
|
||||
if(getPlayerData(client).returnToJobVehicleTimer != null) {
|
||||
@@ -1181,7 +1181,7 @@ function stopReturnToJobVehicleCountdown(client) {
|
||||
//getPlayerData(client).returnToJobVehicleTick = 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseJob(client, jobId) {
|
||||
if(doesPlayerHaveStaffPermission(client, getStaffFlagValue("manageJobs"))) {
|
||||
@@ -1207,7 +1207,7 @@ function canPlayerUseJob(client, jobId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteJobLocation(jobLocationData) {
|
||||
if(jobLocationData.pickup) {
|
||||
@@ -1215,21 +1215,21 @@ function deleteJobLocation(jobLocationData) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function freezeJobVehicleForRouteStop(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = false;
|
||||
getPlayerVehicle(client).engine = false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unFreezeJobVehicleForRouteStop(client) {
|
||||
getVehicleData(getPlayerVehicle(client)).engine = true;
|
||||
getPlayerVehicle(client).engine = true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobIdFromDatabaseId(databaseId) {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -1240,7 +1240,7 @@ function getJobIdFromDatabaseId(databaseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setAllJobDataIndexes() {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -1277,7 +1277,7 @@ function setAllJobDataIndexes() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createJobLocation(jobId, position, interior, dimension) {
|
||||
let jobLocationData = new serverClasses.jobLocationData(false);
|
||||
@@ -1295,7 +1295,7 @@ function createJobLocation(jobId, position, interior, dimension) {
|
||||
saveJobLocationToDatabase(jobLocationData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveJobToDatabase(jobData) {
|
||||
if(jobData == null) {
|
||||
@@ -1339,7 +1339,7 @@ function saveJobToDatabase(jobData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveJobLocationToDatabase(jobLocationData) {
|
||||
if(jobLocationData == null) {
|
||||
@@ -1368,7 +1368,7 @@ function saveJobLocationToDatabase(jobLocationData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveJobEquipmentToDatabase(jobEquipmentData) {
|
||||
if(jobEquipmentData == null) {
|
||||
@@ -1397,7 +1397,7 @@ function saveJobEquipmentToDatabase(jobEquipmentData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
||||
if(jobEquipmentItemData == null) {
|
||||
@@ -1425,7 +1425,7 @@ function saveJobEquipmentItemToDatabase(jobEquipmentItemData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveJobUniformToDatabase(jobUniformData) {
|
||||
if(jobUniformData == null) {
|
||||
@@ -1454,7 +1454,7 @@ function saveJobUniformToDatabase(jobUniformData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllJobsToDatabase() {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -1478,7 +1478,7 @@ function saveAllJobsToDatabase() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteJobLocationBlip(jobId, locationId) {
|
||||
if(getJobData(jobId).locations[locationId].blip != null) {
|
||||
@@ -1487,7 +1487,7 @@ function deleteJobLocationBlip(jobId, locationId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteJobLocationPickup(jobId, locationId) {
|
||||
if(getServerData().jobs[jobId].locations[locationId].pickup != null) {
|
||||
@@ -1496,7 +1496,7 @@ function deleteJobLocationPickup(jobId, locationId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createJobLocationPickup(jobId, locationId) {
|
||||
if(getJobData(jobId).pickupModel != -1) {
|
||||
@@ -1517,7 +1517,7 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createJobLocationBlip(jobId, locationId) {
|
||||
if(getJobData(jobId).blipModel != -1) {
|
||||
@@ -1534,7 +1534,7 @@ function createJobLocationBlip(jobId, locationId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerJob(client) {
|
||||
let jobDatabaseId = getPlayerCurrentSubAccount(client).job;
|
||||
@@ -1547,7 +1547,7 @@ function getPlayerJob(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function canPlayerUseJobs(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getServerBitFlags().moderationFlags.jobBanned)) {
|
||||
@@ -1557,7 +1557,7 @@ function canPlayerUseJobs(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getJobIndexFromDatabaseId(databaseId) {
|
||||
for(let i in getServerData().jobs) {
|
||||
@@ -1568,13 +1568,13 @@ function getJobIndexFromDatabaseId(databaseId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isJobWhiteListed(jobId) {
|
||||
return getJobData(jobId).whiteListEnabled;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerOnJobWhiteList(client, jobId) {
|
||||
for(let i in getJobData(jobId).whiteList) {
|
||||
@@ -1586,13 +1586,13 @@ function isPlayerOnJobWhiteList(client, jobId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isJobBlackListed(jobId) {
|
||||
return getJobData(jobId).blackListEnabled;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerOnJobBlackList(client, jobId) {
|
||||
for(let i in getJobData(jobId).blackList) {
|
||||
@@ -1604,7 +1604,7 @@ function isPlayerOnJobBlackList(client, jobId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtJobRouteStop(client) {
|
||||
if(!isPlayerOnJobRoute(client)) {
|
||||
@@ -1620,7 +1620,7 @@ function playerArrivedAtJobRouteStop(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteJobItems(client) {
|
||||
for(let i in getPlayerData(client).jobEquipmentCache) {
|
||||
@@ -1635,4 +1635,4 @@ function deleteJobItems(client) {
|
||||
updatePlayerHotBar(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: bus.js
|
||||
// DESC: Provides bus driver job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
@@ -360,7 +360,7 @@ let busRoutes = [
|
||||
],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomBusRoute(island) {
|
||||
if(busRoutes[getServerGame()][island].length == 1) {
|
||||
@@ -369,7 +369,7 @@ function getRandomBusRoute(island) {
|
||||
return getRandom(0, busRoutes[getServerGame()][island].length-1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getNextStopOnBusRoute(island, busRoute, busRouteStop) {
|
||||
if(!isLastStopOnBusRoute(island, busRoute, busRouteStop)) {
|
||||
@@ -379,7 +379,7 @@ function getNextStopOnBusRoute(island, busRoute, busRouteStop) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isLastStopOnBusRoute(island, busRoute, busRouteStop) {
|
||||
if(busRouteStop == busRoutes[getServerGame()][island][busRoute].positions.length-1) {
|
||||
@@ -388,20 +388,20 @@ function isLastStopOnBusRoute(island, busRoute, busRouteStop) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showNextBusStop(client) {
|
||||
getPlayerData(client).jobRouteStop = getNextStopOnBusRoute(getPlayerData(client).jobRouteStop, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
|
||||
showCurrentBusStop(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentBusStop(client) {
|
||||
sendJobRouteStopToPlayer(client, getBusRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("busDriverGreen"))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtBusStop(client) {
|
||||
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
|
||||
@@ -426,16 +426,16 @@ function playerArrivedAtBusStop(client) {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusRouteStopPosition(island, busRoute, busRouteStop) {
|
||||
return busRoutes[getServerGame()][island][busRoute].positions[busRouteStop];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusRouteData(island, busRoute) {
|
||||
return busRoutes[getServerGame()][island][busRoute];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: drug.js
|
||||
// DESC: Provides drug runner/dealer job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: fire.js
|
||||
// DESC: Provides firefighter job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: garbage.js
|
||||
// DESC: Provides garbage collector job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
@@ -72,7 +72,7 @@ let garbageRoutes = [
|
||||
],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomGarbageRoute(island) {
|
||||
if(garbageRoutes[getServerGame()][island].length == 1) {
|
||||
@@ -81,7 +81,7 @@ function getRandomGarbageRoute(island) {
|
||||
return getRandom(0, garbageRoutes[getServerGame()][island].length-1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getNextStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
|
||||
if(!isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop)) {
|
||||
@@ -91,7 +91,7 @@ function getNextStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
|
||||
if(garbageRouteStop == garbageRoutes[getServerGame()][island][garbageRoute].positions.length-1) {
|
||||
@@ -100,20 +100,20 @@ function isLastStopOnGarbageRoute(island, garbageRoute, garbageRouteStop) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showNextGarbageStop(client) {
|
||||
getPlayerData(client).jobRouteStop = getNextStopOnGarbageRoute(getPlayerData(client).jobRouteStop, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
|
||||
showCurrentGarbageStop(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentGarbageStop(client) {
|
||||
triggerNetworkEvent("ag.showGarbageStop", client, getGarbageRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("garbageDriverGreen"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtGarbageStop(client) {
|
||||
if(isLastStopOnGarbageRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
|
||||
@@ -137,16 +137,16 @@ function playerArrivedAtGarbageStop(client) {
|
||||
}, 5000);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getGarbageRouteStopPosition(island, garbageRoute, garbageRouteStop) {
|
||||
return garbageRoutes[getServerGame()][island][garbageRoute].positions[garbageRouteStop];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getGarbageRouteData(island, garbageRoute) {
|
||||
return garbageRoutes[getServerGame()][island][garbageRoute];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: medic.js
|
||||
// DESC: Provides paramedic job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: pizza-delivery.js
|
||||
// DESC: Provides pizza delivery driver job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
@@ -224,57 +224,38 @@ let pizzaDeliveryStops = [
|
||||
],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getRandomPizzaDeliveryStops(island) {
|
||||
function getRandomPizzaDeliveryStop(island) {
|
||||
if(pizzaDeliveryStops[getServerGame()][island].length == 1) {
|
||||
return 0;
|
||||
}
|
||||
return getRandom(0, pizzaDeliveryStops[getServerGame()][island].length-1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentPizzaDeliveryStop(client) {
|
||||
sendJobDeliveryPointToPlayer(client, getPizzaDeliveryStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute), getColourByName("deliveryPurple"))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerArrivedAtBusStop(client) {
|
||||
if(isLastStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
|
||||
respawnVehicle(getPlayerData(client).jobRouteVehicle);
|
||||
let payout = getPizzaDeliveryPay(getPlayerData(client).jobDeliveryStart, getPlayerData(client).jobDeliveryStop)*getServerData().inflationMultiplier;
|
||||
getPlayerData(client).payDayAmount += payout;
|
||||
messagePlayerNormal(client, `You delivered the pizza! Return to the pizza restaurant if you want to deliver another pizza.`, getColourByName("yellow"));
|
||||
messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of [#AAAAAA]${getPlayerData(client).payDayAmount} will be received in [#AAAAAA]${getTimeDisplayUntilPlayerPayDay(client)}`);
|
||||
getPlayerData(client).jobRouteVehicle = false;
|
||||
getPlayerData(client).jobRoute = 0;
|
||||
getPlayerData(client).jobRouteStop = 0;
|
||||
getPlayerData(client).jobRouteIsland = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
showGameMessage(client, "⌛ Please wait a moment for passengers to get on and off the bus.", getColourByName("busDriverGreen"), 3500);
|
||||
freezeJobVehicleForRouteStop(client);
|
||||
getPlayerData(client).jobRouteStop = getNextStopOnBusRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop);
|
||||
setTimeout(function() {
|
||||
unFreezeJobVehicleForRouteStop(client);
|
||||
showCurrentBusStop(client);
|
||||
showGameMessage(client, "Proceed to the next stop (green checkpoint)", getColourByName("busDriverGreen"), 3500);
|
||||
}, 5000);
|
||||
function playerArrivedAtPizzaDeliveryDestination(client) {
|
||||
respawnVehicle(getPlayerData(client).jobDeliveryVehicle);
|
||||
let payout = applyServerInflationMultiplier(getPizzaDeliveryPay(getPlayerData(client).jobDeliveryStart, getPlayerData(client).jobDeliveryStop));
|
||||
getPlayerData(client).payDayAmount += payout;
|
||||
messagePlayerNormal(client, `You delivered the pizza! Return to the pizza restaurant if you want to deliver another pizza.`, getColourByName("yellow"));
|
||||
messagePlayerNormal(client, `You earned $${payout}. Your total paycheck of [#AAAAAA]${getPlayerData(client).payDayAmount} will be received in [#AAAAAA]${getTimeDisplayUntilPlayerPayDay(client)}`);
|
||||
getPlayerData(client).jobDeliveryVehicle = false;
|
||||
getPlayerData(client).jobDeliveryStart = 0;
|
||||
getPlayerData(client).jobDeliveryStop = 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getBusRouteStopPosition(island, busRoute, busRouteStop) {
|
||||
return busRoutes[getServerGame()][island][busRoute].positions[busRouteStop];
|
||||
function getPizzaDeliveryPay(startPoint, stopPoint) {
|
||||
return Math.floor(getDistance(startPoint, stopPoint));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getBusRouteData(island, busRoute) {
|
||||
return busRoutes[getServerGame()][island][busRoute];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: police.js
|
||||
// DESC: Provides police officer job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
@@ -73,7 +73,7 @@ let patrolRoutes = [
|
||||
],
|
||||
];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeTazerCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -99,7 +99,7 @@ function policeTazerCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeCuffCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -125,7 +125,7 @@ function policeCuffCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeArrestCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -151,7 +151,7 @@ function policeArrestCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeSearchCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -177,7 +177,7 @@ function policeSearchCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeDragCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -203,7 +203,7 @@ function policeDragCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function policeDetainCommand(command, params, client) {
|
||||
if(!canPlayerUseJobs(client)) {
|
||||
@@ -229,7 +229,7 @@ function policeDetainCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerArivedAtPolicePatrolPoint(client) {
|
||||
if(isLastStopOnPolicePatrolRoute(getPlayerData(client).jobRouteIsland, getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop)) {
|
||||
@@ -250,4 +250,4 @@ function playerArivedAtPolicePatrolPoint(client) {
|
||||
showCurrentPolicePatrolPoint(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: taxi.js
|
||||
// DESC: Provides taxi driver job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: weapon.js
|
||||
// DESC: Provides weapons dealer job functions and usage
|
||||
// TYPE: Job (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: keybind.js
|
||||
// DESC: Provides keybind handlers and functions
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -126,14 +126,14 @@ let bindableKeys = {
|
||||
SDLK_RALT: "rightalt",
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initKeyBindScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.KeyBind]: Initializing key bind script ...");
|
||||
logToConsole(LOG_DEBUG, "[Asshat.KeyBind]: Key bind script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -163,7 +163,7 @@ function addKeyBindCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You binded the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key to command: [#AAAAAA]/${tempCommand} ${tempParams}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeKeyBindCommand(command, params, client) {
|
||||
let splitParams = params.split(" ");
|
||||
@@ -186,7 +186,7 @@ function removeKeyBindCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You removed the keybind for the [#AAAAAA]${sdl.getKeyName(keyId)} [#FFFFFF]key`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addPlayerKeyBind(client, keyId, tempCommand, tempParams) {
|
||||
let keyBindData = new serverClasses.keyBindData(keyId, `${tempCommand} ${tempParams}`);
|
||||
@@ -194,7 +194,7 @@ function addPlayerKeyBind(client, keyId, tempCommand, tempParams) {
|
||||
sendAddAccountKeyBindToClient(client, getPlayerKeyBindForKey(client, keyId));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerKeyBind(client, keyId) {
|
||||
quickDatabaseQuery(`DELETE FROM acct_hotkey WHERE acct_hotkey_acct = ${getPlayerData(client).accountData.databaseId} AND acct_hotkey_key = ${keyId}`);
|
||||
@@ -206,7 +206,7 @@ function removePlayerKeyBind(client, keyId) {
|
||||
sendRemoveAccountKeyBindToClient(client, keyId);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForCommand(client, command) {
|
||||
let accountKeyBinds = getPlayerData(client).accountData.keyBinds;
|
||||
@@ -218,7 +218,7 @@ function doesPlayerHaveKeyBindForCommand(client, command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForCommand(client, command) {
|
||||
let accountKeyBinds = getPlayerData(client).accountData.keyBinds;
|
||||
@@ -230,7 +230,7 @@ function getPlayerKeyBindForCommand(client, command) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesPlayerHaveKeyBindForKey(client, key) {
|
||||
let accountKeyBinds = getPlayerData(client).accountData.keyBinds;
|
||||
@@ -242,7 +242,7 @@ function doesPlayerHaveKeyBindForKey(client, key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerKeyBindForKey(client, key) {
|
||||
let accountKeyBinds = getPlayerData(client).accountData.keyBinds;
|
||||
@@ -254,7 +254,7 @@ function getPlayerKeyBindForKey(client, key) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerUsedKeyBind(client, key) {
|
||||
if(!isPlayerLoggedIn(client)) {
|
||||
@@ -281,7 +281,7 @@ function playerUsedKeyBind(client, key) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function sendAccountKeyBindsToClient(client) {
|
||||
for(let i in getPlayerData(client).accountData.keyBinds) {
|
||||
@@ -289,7 +289,7 @@ function sendAccountKeyBindsToClient(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getKeyIdFromParams(params) {
|
||||
let tempParams = toLowerCase(toString(params));
|
||||
@@ -306,4 +306,4 @@ function getKeyIdFromParams(params) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: locale.js
|
||||
// DESC: Provides locale structures, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: messaging.js
|
||||
// DESC: Provides messaging functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdminAction(messageText) {
|
||||
messagePlayerNormal(null, `⚠️ ${messageText}`, getColourByName("orange"));
|
||||
@@ -18,7 +18,7 @@ function messageAdminAction(messageText) {
|
||||
//logToConsole(LOG_INFO, `[Asshat.Messaging] ADMIN: ${messageText}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||
if(isConsole(client)) {
|
||||
@@ -35,7 +35,7 @@ function messagePlayerNormal(client, messageText, colour = COLOUR_WHITE) {
|
||||
//}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messageAdmins(messageText, colour = COLOUR_WHITE) {
|
||||
let clients = getClients();
|
||||
@@ -51,7 +51,7 @@ function messageAdmins(messageText, colour = COLOUR_WHITE) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerError(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -66,7 +66,7 @@ function messagePlayerError(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSyntax(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -81,7 +81,7 @@ function messagePlayerSyntax(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAlert(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -96,7 +96,7 @@ function messagePlayerAlert(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerSuccess(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -111,7 +111,7 @@ function messagePlayerSuccess(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerInfo(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -126,7 +126,7 @@ function messagePlayerInfo(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTip(client, messageText) {
|
||||
if(isConsole(client)) {
|
||||
@@ -141,25 +141,25 @@ function messagePlayerTip(client, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTalk(client, talkingClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerWhisper(client, whisperingClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||
if(!isClientFromDiscord(client)) {
|
||||
@@ -167,22 +167,22 @@ function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerMeAction(client, doingActionClient, messageText) {
|
||||
messagePlayerNormal(client, `${getClientSubAccountName(doingActionClient)} ${messageText}`, getColourByType("meActionMessage"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerClanChat(client, clanChattingClient, messageText) {
|
||||
messagePlayerNormal(client, `(${getClientSubAccountClanRank(clanChattingClient)}) ${getClientSubAccountName(clanChattingClient)} says (clan): ${messageText}`, getColourByType("clanChatMessage"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
||||
messagePlayerNormal(client, `[ADMIN CHAT] [#AAAAAA]${getPlayerData(adminChattingClient).accountData.staffTitle} [#CCCCCC]${getPlayerData(adminChattingClient).accountData.name}: [#FFFFFF]${messageText}`, getColourByType("orange"));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,13 +2,13 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: misc.js
|
||||
// DESC: Provides any uncategorized functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initMiscScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Misc]: Initializing misc script ...");
|
||||
@@ -16,7 +16,7 @@ function initMiscScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPositionCommand(command, params, client) {
|
||||
let position = getPlayerPosition(client);
|
||||
@@ -26,21 +26,21 @@ function getPositionCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleMouseCursorCommand(command, params, client) {
|
||||
sendPlayerMouseCursorToggle(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleMouseCameraCommand(command, params, client) {
|
||||
sendPlayerMouseCameraToggle(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setNewCharacterSpawnPositionCommand(command, params, client) {
|
||||
let position = client.player.position;
|
||||
@@ -51,7 +51,7 @@ function setNewCharacterSpawnPositionCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setNewCharacterMoneyCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -68,7 +68,7 @@ function setNewCharacterMoneyCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setNewCharacterSkinCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -89,7 +89,7 @@ function setNewCharacterSkinCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function submitIdeaCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -103,7 +103,7 @@ function submitIdeaCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function submitBugReportCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -117,7 +117,7 @@ function submitBugReportCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enterExitPropertyCommand(command, params, client) {
|
||||
if(isPlayerInAnyHouse(client)) {
|
||||
@@ -259,7 +259,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadGameFixesResource() {
|
||||
switch(getServerGame()) {
|
||||
@@ -275,7 +275,7 @@ function loadGameFixesResource() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerInfoCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -292,7 +292,7 @@ function getPlayerInfoCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `[#AAAAAA][Player Info] [#FFFFFF]Account: [#AAAAAA]${getPlayerData(targetClient).accountData.name}[${getPlayerData(targetClient).accountData.databaseId}], [#FFFFFF]Character: [#AAAAAA]${getCharacterFullName(client)}[${getPlayerCurrentSubAccount(client).databaseId}], [#FFFFFF]Connected: [#AAAAAA]${getTimeDifferenceDisplay(Math.ceil(sdl.tick/1000), getPlayerData(targetClient).connectTime)} ago, [#FFFFFF]Game Version: [#AAAAAA]${targetClient.gameVersion}, [#FFFFFFF]Client Version: [#AAAAAA]${getPlayerData(targetClient).clientVersion}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerChangeAFKState(client, afkState) {
|
||||
if(afkState) {
|
||||
@@ -302,7 +302,7 @@ function playerChangeAFKState(client, afkState) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkPlayerSpawning() {
|
||||
let clients = getClients();
|
||||
@@ -322,7 +322,7 @@ function checkPlayerSpawning() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showPlayerPrompt(client, promptType, promptMessage, promptTitle) {
|
||||
if(promptType == AG_PROMPT_NONE) {
|
||||
@@ -339,4 +339,4 @@ function showPlayerPrompt(client, promptType, promptMessage, promptTitle) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: moderation.js
|
||||
// DESC: Provides moderation commands, functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -11,7 +11,7 @@
|
||||
function initModerationScript() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function kickClientCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -37,7 +37,7 @@ function kickClientCommand(command, params, client) {
|
||||
targetClient.disconnect();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setClientStaffTitleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -68,7 +68,7 @@ function setClientStaffTitleCommand(command, params, client) {
|
||||
targetClient.disconnect();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function muteClientCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -94,7 +94,7 @@ function muteClientCommand(command, params, client) {
|
||||
setEntityData(targetClient, "ag.muted", true, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unMuteClientCommand(command, params, client) {
|
||||
|
||||
@@ -121,7 +121,7 @@ function unMuteClientCommand(command, params, client) {
|
||||
removeEntityData(targetClient, "ag.muted");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function freezeClientCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -147,7 +147,7 @@ function freezeClientCommand(command, params, client) {
|
||||
setPlayerFrozenState(client, state);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function unFreezeClientCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -173,7 +173,7 @@ function unFreezeClientCommand(command, params, client) {
|
||||
sendPlayerFrozenState(client, false);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoPlayerCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -198,7 +198,7 @@ function gotoPlayerCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to [#AAAAAA]${targetClient.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoVehicleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -222,7 +222,7 @@ function gotoVehicleCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to a [#CC22CC]${getVehicleName(vehicle)} [#AAAAAA](ID ${vehicle.id})`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoBusinessCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -247,7 +247,7 @@ function gotoBusinessCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to business [#0099FF]${getBusinessData(businessId).name} [#AAAAAA](ID ${businessId})`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoGameLocationCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -272,7 +272,7 @@ function gotoGameLocationCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to game location [#AAAAAA]${getGameData().locations[businessId][0]}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoHouseCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -297,7 +297,7 @@ function gotoHouseCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to business [#0099FF]${getHouseData(houseId).description} [#AAAAAA](ID ${houseId})`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoJobLocationCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -329,7 +329,7 @@ function gotoJobLocationCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to location [#AAAAAA]${jobLocationId} [#FFFFFF]for the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function gotoPositionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -356,7 +356,7 @@ function gotoPositionCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported to coordinates [#AAAAAA]${x}, ${y}, ${z} with interior ${int} and dimension ${vw}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportForwardCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -369,7 +369,7 @@ function teleportForwardCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported forward ${params} meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportBackwardCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -382,7 +382,7 @@ function teleportBackwardCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported backward [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportLeftCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -395,7 +395,7 @@ function teleportLeftCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported left [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportUpCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -408,7 +408,7 @@ function teleportUpCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported up [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportDownCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -421,7 +421,7 @@ function teleportDownCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported down [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function teleportRightCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -434,7 +434,7 @@ function teleportRightCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You teleported right [#AAAAAA]${params} [#FFFFFF]meters`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerInteriorCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -459,7 +459,7 @@ function playerInteriorCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You set ${targetClient.name}'s interior to [#AAAAAA]${interiorId}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function playerVirtualWorldCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -484,7 +484,7 @@ function playerVirtualWorldCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You set [#AAAAAA]${targetClient.name}'s [#FFFFFF]virtual world to [#AAAAAA]${dimensionId}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -518,7 +518,7 @@ function getPlayerCommand(command, params, client) {
|
||||
messagePlayerAlert(targetClient, `An admin has teleported you to their location`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addStaffFlagCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -552,7 +552,7 @@ function addStaffFlagCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You have ${getBoolRedGreenInlineColour(true)}given [#AAAAAA]${targetClient.name} [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function takeStaffFlagCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -586,7 +586,7 @@ function takeStaffFlagCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You have ${getBoolRedGreenInlineColour(false)}taken [#FFFFFF]the [#AAAAAA]${flagName} [#FFFFFF]staff flag from [#AAAAAA]${targetClient.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function clearStaffFlagsCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -620,7 +620,7 @@ function clearStaffFlagsCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `You have removed all staff flags from [#AAAAAA]${targetClient.name}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getStaffFlagsCommand(command, params, client) {
|
||||
if(getCommand(command).requireLogin) {
|
||||
@@ -661,7 +661,7 @@ function getStaffFlagsCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `[#FFFFFF]${targetClient.name}'s staff flags: [#AAAAAA]${tempStaffFlags.join("[#FFFFFF], [#AAAAAA]")}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function allStaffFlagsCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -681,7 +681,7 @@ function allStaffFlagsCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `[#FFFFFF]Staff flags: [#AAAAAA]${getServerBitFlagKeys().join("[#FFFFFF], [#AAAAAA]")}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerMoneyCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -704,4 +704,4 @@ function givePlayerMoneyCommand(command, params, client) {
|
||||
messagePlayerAlert(client, `An admin gave you [#AAAAAA]$${amount}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: native.js
|
||||
// DESC: Provides util function to wrap mod-specific stuff
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -10,13 +10,7 @@
|
||||
|
||||
// Use data for each because args are probably gonna be way different for each mod
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function getServerGame() {
|
||||
return server.game;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerPosition(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -28,14 +22,14 @@ function getPlayerPosition(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerPosition(client, position) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s position to ${position.x}, ${position.y}, ${position.z}`);
|
||||
sendPlayerSetPosition(client, position);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHeading(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -47,14 +41,14 @@ function getPlayerHeading(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerHeading(client, heading) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s heading to ${heading}`);
|
||||
sendPlayerSetHeading(client, heading);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -67,13 +61,13 @@ function getPlayerVehicle(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerDimension(client) {
|
||||
return client.player.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerInterior(client) {
|
||||
if(getPlayerData(client)) {
|
||||
@@ -83,14 +77,14 @@ function getPlayerInterior(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerDimension(client, dimension) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s dimension to ${dimension}`);
|
||||
client.player.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerInterior(client, interior) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s interior to ${interior}`);
|
||||
@@ -98,7 +92,7 @@ function setPlayerInterior(client, interior) {
|
||||
getPlayerCurrentSubAccount(client).interior = interior;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyVehicle(client) {
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
@@ -108,7 +102,7 @@ function isPlayerInAnyVehicle(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVehicleSeat(client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -124,37 +118,37 @@ function getPlayerVehicleSeat(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSpawned(client) {
|
||||
return (client.player != null);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehiclePosition(vehicle) {
|
||||
return vehicle.position;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleHeading(vehicle) {
|
||||
return vehicle.heading;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleSyncer(vehicle) {
|
||||
return getElementSyncer(vehicle);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleForNetworkEvent(vehicle) {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteGameElement(element) {
|
||||
logToConsole(LOG_DEBUG, `Destroying game element ${element.id} (Type: ${element.type})`);
|
||||
@@ -165,13 +159,13 @@ function deleteGameElement(element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInFrontVehicleSeat(client) {
|
||||
return (getPlayerVehicleSeat(client) == 0 || getPlayerVehicleSeat(client) == 1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removePlayerFromVehicle(client) {
|
||||
logToConsole(LOG_DEBUG, `Removing ${getPlayerDisplayForConsole(client)} from their vehicle`);
|
||||
@@ -179,20 +173,42 @@ function removePlayerFromVehicle(client) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerSkin(client, skin) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${skin} (${getSkinNameFromId(skin)})`);
|
||||
client.player.modelIndex = skin;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerSkin(client) {
|
||||
return client.player.modelIndex;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerCash(client, amount) {
|
||||
getPlayerCurrentSubAccount(client).cash = amount;
|
||||
updatePlayerCash(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerCash(client, amount) {
|
||||
getPlayerCurrentSubAccount(client).cash += amount;
|
||||
updatePlayerCash(client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function takePlayerCash(client, amount) {
|
||||
getPlayerCurrentSubAccount(client).cash -= amount;
|
||||
updatePlayerCash(client);
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function disconnectPlayer(client) {
|
||||
logToConsole(LOG_DEBUG, `Disconnecting (kicking) ${getPlayerDisplayForConsole(client)}`);
|
||||
@@ -200,44 +216,44 @@ function disconnectPlayer(client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementSyncer(element) {
|
||||
return getClients()[element.syncer];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerWeaponAmmo(client) {
|
||||
return client.player.weaponAmmunition;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerVelocity(client, velocity) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s velocity to ${velocity.x}, ${velocity.y}, ${velocity.z}`);
|
||||
client.player.velocity = velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerVelocity(client, velocity) {
|
||||
return client.player.velocity;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getElementDimension(element) {
|
||||
return element.dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setElementDimension(element, dimension) {
|
||||
return element.dimension = dimension;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerHealth(client, amount) {
|
||||
if(getPlayerHealth(client)+amount > 100) {
|
||||
@@ -249,7 +265,7 @@ function givePlayerHealth(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerArmour(client, amount) {
|
||||
if(getPlayerArmour(client)+amount > 100) {
|
||||
@@ -261,4 +277,4 @@ function givePlayerArmour(client, amount) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: npc.js
|
||||
// DESC: Provides NPC usage and functions
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -16,7 +16,7 @@ const triggerSource = {
|
||||
house,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
const NPC = {
|
||||
Trigger: {
|
||||
@@ -110,10 +110,10 @@ const NPC = {
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function npcTrigger(triggerName, triggerSource) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: biker.js
|
||||
// DESC: Provides biker NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: drugdealer.js
|
||||
// DESC: Provides drug dealer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: firefighter.js
|
||||
// DESC: Provides firefighter NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: gangsta.js
|
||||
// DESC: Provides street gang/hoodlum NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: mafia.js
|
||||
// DESC: Provides mafia/mafioso NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: normal.js
|
||||
// DESC: Provides normal/generic civilian NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: paramedic.js
|
||||
// DESC: Provides paramedic NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: police.js
|
||||
// DESC: Provides police officer NPC interaction and functionality
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: security.js
|
||||
// DESC: Provides security functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: startup.js
|
||||
// DESC: Provides startup/shutdown procedures
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -42,7 +42,7 @@ function initServerScripts() {
|
||||
initCommandScript();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkForHashingModule() {
|
||||
if(typeof module.hashing == "undefined") {
|
||||
@@ -51,7 +51,7 @@ function checkForHashingModule() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkForMySQLModule() {
|
||||
if(typeof module.mysql == "undefined") {
|
||||
@@ -61,7 +61,7 @@ function checkForMySQLModule() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkForSMTPModule() {
|
||||
if(typeof module.smtp == "undefined") {
|
||||
@@ -71,7 +71,7 @@ function checkForSMTPModule() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkForAllRequiredModules() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Startup]: Checking for required modules ...");
|
||||
@@ -98,8 +98,8 @@ function checkForAllRequiredModules() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
initServerScripts();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: subaccount.js
|
||||
// DESC: Provides subaccount (character) functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -13,7 +13,7 @@ function initSubAccountScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.SubAccount]: SubAccount script initialized!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadSubAccountFromName(firstName, lastName) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -33,7 +33,7 @@ function loadSubAccountFromName(firstName, lastName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadSubAccountFromId(subAccountId) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -51,7 +51,7 @@ function loadSubAccountFromId(subAccountId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadSubAccountsFromAccount(accountId) {
|
||||
let tempSubAccounts = [];
|
||||
@@ -75,7 +75,7 @@ function loadSubAccountsFromAccount(accountId) {
|
||||
return tempSubAccounts;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveSubAccountToDatabase(subAccountData) {
|
||||
let dbConnection = connectToDatabase();
|
||||
@@ -153,7 +153,7 @@ function saveSubAccountToDatabase(subAccountData) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, placeOfOrigin) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.Account] Attempting to create subaccount ${firstName} ${lastName} in database`);
|
||||
@@ -174,7 +174,7 @@ function createSubAccount(accountId, firstName, lastName, skinId, dateOfBirth, p
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function showCharacterSelectToClient(client) {
|
||||
getPlayerData(client).switchingCharacter = true;
|
||||
@@ -205,7 +205,7 @@ function showCharacterSelectToClient(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkNewCharacter(client, firstName, lastName, dateOfBirth, placeOfOrigin, skinId) {
|
||||
if(areParamsEmpty(firstName)) {
|
||||
@@ -252,7 +252,7 @@ function checkNewCharacter(client, firstName, lastName, dateOfBirth, placeOfOrig
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkPreviousCharacter(client) {
|
||||
if(getPlayerData(client).subAccounts.length > 1) {
|
||||
@@ -269,7 +269,7 @@ function checkPreviousCharacter(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkNextCharacter(client) {
|
||||
if(getPlayerData(client).subAccounts.length > 1) {
|
||||
@@ -286,7 +286,7 @@ function checkNextCharacter(client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function selectCharacter(client, characterId = -1) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.SubAccount] ${getPlayerDisplayForConsole(client)} character select called (Character ID ${characterId})`);
|
||||
@@ -320,7 +320,7 @@ function selectCharacter(client, characterId = -1) {
|
||||
getPlayerCurrentSubAccount(client).lastLogin = new Date().getTime();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function switchCharacterCommand(command, params, client) {
|
||||
logToConsole(LOG_DEBUG, `[Asshat.SubAccount] ${getPlayerDisplayForConsole(client)} is requesting to switch characters (current character: ${getCharacterFullName(client)} [${getPlayerData(client).currentSubAccount}/${getPlayerCurrentSubAccount(client).databaseId}])`);
|
||||
@@ -351,7 +351,7 @@ function switchCharacterCommand(command, params, client) {
|
||||
showCharacterSelectToClient(client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function newCharacterCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -366,7 +366,7 @@ function newCharacterCommand(command, params, client) {
|
||||
checkNewCharacter(client, firstName, lastName, "01/01/1901", "Liberty City", getServerConfig().newCharacter.skin);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function useCharacterCommand(command, params, client) {
|
||||
if(!getPlayerData(client).switchingCharacter) {
|
||||
@@ -384,7 +384,7 @@ function useCharacterCommand(command, params, client) {
|
||||
selectCharacter(client, characterId-1);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerLastUsedSubAccount(client) {
|
||||
let subAccounts = getPlayerData(client).subAccounts;
|
||||
@@ -397,22 +397,44 @@ function getPlayerLastUsedSubAccount(client) {
|
||||
return lastUsed;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function transferCharacterToServer(subAccountDatabaseId, newServerId) {
|
||||
quickDatabaseQuery(`UPDATE sacct_main SET sacct_server = ${newServerId}, sacct_skin = ${loadServerConfigFromId(newServerId).newCharacter.skin} WHERE sacct_id = ${subAccountDatabaseId} LIMIT 1;`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getCharacterFullName(client) {
|
||||
return `${getPlayerCurrentSubAccount(client).firstName} ${getPlayerCurrentSubAccount(client).lastName}`;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSwitchingCharacter(client) {
|
||||
return getPlayerData(client).switchingCharacter;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerCurrentSubAccount(client) {
|
||||
if(!getPlayerData(client)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let subAccountId = getPlayerData(client).currentSubAccount;
|
||||
if(subAccountId == -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return getPlayerData(client).subAccounts[subAccountId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getClientSubAccountName(client) {
|
||||
let subAccountData = getPlayerCurrentSubAccount(client);
|
||||
return `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: timers.js
|
||||
// DESC: Provides timer functions and features
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -12,13 +12,13 @@ const { slice } = require("core-js/core/array");
|
||||
|
||||
let serverTimers = {};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updateTimeRule() {
|
||||
server.setRule("Time", makeReadableTime(gta.time.hour, gta.time.minute));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllServerDataToDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Utilities]: Saving all server data to database ...");
|
||||
@@ -32,7 +32,7 @@ function saveAllServerDataToDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Utilities]: Saved all server data to database!");
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initTimers() {
|
||||
if(!isDevelopmentServer()) {
|
||||
@@ -45,7 +45,7 @@ function initTimers() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleRentCheck() {
|
||||
for(let i in getServerData().vehicles) {
|
||||
@@ -65,7 +65,7 @@ function vehicleRentCheck() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function updatePings() {
|
||||
let clients = getClients();
|
||||
@@ -76,7 +76,7 @@ function updatePings() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function checkPayDays() {
|
||||
let clients = getClients();
|
||||
@@ -90,4 +90,4 @@ function checkPayDays() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: translate.js
|
||||
// DESC: Provides translation functions
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -151,7 +151,7 @@ let translationLanguages = [
|
||||
|
||||
translationCache = [];
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
async function translateMessage(messageText, translateFrom = defaultLanguageId, translateTo = defaultLanguageId) {
|
||||
if(translateFrom == translateTo) {
|
||||
@@ -182,32 +182,32 @@ async function translateMessage(messageText, translateFrom = defaultLanguageId,
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addTranslationToCache(originalText, translatedText, fromLanguageId, toLanguageId) {
|
||||
translationCache[fromLanguageId][toLanguageId].push([originalText, translatedText]);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function formatTranslationURL(originalText, fromLanguageId, toLanguageId) {
|
||||
return getServerData().translation.translationBaseURL.format(encodeURI(originalText), getLanguageShortCode(fromLanguageId), getLanguageShortCode(toLanguageId));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getLanguageShortCode(languageId) {
|
||||
return translationLanguages[languageId][1];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getLanguageFullName(languageId) {
|
||||
return translationLanguages[languageId][0];
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getLanguageIdFromFullName(languageName) {
|
||||
let languages = translationLanguages;
|
||||
@@ -219,7 +219,7 @@ function getLanguageIdFromFullName(languageName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getLanguageIdFromShortCode(languageShortCode) {
|
||||
let languages = translationLanguages;
|
||||
@@ -231,4 +231,4 @@ function getLanguageIdFromShortCode(languageShortCode) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: trigger.js
|
||||
// DESC: Provides trigger system functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -49,7 +49,7 @@ const triggerTypes = {
|
||||
onVehicleExtraChange,
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function initTriggerScript() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Trigger]: Initializing trigger script ...");
|
||||
@@ -57,7 +57,7 @@ function initTriggerScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createTriggerCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -66,7 +66,7 @@ function createTriggerCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteTriggerCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -75,7 +75,7 @@ function deleteTriggerCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addTriggerConditionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -84,7 +84,7 @@ function addTriggerConditionCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeTriggerConditionCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -93,7 +93,7 @@ function removeTriggerConditionCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function addTriggerResponseCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -102,7 +102,7 @@ function addTriggerResponseCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeTriggerResponseCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -111,7 +111,7 @@ function removeTriggerResponseCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listTriggersCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -120,7 +120,7 @@ function listTriggersCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listTriggerConditionsCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -129,7 +129,7 @@ function listTriggerConditionsCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function listTriggerResponsesCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -138,7 +138,7 @@ function listTriggerResponsesCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleTriggerEnabledCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -147,4 +147,4 @@ function toggleTriggerEnabledCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,29 +2,29 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: tutorial.js
|
||||
// DESC: Provides tutorial functions and features
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function startTutorial(client) {
|
||||
getPlayerData(client).tutorialItem = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
getPlayerData(client).tutorialVehicle = createGroundItem(tutorialItem[0], tutorialItem[1], tutorialItem[3]);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function hasPlayerFinishedTutorial(client) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInTutorial(client) {
|
||||
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: vehicle.js
|
||||
// DESC: Provides vehicle functions and usage
|
||||
// TYPE: Server (JavaScript)
|
||||
@@ -16,7 +16,7 @@ function initVehicleScript() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function loadVehiclesFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Vehicle]: Loading vehicles from database ...");
|
||||
@@ -40,7 +40,7 @@ function loadVehiclesFromDatabase() {
|
||||
return tempVehicles;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllVehiclesToDatabase() {
|
||||
logToConsole(LOG_DEBUG, "[Asshat.Vehicle]: Saving all vehicles to database ...");
|
||||
@@ -53,7 +53,7 @@ function saveAllVehiclesToDatabase() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function saveVehicleToDatabase(vehicleData) {
|
||||
if(vehicleData == null) {
|
||||
@@ -96,7 +96,7 @@ function saveVehicleToDatabase(vehicleData) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function spawnAllVehicles() {
|
||||
for(let i in getServerData().vehicles) {
|
||||
@@ -106,7 +106,7 @@ function spawnAllVehicles() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleData(vehicle) {
|
||||
let dataIndex = getEntityData(vehicle, "ag.dataSlot");
|
||||
@@ -116,7 +116,7 @@ function getVehicleData(vehicle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createVehicleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -137,7 +137,7 @@ function createVehicleCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created a [#AAAAAA]${getVehicleName(vehicle)}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function createTemporaryVehicleCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -158,7 +158,7 @@ function createTemporaryVehicleCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]created a temporary ${getVehicleName(vehicle)}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleLockCommand(command, params, client) {
|
||||
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||
@@ -192,7 +192,7 @@ function vehicleLockCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `${toLowerCase(getLockedUnlockedFromBool(getVehicleData(vehicle).locked))} the ${getVehicleName(vehicle)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleLightsCommand(command, params, client) {
|
||||
if(!getPlayerVehicle(client)) {
|
||||
@@ -218,7 +218,7 @@ function vehicleLightsCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `turned the ${getVehicleName(vehicle)}'s lights ${toLowerCase(getOnOffFromBool(vehicle))}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function deleteVehicleCommand(command, params, client) {
|
||||
if(!getPlayerVehicle(client)) {
|
||||
@@ -242,7 +242,7 @@ function deleteVehicleCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `The ${vehicleName} has been deleted!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleEngineCommand(command, params, client) {
|
||||
if(!getPlayerVehicle(client)) {
|
||||
@@ -273,7 +273,7 @@ function vehicleEngineCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `turned the ${getVehicleName(vehicle)}'s engine ${toLowerCase(getOnOffFromBool(getVehicleData(vehicle).engine))}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleSirenCommand(command, params, client) {
|
||||
if(!getPlayerVehicle(client)) {
|
||||
@@ -304,7 +304,7 @@ function vehicleSirenCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `turns the ${getVehicleName(vehicle)}'s siren ${toLowerCase(getOnOffFromBool(getVehicleData(vehicle).siren))}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleColourCommand(command, params, client) {
|
||||
if(areParamsEmpty(params) && areThereEnoughParams(params, 2)) {
|
||||
@@ -350,7 +350,7 @@ function setVehicleColourCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `resprays the ${getVehicleName(vehicle)}'s colours`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleRepairCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -383,7 +383,7 @@ function vehicleRepairCommand(command, params, client) {
|
||||
meActionToNearbyPlayers(client, `repairs the ${getVehicleName(vehicle)}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function buyVehicleCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -420,7 +420,7 @@ function buyVehicleCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `Drive the vehicle away from the dealership to buy it, or get out to cancel.`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function rentVehicleCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -448,13 +448,13 @@ function rentVehicleCommand(command, params, client) {
|
||||
messagePlayerAlert(client, `You will be charged ${getVehicleData(vehicle).rentPrice} per minute to use this vehicle. To stop renting this vehicle, use /vehrent again.`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function enterVehicleAsPassengerCommand(command, params, client) {
|
||||
triggerNetworkEvent("ag.passenger", client);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopRentingVehicleCommand(command, params, client) {
|
||||
//getPlayerCurrentSubAccount(client).cash -= getVehicleData(vehicle).rentPrice;
|
||||
@@ -464,7 +464,7 @@ function stopRentingVehicleCommand(command, params, client) {
|
||||
messagePlayerAlert(client, `You are no longer renting the ${getVehicleName(vehicle)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesClientHaveVehicleKeys(client, vehicle) {
|
||||
let vehicleData = getVehicleData(vehicle);
|
||||
@@ -508,7 +508,7 @@ function doesClientHaveVehicleKeys(client, vehicle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesClientOwnVehicle(client, vehicle) {
|
||||
let vehicleData = getVehicleData(vehicle);
|
||||
@@ -534,13 +534,13 @@ function doesClientOwnVehicle(client, vehicle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleName(vehicle) {
|
||||
return getVehicleNameFromModelId(vehicle.modelIndex) || "Unknown";
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleJobCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -569,7 +569,7 @@ function setVehicleJobCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to the [#AAAAAA]${getJobData(jobId).name} [#FFFFFF]job! (Job ID ${jobId})`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleRankCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
@@ -600,7 +600,7 @@ function setVehicleRankCommand(command, params, client) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleClanCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -622,7 +622,7 @@ function setVehicleClanCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to the [#AAAAAA]${getClanData(clanId).name} [#FFFFFF]clan`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleToBusinessCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -639,7 +639,7 @@ function setVehicleToBusinessCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to the [#AAAAAA]${getBusinessData(businessId).name} [#FFFFFF]business`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleOwnerCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -661,7 +661,7 @@ function setVehicleOwnerCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]owner to [#AAAAAA]${getClientSubAccountName(client)}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleRentPriceCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -684,7 +684,7 @@ function setVehicleRentPriceCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]rent price to [#AAAAAA]$${amount}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleBuyPriceCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -707,7 +707,7 @@ function setVehicleBuyPriceCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)}'s buy price to $${amount}!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeVehicleOwnerCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -730,7 +730,7 @@ function removeVehicleOwnerCommand(command, params, client) {
|
||||
messagePlayerInfo(client, `Nobody will be able to use this vehicle until it receives a new owner (either bought or set by admin).`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleInfoCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -779,7 +779,7 @@ function getVehicleInfoCommand(command, params, client) {
|
||||
messagePlayerNormal(client, `🚗 [#CC22CC][Vehicle Info] [#FFFFFF]ID: [#AAAAAA]${vehicle.id}, [#FFFFFF]DatabaseID: [#AAAAAA]${vehicleData.databaseId}, [#FFFFFF]Owner: [#AAAAAA]${ownerName}[ID ${vehicleData.ownerId}] (${ownerType}), [#FFFFFF]Type: [#AAAAAA]${getVehicleName(vehicle)}[${vehicle.modelIndex}], [#FFFFFF]BuyPrice: [#AAAAAA]${vehicleData.buyPrice}, [#FFFFFF]RentPrice: [#AAAAAA]${vehicleData.rentPrice}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toggleVehicleSpawnLockCommand(command, params, client) {
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
@@ -800,7 +800,7 @@ function toggleVehicleSpawnLockCommand(command, params, client) {
|
||||
messageAdmins(`[#AAAAAA]${client.name} [#FFFFFF]set their [#AAAAAA]${getVehicleName(vehicle)} [#FFFFFF]to spawn [#AAAAAA]${(spawnLocked) ? "at it's current location" : "wherever a player leaves it."}`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function reloadAllVehiclesCommand(command, params, client) {
|
||||
for(let i in getServerData().vehicles) {
|
||||
@@ -816,7 +816,7 @@ function reloadAllVehiclesCommand(command, params, client) {
|
||||
messageAdminAction(`All server vehicles have been reloaded by an admin!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function respawnAllVehiclesCommand(command, params, client) {
|
||||
for(let i in getServerData().vehicles) {
|
||||
@@ -831,7 +831,7 @@ function respawnAllVehiclesCommand(command, params, client) {
|
||||
messageAdminAction(`All server vehicles have been respawned by an admin!`);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function stopRentingVehicle(client) {
|
||||
let vehicleData = getPlayerData(client).rentingVehicle;
|
||||
@@ -840,7 +840,7 @@ function stopRentingVehicle(client) {
|
||||
respawnVehicle(vehicleData);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function respawnVehicle(vehicle) {
|
||||
let vehicles = getServerData().vehicles;
|
||||
@@ -854,7 +854,7 @@ function respawnVehicle(vehicle) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function spawnVehicle(vehicleData) {
|
||||
let vehicle = gta.createVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
||||
@@ -883,7 +883,7 @@ function spawnVehicle(vehicleData) {
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isVehicleAtPayAndSpray(vehicle) {
|
||||
for(let i in getServerData().payAndSprays[getServerGame()]) {
|
||||
@@ -894,32 +894,32 @@ function isVehicleAtPayAndSpray(vehicle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function repairVehicle(vehicleData) {
|
||||
vehicleData.vehicle.fix();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleColours(vehicle, colour1, colour2) {
|
||||
vehicle.colour1 = colour1;
|
||||
vehicle.colour2 = colour2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleLights(vehicle, lights) {
|
||||
vehicle.lights = lights;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleEngine(vehicle, engine) {
|
||||
vehicle.engine = engine;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setVehicleLocked(vehicle, locked) {
|
||||
vehicle.locked = locked;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: const.js
|
||||
// DESC: Provides constants
|
||||
// TYPE: Shared (JavaScript)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: game-data.js
|
||||
// DESC: Provides coords, ids, names, and other data for the games
|
||||
// TYPE: Shared (JavaScript)
|
||||
@@ -2800,10 +2800,10 @@ let gameData = {
|
||||
],
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getGameData() {
|
||||
return gameData;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
@@ -2,7 +2,7 @@
|
||||
// Asshat-Gaming Roleplay
|
||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
||||
// Copyright (c) 2021 Asshat-Gaming (https://asshatgaming.com)
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
// FILE: native.js
|
||||
// DESC: Provides util funcs for native wrapping
|
||||
// TYPE: Shared (JavaScript)
|
||||
@@ -11,97 +11,97 @@
|
||||
"use strict";
|
||||
setErrorMode(RESOURCEERRORMODE_STRICT);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function and(var1, var2) {
|
||||
return (var1 && var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function or(var1, var2) {
|
||||
return (var1 || var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function not(var1) {
|
||||
return !var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitAnd(var1, var2) {
|
||||
return var1 & var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitOr(var1, var2) {
|
||||
return var1 | var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitXor(var1, var2) {
|
||||
return var1 ^ var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitNot(var1) {
|
||||
return ~var1;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitLeftShift(var1, var2) {
|
||||
return var1 << var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function bitRightShift(var1, var2) {
|
||||
return var1 >> var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThan(var1, var2) {
|
||||
return var1 > var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThan(var1, var2) {
|
||||
return (var1 < var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function greaterThanOrEqualTo(var1, var2) {
|
||||
return (var1 >= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function lessThanOrEqualTo(var1, var2) {
|
||||
return (var1 <= var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function equals(var1, var2) {
|
||||
return (var1 == var2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function modulo(var1, var2) {
|
||||
return var1 % var2;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function add(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -109,7 +109,7 @@ function add(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function subtract(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -117,7 +117,7 @@ function subtract(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function multiply(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -125,7 +125,7 @@ function multiply(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function divide(...args) {
|
||||
return args.reduce((acc, a) => {
|
||||
@@ -133,55 +133,55 @@ function divide(...args) {
|
||||
}, 0);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toArray(...args) {
|
||||
return args;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toInteger(val) {
|
||||
return Number(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toFloat(val, fixed = 2) {
|
||||
return parseFloat((val).toFixed(fixed));
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toString(val) {
|
||||
return String(val);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector3(x, y, z) {
|
||||
return new Vec3(x, y, z);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toVector2(x, y) {
|
||||
return new Vec2(x, y);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toUpperCase(val) {
|
||||
return String(val).toUpperCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function toLowerCase(val) {
|
||||
return String(val).toLowerCase();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isNull(val) {
|
||||
if(val == null) {
|
||||
@@ -195,7 +195,7 @@ function isNull(val) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -206,7 +206,7 @@ function getEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
@@ -218,7 +218,7 @@ function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function removeEntityData(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -227,7 +227,7 @@ function removeEntityData(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function doesEntityDataExist(entity, dataName) {
|
||||
if(entity != null) {
|
||||
@@ -236,7 +236,7 @@ function doesEntityDataExist(entity, dataName) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getDistance(vec1, vec2) {
|
||||
if(isNull(vec1) || isNull(vec2)) {
|
||||
@@ -245,7 +245,7 @@ function getDistance(vec1, vec2) {
|
||||
return vec1.distance(vec2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isConsole(client) {
|
||||
if(client == null) {
|
||||
@@ -255,7 +255,7 @@ function isConsole(client) {
|
||||
return client.console;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function logToConsole(tempLogLevel, text) {
|
||||
if((logLevel & tempLogLevel) || logLevel == LOG_ALL) {
|
||||
@@ -273,13 +273,13 @@ function logToConsole(tempLogLevel, text) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function isSamePlayer(client1, client2) {
|
||||
return (client1 == client2);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getClientFromIndex(index) {
|
||||
let clients = getClients();
|
||||
@@ -290,7 +290,7 @@ function getClientFromIndex(index) {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getConsoleClient() {
|
||||
let clients = getClients();
|
||||
@@ -301,7 +301,7 @@ function getConsoleClient() {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFromParams(params) {
|
||||
let clients = getClients();
|
||||
@@ -326,7 +326,7 @@ function getPlayerFromParams(params) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosToRightOfPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos((-angle+1.57)+(Math.PI/2)))*distance));
|
||||
@@ -337,7 +337,7 @@ function getPosToRightOfPos(pos, angle, distance) {
|
||||
return rightPos;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosToLeftOfPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos((angle+1.57)+(Math.PI/2)))*distance));
|
||||
@@ -348,7 +348,7 @@ function getPosToLeftOfPos(pos, angle, distance) {
|
||||
return leftPos;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosInFrontOfPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos(angle+(Math.PI/2)))*distance));
|
||||
@@ -358,7 +358,7 @@ function getPosInFrontOfPos(pos, angle, distance) {
|
||||
return toVector3(x, y, z);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosBehindPos(pos, angle, distance) {
|
||||
let x = (pos.x+((Math.cos(angle-(Math.PI/2)))*distance));
|
||||
@@ -368,16 +368,90 @@ function getPosBehindPos(pos, angle, distance) {
|
||||
return toVector3(x,y,z);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosAbovePos(pos, distance) {
|
||||
return toVector3(pos.x, pos.y, pos.z+distance);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function getPosBelowPos(pos, distance) {
|
||||
return toVector3(pos.x, pos.y, pos.z-distance);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// ===========================================================================
|
||||
|
||||
function applyOffsetToPos(position, position2) {
|
||||
return toVector3(position.x+position2.x, position.y+position2.y, position.z+position2.z);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getRandom(min, max) {
|
||||
return Math.floor(Math.random() * (toInteger(max) - toInteger(min) + 1)) + toInteger(min)
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getArrayOfElementId(elements) {
|
||||
let tempArray = [];
|
||||
for(let i in elements) {
|
||||
tempArray.push(elements[i].id);
|
||||
}
|
||||
|
||||
return tempArray;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function Enum(constantsList) {
|
||||
let tempTable = {};
|
||||
for(let i in constantsList) {
|
||||
tempTable[constantsList[i]] = i;
|
||||
}
|
||||
return tempTable;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getSyncerFromId(syncerId) {
|
||||
let clients = getClients();
|
||||
return clients[syncerId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGame() {
|
||||
if(isServerScript()) {
|
||||
return server.game;
|
||||
} else {
|
||||
return gta.game;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isServerScript() {
|
||||
return (typeof server != "undefined");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesGameHaveSnow(gameId) {
|
||||
return (getGame() != GAME_GTA_IV);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isGTAIV() {
|
||||
return (getGame() == GAME_GTA_IV);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function arrayBufferToString(arrayBuffer) {
|
||||
return String.fromCharCode.apply(null, new Uint8Array(arrayBuffer));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user