Lots of changes and fixes
* Add guiReady state * Add mouseCameraEnabled state * Make sure GUI is ready on some things * Fix wrong veh prop funcs being used clientside * Add local player ped parts/props util for IV * Add vehicle.lightStatus sync * Add element interior sync * Dont use interior on IV * Use new class structure * Set default anim offset to 1 * Set biz data to save when changing biz properties * Add mouse cam state util * Prefix item type admin cmds with "itemtype" * Fix server config saving * Fix server time setting hour to minute arg * Add player returnTo data types * Make veh rent/buy price numbers readable * Fix wrong house index being used to create blip/pickup on create * Don't cache player hotbar items if working * Fix cache player hotbar items util * Add lots of anims to GTA SA * Try/catch on all data saving to prevent one from blocking the rest * Fix readable time from showing AM for 12 PM (noon) * Set veh interior on create * Dont set engine for spawnlocked vehicles
This commit is contained in:
@@ -24,6 +24,8 @@ let windowTitleAlpha = 180;
|
|||||||
let buttonAlpha = 180;
|
let buttonAlpha = 180;
|
||||||
let textInputAlpha = 180;
|
let textInputAlpha = 180;
|
||||||
|
|
||||||
|
let guiReady = false;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let login = {
|
let login = {
|
||||||
@@ -851,6 +853,8 @@ function initGUI() {
|
|||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
|
||||||
closeAllWindows();
|
closeAllWindows();
|
||||||
|
|
||||||
|
guiReady = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1140,40 +1144,42 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
|
|||||||
}
|
}
|
||||||
|
|
||||||
let isAnyGUIActive = function() {
|
let isAnyGUIActive = function() {
|
||||||
if(infoDialog.window.shown) {
|
if(!guiReady) {
|
||||||
return true;
|
if(infoDialog.window.shown) {
|
||||||
}
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if(yesNoDialog.window.shown) {
|
if(yesNoDialog.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(errorDialog.window.shown) {
|
if(errorDialog.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(register.window.shown) {
|
if(register.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(login.window.shown) {
|
if(login.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newCharacter.window.shown) {
|
if(newCharacter.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(characterSelect.window.shown) {
|
if(characterSelect.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(twoFactorAuth.window.shown) {
|
if(twoFactorAuth.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(listDialog.window.shown) {
|
if(listDialog.window.shown) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -55,4 +55,6 @@ let calledDeathEvent = false;
|
|||||||
let interiorLightsEnabled = true;
|
let interiorLightsEnabled = true;
|
||||||
let interiorLightsColour = toColour(0, 0, 0, 150);
|
let interiorLightsColour = toColour(0, 0, 0, 150);
|
||||||
|
|
||||||
|
let mouseCameraEnabled = false
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -38,7 +38,7 @@ function initScoreBoardListFont() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processScoreBoardRendering() {
|
function processScoreBoardRendering() {
|
||||||
if(isAnyGUIActive()) {
|
if(guiReady && isAnyGUIActive()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,7 +51,8 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkHandler("vrr.showItemActionDelay", showItemActionDelay);
|
addNetworkHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||||
addNetworkHandler("vrr.set2DRendering", setPlayer2DRendering);
|
addNetworkHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||||
addNetworkHandler("vrr.mouseCursor", toggleMouseCursor);
|
addNetworkHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||||
addNetworkHandler("vrr.mouseCamera", setMouseCameraState);
|
addNetworkHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||||
|
addNetworkHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||||
addNetworkHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
addNetworkHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||||
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||||
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
|
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||||
@@ -74,8 +75,8 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkHandler("vrr.stopRadioStream", stopStreamingRadio);
|
addNetworkHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||||
addNetworkHandler("vrr.radioVolume", setStreamingRadioVolume);
|
addNetworkHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||||
|
|
||||||
addNetworkHandler("vrr.veh.lights", toggleVehicleLights);
|
addNetworkHandler("vrr.veh.lights", setVehicleLights);
|
||||||
addNetworkHandler("vrr.veh.engine", toggleVehicleEngine);
|
addNetworkHandler("vrr.veh.engine", setVehicleEngine);
|
||||||
addNetworkHandler("vrr.veh.repair", repairVehicle);
|
addNetworkHandler("vrr.veh.repair", repairVehicle);
|
||||||
|
|
||||||
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
|
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||||
@@ -325,3 +326,12 @@ function makePedStopAnimation(pedId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||||
|
for(let i in parts) {
|
||||||
|
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
||||||
|
localPlayer.changeBodyProp(props[0], props[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -44,14 +44,18 @@ function processSync(event, deltaTime) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleVehicleEngine(vehicle, state) {
|
function setVehicleEngine(vehicleId, state) {
|
||||||
vehicle.engine = state;
|
getElementFromId(vehicleId).engine = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function toggleVehicleLights(vehicle, state) {
|
function setVehicleLights(vehicleId, state) {
|
||||||
getElementFromId(vehicle).lights = state;
|
if(!state) {
|
||||||
|
getElementFromId(vehicleId).lightStatus = 2;
|
||||||
|
} else {
|
||||||
|
getElementFromId(vehicleId).lightStatus = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -65,7 +69,11 @@ function repairVehicle(syncId) {
|
|||||||
function syncVehicleProperties(vehicle) {
|
function syncVehicleProperties(vehicle) {
|
||||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||||
vehicle.lights = lightStatus;
|
if(!lightStatus) {
|
||||||
|
vehicle.lightStatus = 2;
|
||||||
|
} else {
|
||||||
|
vehicle.lightStatus = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||||
@@ -339,6 +347,10 @@ function syncObjectProperties(object) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncElementProperties(element) {
|
function syncElementProperties(element) {
|
||||||
|
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||||
|
element.interior = getEntityData(element, "vrr.interior");
|
||||||
|
}
|
||||||
|
|
||||||
switch(element.type) {
|
switch(element.type) {
|
||||||
case ELEMENT_VEHICLE:
|
case ELEMENT_VEHICLE:
|
||||||
syncVehicleProperties(element);
|
syncVehicleProperties(element);
|
||||||
|
|||||||
@@ -334,8 +334,10 @@ function setLocalPlayerHeading(heading) {
|
|||||||
function setLocalPlayerInterior(interior) {
|
function setLocalPlayerInterior(interior) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
|
||||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||||
localPlayer.interior = interior;
|
if(!isGTAIV()) {
|
||||||
gta.cameraInterior = interior;
|
localPlayer.interior = interior;
|
||||||
|
gta.cameraInterior = interior;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,7 +439,7 @@ function clearSelfOwnedVehicles() {
|
|||||||
|
|
||||||
function setMouseCameraState(state) {
|
function setMouseCameraState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
|
||||||
mouseCameraEnabled = !mouseCameraEnabled;
|
mouseCameraEnabled = state;
|
||||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,6 +452,13 @@ function toggleMouseCursor() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function toggleMouseCursor() {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
|
||||||
|
setMouseCameraState(!mouseCameraEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||||
weaponDamageEvent[clientName] = eventType;
|
weaponDamageEvent[clientName] = eventType;
|
||||||
@@ -697,3 +706,24 @@ function processInteriorLightsRendering() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function getPlayerFromParams(params) {
|
||||||
|
let clients = getClients();
|
||||||
|
if(isNaN(params)) {
|
||||||
|
for(let i in clients) {
|
||||||
|
if(!clients[i].console) {
|
||||||
|
if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||||
|
return clients[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(typeof clients[toInteger(params)] != "undefined") {
|
||||||
|
return clients[toInteger(params)];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -376,7 +376,7 @@ function loadAccountFromName(accountName, fullLoad = false) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempAccountData = new serverClasses.accountData(dbAssoc);
|
let tempAccountData = new AccountData(dbAssoc);
|
||||||
if(fullLoad) {
|
if(fullLoad) {
|
||||||
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
||||||
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
|
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
|
||||||
@@ -402,7 +402,7 @@ function loadAccountFromId(accountId, fullLoad = false) {
|
|||||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempAccountData = new serverClasses.accountData(dbAssoc);
|
let tempAccountData = new AccountData(dbAssoc);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
if(fullLoad) {
|
if(fullLoad) {
|
||||||
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
||||||
@@ -542,11 +542,6 @@ function saveAccountToDatabase(accountData) {
|
|||||||
["acct_ip", accountData.ipAddress],
|
["acct_ip", accountData.ipAddress],
|
||||||
];
|
];
|
||||||
|
|
||||||
let dbQuery = null;
|
|
||||||
let queryString = createDatabaseUpdateQuery("acct_main", data, `acct_id=${accountData.databaseId}`);
|
|
||||||
dbQuery = queryDatabase(dbConnection, queryString);
|
|
||||||
freeDatabaseQuery(dbQuery);
|
|
||||||
|
|
||||||
let data2 = [
|
let data2 = [
|
||||||
["acct_svr_settings", accountData.settings],
|
["acct_svr_settings", accountData.settings],
|
||||||
["acct_svr_staff_title", safeStaffTitle],
|
["acct_svr_staff_title", safeStaffTitle],
|
||||||
@@ -555,11 +550,14 @@ function saveAccountToDatabase(accountData) {
|
|||||||
["acct_svr_chat_scroll_lines", accountData.chatScrollLines],
|
["acct_svr_chat_scroll_lines", accountData.chatScrollLines],
|
||||||
];
|
];
|
||||||
|
|
||||||
dbQuery = null;
|
let queryString1 = createDatabaseUpdateQuery("acct_main", data, `acct_id=${accountData.databaseId}`);
|
||||||
queryString = "";
|
let dbQuery1 = queryDatabase(dbConnection, queryString1);
|
||||||
queryString = createDatabaseUpdateQuery("acct_svr", data2, `acct_svr_acct=${accountData.databaseId} AND acct_svr_svr = ${getServerId()}`);
|
freeDatabaseQuery(dbQuery1);
|
||||||
dbQuery = queryDatabase(dbConnection, queryString);
|
|
||||||
freeDatabaseQuery(dbQuery);
|
let queryString2 = createDatabaseUpdateQuery("acct_svr", data2, `acct_svr_acct=${accountData.databaseId} AND acct_svr_svr=${getServerId()}`);
|
||||||
|
let dbQuery2 = queryDatabase(dbConnection, queryString2);
|
||||||
|
freeDatabaseQuery(dbQuery2);
|
||||||
|
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -568,6 +566,11 @@ function saveAccountToDatabase(accountData) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveAccountKeyBindToDatabase(keyBindData) {
|
function saveAccountKeyBindToDatabase(keyBindData) {
|
||||||
|
if(keyBindData.databaseId == -1) {
|
||||||
|
// Keybind is a default keybind, don't save
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeCommandString = escapeDatabaseString(dbConnection, keyBindData.commandString);
|
let safeCommandString = escapeDatabaseString(dbConnection, keyBindData.commandString);
|
||||||
@@ -575,6 +578,7 @@ function saveAccountKeyBindToDatabase(keyBindData) {
|
|||||||
let data = [
|
let data = [
|
||||||
["acct_hotkey_acct", keyBindData.account],
|
["acct_hotkey_acct", keyBindData.account],
|
||||||
["acct_hotkey_enabled", keyBindData.enabled],
|
["acct_hotkey_enabled", keyBindData.enabled],
|
||||||
|
["acct_hotkey_deleted", keyBindData.deleted],
|
||||||
["acct_hotkey_cmdstr", safeCommandString],
|
["acct_hotkey_cmdstr", safeCommandString],
|
||||||
["acct_hotkey_key", keyBindData.key],
|
["acct_hotkey_key", keyBindData.key],
|
||||||
["acct_hotkey_down", boolToInt(keyBindData.keyState)],
|
["acct_hotkey_down", boolToInt(keyBindData.keyState)],
|
||||||
@@ -630,7 +634,7 @@ function saveAccountStaffNotesDatabase(staffNoteData) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
/*
|
/*
|
||||||
function saveAccountContactsDatabase(accountContactData) {
|
function saveAccountContactsToDatabase(accountContactData) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let safeNoteContent = escapeDatabaseString(dbConnection, accountContactData.note);
|
let safeNoteContent = escapeDatabaseString(dbConnection, accountContactData.note);
|
||||||
@@ -663,7 +667,6 @@ function createAccount(name, password, email = "") {
|
|||||||
let dbQuery = queryDatabase(dbConnection, `INSERT INTO acct_main (acct_name, acct_pass, acct_email, acct_when_registered) VALUES ('${safeName}', '${hashedPassword}', '${safeEmail}', UNIX_TIMESTAMP())`);
|
let dbQuery = queryDatabase(dbConnection, `INSERT INTO acct_main (acct_name, acct_pass, acct_email, acct_when_registered) VALUES ('${safeName}', '${hashedPassword}', '${safeEmail}', UNIX_TIMESTAMP())`);
|
||||||
if(getDatabaseInsertId(dbConnection) > 0) {
|
if(getDatabaseInsertId(dbConnection) > 0) {
|
||||||
let tempAccountData = loadAccountFromId(getDatabaseInsertId(dbConnection), false);
|
let tempAccountData = loadAccountFromId(getDatabaseInsertId(dbConnection), false);
|
||||||
createDefaultKeybindsForAccount(tempAccountData.databaseId);
|
|
||||||
createDefaultAccountServerData(tempAccountData.databaseId);
|
createDefaultAccountServerData(tempAccountData.databaseId);
|
||||||
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
tempAccountData.keyBinds = loadAccountKeybindsFromDatabase(tempAccountData.databaseId);
|
||||||
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
|
tempAccountData.messages = loadAccountMessagesFromDatabase(tempAccountData.databaseId);
|
||||||
@@ -880,7 +883,7 @@ function savePlayerToDatabase(client) {
|
|||||||
if(client.player != null) {
|
if(client.player != null) {
|
||||||
if(getPlayerData(client).returnToPosition != null) {
|
if(getPlayerData(client).returnToPosition != null) {
|
||||||
getPlayerCurrentSubAccount(client).spawnPosition = getPlayerData(client).returnToPosition;
|
getPlayerCurrentSubAccount(client).spawnPosition = getPlayerData(client).returnToPosition;
|
||||||
getPlayerCurrentSubAccount(client).spawnHeading = getPlayerData(client).returnToHeading;
|
getPlayerCurrentSubAccount(client).spawnHeading = getPlayerData(client).returnToHeading.z;
|
||||||
getPlayerCurrentSubAccount(client).interior = getPlayerData(client).returnToInterior;
|
getPlayerCurrentSubAccount(client).interior = getPlayerData(client).returnToInterior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = getPlayerData(client).returnToDimension;
|
getPlayerCurrentSubAccount(client).dimension = getPlayerData(client).returnToDimension;
|
||||||
} else {
|
} else {
|
||||||
@@ -920,7 +923,7 @@ function initClient(client) {
|
|||||||
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
let tempAccountData = loadAccountFromName(getPlayerName(client), true);
|
||||||
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
let tempSubAccounts = loadSubAccountsFromAccount(tempAccountData.databaseId);
|
||||||
|
|
||||||
getServerData().clients[client.index] = new serverClasses.clientData(client, tempAccountData, tempSubAccounts);
|
getServerData().clients[client.index] = new ClientData(client, tempAccountData, tempSubAccounts);
|
||||||
|
|
||||||
let sessionId = saveConnectionToDatabase(client);
|
let sessionId = saveConnectionToDatabase(client);
|
||||||
getServerData().clients[client.index].session = sessionId;
|
getServerData().clients[client.index].session = sessionId;
|
||||||
@@ -971,23 +974,6 @@ function saveConnectionToDatabase(client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createDefaultKeybindsForAccount(accountDatabaseId) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Creating default keybinds for account ${accountDatabaseId} ...`);
|
|
||||||
for(let j = 1 ; j <= 4 ; j++) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Creating default keybinds for account ${accountDatabaseId} on server ${j} ...`);
|
|
||||||
for(let i in getGlobalConfig().keyBind.defaultKeyBinds) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Creating default keybind ${i} for account ${accountDatabaseId} on server ${j} with key ${getKeyIdFromParams(getGlobalConfig().keyBind.defaultKeyBinds[i].keyName.toLowerCase())} ...`);
|
|
||||||
let dbQueryString = `INSERT INTO acct_hotkey (acct_hotkey_acct, acct_hotkey_server, acct_hotkey_key, acct_hotkey_cmdstr, acct_hotkey_when_added, acct_hotkey_down) VALUES (${accountDatabaseId}, ${j}, ${getKeyIdFromParams(getGlobalConfig().keyBind.defaultKeyBinds[i].keyName.toLowerCase())}, '${getGlobalConfig().keyBind.defaultKeyBinds[i].commandString}', UNIX_TIMESTAMP(), ${getGlobalConfig().keyBind.defaultKeyBinds[i].keyState})`;
|
|
||||||
quickDatabaseQuery(dbQueryString);
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Created default keybind ${i} for account ${accountDatabaseId} on server ${j} with key ${getKeyIdFromParams(getGlobalConfig().keyBind.defaultKeyBinds[i].keyName.toLowerCase())}!`);
|
|
||||||
}
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Create default keybinds for account ${accountDatabaseId} on server ${j}!`);
|
|
||||||
}
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Created default keybinds for account ${accountDatabaseId} successfully!`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function createDefaultAccountServerData(accountDatabaseId) {
|
function createDefaultAccountServerData(accountDatabaseId) {
|
||||||
for(let i = 1 ; i <= 5 ; i++) {
|
for(let i = 1 ; i <= 5 ; i++) {
|
||||||
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${i})`;
|
let dbQueryString = `INSERT INTO acct_svr (acct_svr_acct, acct_svr_svr) VALUES (${accountDatabaseId}, ${i})`;
|
||||||
@@ -1005,12 +991,21 @@ function loadAccountKeybindsFromDatabase(accountDatabaseID) {
|
|||||||
let dbQuery = null;
|
let dbQuery = null;
|
||||||
let dbAssoc;
|
let dbAssoc;
|
||||||
|
|
||||||
|
for(let i in getGlobalConfig().keyBind.defaultKeyBinds) {
|
||||||
|
let tempKeyBindData = new KeyBindData(false);
|
||||||
|
tempKeyBindData.databaseId = -1;
|
||||||
|
tempKeyBindData.key = getKeyIdFromParams(getGlobalConfig().keyBind.defaultKeyBinds[i].keyName);
|
||||||
|
tempKeyBindData.commandString = getGlobalConfig().keyBind.defaultKeyBinds[i].commandString;
|
||||||
|
tempKeyBindData.keyState = getGlobalConfig().keyBind.defaultKeyBinds[i].keyState;
|
||||||
|
tempAccountKeybinds.push(tempKeyBindData);
|
||||||
|
}
|
||||||
|
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_hotkey WHERE acct_hotkey_enabled = 1 AND acct_hotkey_acct = ${accountDatabaseID} AND acct_hotkey_server = ${getServerId()}`);
|
dbQuery = queryDatabase(dbConnection, `SELECT * FROM acct_hotkey WHERE acct_hotkey_enabled = 1 AND acct_hotkey_acct = ${accountDatabaseID} AND acct_hotkey_server = ${getServerId()}`);
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempAccountKeyBindData = new serverClasses.keyBindData(dbAssoc);
|
let tempAccountKeyBindData = new KeyBindData(dbAssoc);
|
||||||
tempAccountKeybinds.push(tempAccountKeyBindData);
|
tempAccountKeybinds.push(tempAccountKeyBindData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Account]: Account keybind '${tempAccountKeyBindData.databaseId}' (Key ${tempAccountKeyBindData.key} '${toUpperCase(getKeyNameFromId(tempAccountKeyBindData.key))}') loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -1039,7 +1034,7 @@ function loadAccountStaffNotesFromDatabase(accountDatabaseID) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempAccountStaffNoteData = new serverClasses.accountStaffNoteData(dbAssoc);
|
let tempAccountStaffNoteData = new AccountStaffNoteData(dbAssoc);
|
||||||
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
tempAccountStaffNotes.push(tempAccountStaffNoteData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Account]: Account staff note '${tempAccountStaffNoteData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -1068,7 +1063,7 @@ function loadAccountContactsFromDatabase(accountDatabaseID) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempAccountContactData = new serverClasses.accountContactData(dbAssoc);
|
let tempAccountContactData = new AccountContactData(dbAssoc);
|
||||||
tempAccountContacts.push(tempAccountContactData);
|
tempAccountContacts.push(tempAccountContactData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountContactData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -1097,7 +1092,7 @@ function loadAccountMessagesFromDatabase(accountDatabaseID) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempAccountMessageData = new serverClasses.accountContactData(dbAssoc);
|
let tempAccountMessageData = new AccountContactData(dbAssoc);
|
||||||
tempAccountMessages.push(tempAccountMessageData);
|
tempAccountMessages.push(tempAccountMessageData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Account]: Account contact '${tempAccountMessageData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ function playPlayerAnimationCommand(command, params, client) {
|
|||||||
|
|
||||||
let splitParams = params.split(" ");
|
let splitParams = params.split(" ");
|
||||||
let animationSlot = getAnimationFromParams(splitParams[0]);
|
let animationSlot = getAnimationFromParams(splitParams[0]);
|
||||||
let animationPositionOffset = getAnimationFromParams(splitParams[1]);
|
let animationPositionOffset = getAnimationFromParams(splitParams[1]) || 1;
|
||||||
|
|
||||||
if(!animationSlot) {
|
if(!animationSlot) {
|
||||||
messagePlayerError(client, "That animation doesn't exist!");
|
messagePlayerError(client, "That animation doesn't exist!");
|
||||||
@@ -30,12 +30,18 @@ function playPlayerAnimationCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(toInteger(animationPositionOffset) < 0 || toInteger(animationPositionOffset) > 3) {
|
||||||
|
messagePlayerError(client, "The offset must be between 0 and 3!")
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
getPlayerData(client).currentAnimation = animationSlot;
|
getPlayerData(client).currentAnimation = animationSlot;
|
||||||
getPlayerData(client).currentAnimationPositionOffset = animationSlot;
|
getPlayerData(client).currentAnimationPositionOffset = animationSlot;
|
||||||
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
|
getPlayerData(client).currentAnimationPositionReturnTo = getPlayerPosition(client);
|
||||||
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
|
||||||
//setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
|
//setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
|
||||||
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, animationPositionOffset);
|
makePedPlayAnimation(getPlayerData(client).ped, animationSlot, animationPositionOffset);
|
||||||
|
setPlayerMouseCameraState(client, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -43,6 +49,7 @@ function playPlayerAnimationCommand(command, params, client) {
|
|||||||
function stopPlayerAnimationCommand(command, params, client) {
|
function stopPlayerAnimationCommand(command, params, client) {
|
||||||
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
setPlayerPosition(client, getPlayerData(client).currentAnimationPositionReturnTo);
|
||||||
makePedStopAnimation(getPlayerData(client).ped);
|
makePedStopAnimation(getPlayerData(client).ped);
|
||||||
|
setPlayerMouseCameraState(client, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ function loadAntiCheatGameScriptWhiteListFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempWhiteListedGameScriptData = new serverClasses.whiteListedGameScriptData(dbAssoc);
|
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(dbAssoc);
|
||||||
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
|
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
|
||||||
}
|
}
|
||||||
@@ -50,7 +50,7 @@ function loadAntiCheatGameScriptBlackListFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempBlackListedGameScriptData = new serverClasses.blackListedGameScriptData(dbAssoc);
|
let tempBlackListedGameScriptData = new BlackListedGameScriptData(dbAssoc);
|
||||||
tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
|
tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function loadBusinessFromId(businessId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
return new serverClasses.businessData(dbAssoc);
|
return new BusinessData(dbAssoc);
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
@@ -60,7 +60,7 @@ function loadBusinessesFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempBusinessData = new serverClasses.businessData(dbAssoc);
|
let tempBusinessData = new BusinessData(dbAssoc);
|
||||||
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
||||||
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||||
tempBusinesses.push(tempBusinessData);
|
tempBusinesses.push(tempBusinessData);
|
||||||
@@ -93,7 +93,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempBusinessLocationData = new serverClasses.businessLocationData(dbAssoc);
|
let tempBusinessLocationData = new BusinessLocationData(dbAssoc);
|
||||||
tempBusinessLocations.push(tempBusinessLocationData);
|
tempBusinessLocations.push(tempBusinessLocationData);
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[VRR.Business]: Location '${tempBusinessLocationData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempBusinessGameScriptData = new serverClasses.businessGameScriptData(dbAssoc);
|
let tempBusinessGameScriptData = new BusinessGameScriptData(dbAssoc);
|
||||||
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
tempBusinessGameScripts.push(tempBusinessGameScriptData);
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[VRR.Business]: Game script '${tempBusinessGameScriptData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -185,7 +185,7 @@ function createBusinessLocationCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createBusiness(name, entrancePosition, exitPosition, entrancePickupModel = -1, entranceBlipModel = -1, entranceInteriorId = 0, entranceVirtualWorld = 0, exitInteriorId = -1, exitVirtualWorld = -1, exitPickupModel = -1, exitBlipModel = -1) {
|
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);
|
let tempBusinessData = new BusinessData(false);
|
||||||
tempBusinessData.name = name;
|
tempBusinessData.name = name;
|
||||||
|
|
||||||
tempBusinessData.entrancePosition = entrancePosition;
|
tempBusinessData.entrancePosition = entrancePosition;
|
||||||
@@ -253,6 +253,8 @@ function setBusinessNameCommand(command, params, client) {
|
|||||||
let oldBusinessName = getBusinessData(businessId).name;
|
let oldBusinessName = getBusinessData(businessId).name;
|
||||||
getBusinessData(businessId).name = newBusinessName;
|
getBusinessData(businessId).name = newBusinessName;
|
||||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
|
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}renamed business ${getInlineChatColourByType("businessBlue")}${oldBusinessName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("businessBlue")}${newBusinessName}`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}renamed business ${getInlineChatColourByType("businessBlue")}${oldBusinessName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("businessBlue")}${newBusinessName}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,6 +283,8 @@ function setBusinessOwnerCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER;
|
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PLAYER;
|
||||||
getBusinessData(businessId).ownerId = getServerData().clients[newBusinessOwner.index].accountData.databaseId;
|
getBusinessData(businessId).ownerId = getServerData().clients[newBusinessOwner.index].accountData.databaseId;
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newBusinessOwner.name}`);
|
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newBusinessOwner.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,10 +312,10 @@ function setBusinessClanCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
|
||||||
|
|
||||||
getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
|
getBusinessData(businessId).ownerType = VRR_BIZOWNER_CLAN;
|
||||||
getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
|
getBusinessData(businessId).ownerId = getClanData(clanId).databaseId;
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`);
|
messagePlayerSuccess(`${getInlineChatColourByName("white")}You gave business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}to the ${getInlineChatColourByType("clanOrange")}${getClanData(clanId).name} ${getInlineChatColourByName("white")}clan!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,6 +363,7 @@ function setBusinessClanCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBusinessData(businessId).clanRank = getClanRankData(clanId, clanRankId).level;
|
getBusinessData(businessId).clanRank = getClanRankData(clanId, clanRankId).level;
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(`${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}${getInlineChatColourByName("white")}'s clan rank to ${getInlineChatColourByType("clanOrange")}${getClanRankData(clanId, clanRankId).name} ${getInlineChatColourByName("white")}(level ${getClanRankData(clanId, clanRankId).level}) and above!`);
|
messagePlayerSuccess(`${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}${getInlineChatColourByName("white")}'s clan rank to ${getInlineChatColourByType("clanOrange")}${getClanRankData(clanId, clanRankId).name} ${getInlineChatColourByName("white")}(level ${getClanRankData(clanId, clanRankId).level}) and above!`);
|
||||||
}
|
}
|
||||||
@@ -391,6 +396,8 @@ function setBusinessJobCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).ownerType = VRR_BIZOWNER_JOB;
|
getBusinessData(businessId).ownerType = VRR_BIZOWNER_JOB;
|
||||||
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
getBusinessData(businessId).ownerId = getJobData(jobId).databaseId;
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("jobYellow")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner to the ${getInlineChatColourByType("jobYellow")}${getJobData(jobId).name} ${getInlineChatColourByName("white")}job`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,6 +417,8 @@ function setBusinessPublicCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PUBLIC;
|
getBusinessData(businessId).ownerType = VRR_BIZOWNER_PUBLIC;
|
||||||
getBusinessData(businessId).ownerId = 0;
|
getBusinessData(businessId).ownerId = 0;
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner set to ${getInlineChatColourByName("lightGrey")}public`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}owner set to ${getInlineChatColourByName("lightGrey")}public`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,6 +445,8 @@ function lockUnlockBusinessCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
|
getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
|
||||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
|
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`);
|
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -466,10 +477,9 @@ function lockUnlockBusinessCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
|
getBusinessData(businessId).interiorLights = !getBusinessData(businessId).interiorLights;
|
||||||
|
updateBusinessInteriorLightsForOccupants(businessId);
|
||||||
|
|
||||||
getBusinessData(businessId).needsSaved = true;
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
updateBusinessInteriorLightsForOccupants(businessId);
|
|
||||||
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
|
meActionToNearbyPlayers(client, `turns ${toLowerCase(getOnOffFromBool(getBusinessData(businessId).interiorLights))} the business lights`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -493,6 +503,7 @@ function setBusinessEntranceFeeCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getBusinessData(businessId).entranceFee = entranceFee;
|
getBusinessData(businessId).entranceFee = entranceFee;
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance fee to [#AAAAAAA]$${entranceFee}`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance fee to [#AAAAAAA]$${entranceFee}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -566,6 +577,8 @@ function setBusinessPickupCommand(command, params, client) {
|
|||||||
createBusinessEntrancePickup(businessId);
|
createBusinessEntrancePickup(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
createBusinessExitPickup(businessId);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}pickup display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}'!`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}pickup display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}'!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,7 +595,7 @@ function setBusinessInteriorTypeCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(typeParam)) {
|
if(isNaN(typeParam)) {
|
||||||
let tempBusinessLocation = new serverClasses.businessLocationData(false);
|
let tempBusinessLocation = new BusinessLocationData(false);
|
||||||
|
|
||||||
if(toLowerCase(typeParam) == "none") {
|
if(toLowerCase(typeParam) == "none") {
|
||||||
tempBusinessLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
|
tempBusinessLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
|
||||||
@@ -641,6 +654,7 @@ function setBusinessBlipCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
resetBusinessBlips();
|
resetBusinessBlips();
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}blip display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}blip display to ${getInlineChatColourByName("lightGrey")}${toLowerCase(typeParam)}`);
|
||||||
}
|
}
|
||||||
@@ -758,6 +772,8 @@ function withdrawFromBusinessCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).till -= amount;
|
getBusinessData(businessId).till -= amount;
|
||||||
givePlayerCash(client, amount);
|
givePlayerCash(client, amount);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messagePlayerSuccess(client, `You withdrew $${amount} from business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} till`);
|
messagePlayerSuccess(client, `You withdrew $${amount} from business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} till`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -786,6 +802,8 @@ function setBusinessBuyPriceCommand(command, params, client) {
|
|||||||
|
|
||||||
getBusinessData(businessId).buyPrice = amount;
|
getBusinessData(businessId).buyPrice = amount;
|
||||||
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
|
setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`);
|
messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -815,6 +833,8 @@ function depositIntoBusinessCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).till += amount;
|
getBusinessData(businessId).till += amount;
|
||||||
takePlayerCash(client, amount);
|
takePlayerCash(client, amount);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
messagePlayerSuccess(client, `You deposited $${amount} into business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}till`);
|
messagePlayerSuccess(client, `You deposited $${amount} into business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}till`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -861,6 +881,7 @@ function orderItemForBusinessCommand(command, params, client) {
|
|||||||
getPlayerData(client).businessOrderValue = value;
|
getPlayerData(client).businessOrderValue = value;
|
||||||
getPlayerData(client).businessOrderCost = orderTotalCost;
|
getPlayerData(client).businessOrderCost = orderTotalCost;
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
showPlayerPrompt(client, VRR_PROMPT_BIZORDER, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${makeLargeNumberReadable(pricePerItem)} each will cost a total of $${makeLargeNumberReadable(orderTotalCost)}`, "Business Order Cost");
|
showPlayerPrompt(client, VRR_PROMPT_BIZORDER, `Ordering ${amount} ${getPluralForm(getItemTypeData(itemType).name)} (${getItemValueDisplay(itemType, value)}) at $${makeLargeNumberReadable(pricePerItem)} each will cost a total of $${makeLargeNumberReadable(orderTotalCost)}`, "Business Order Cost");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -920,6 +941,7 @@ function buyBusinessCommand(command, params, client) {
|
|||||||
getBusinessData(businessId).buyPrice = 0;
|
getBusinessData(businessId).buyPrice = 0;
|
||||||
|
|
||||||
updateBusinessPickupLabelData(businessId);
|
updateBusinessPickupLabelData(businessId);
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`);
|
messagePlayerSuccess(client, `You are now the owner of ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}`);
|
||||||
}
|
}
|
||||||
@@ -948,6 +970,8 @@ function moveBusinessEntranceCommand(command, params, client) {
|
|||||||
createBusinessEntranceBlip(businessId);
|
createBusinessEntranceBlip(businessId);
|
||||||
createBusinessEntrancePickup(businessId);
|
createBusinessEntrancePickup(businessId);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance to their position`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}entrance to their position`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -975,6 +999,8 @@ function moveBusinessExitCommand(command, params, client) {
|
|||||||
createBusinessExitBlip(businessId);
|
createBusinessExitBlip(businessId);
|
||||||
createBusinessExitPickup(businessId);
|
createBusinessExitPickup(businessId);
|
||||||
|
|
||||||
|
getBusinessData(businessId).needsSaved = true;
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}exit to their position`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}moved business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}exit to their position`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,7 +1266,7 @@ function deleteBusiness(businessId, deletedBy = 0) {
|
|||||||
|
|
||||||
removePlayersFromBusiness(businessId);
|
removePlayersFromBusiness(businessId);
|
||||||
|
|
||||||
getServerData().businesses.splice(businessId, 1);
|
getServerData().businesses[businessId] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1401,7 +1427,7 @@ function setAllBusinessIndexes() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
|
function addToBusinessInventory(businessId, itemType, amount, buyPrice) {
|
||||||
let tempItemData = new serverClasses.itemData(false);
|
let tempItemData = new ItemData(false);
|
||||||
tempItemData.amount = amount;
|
tempItemData.amount = amount;
|
||||||
tempItemData.buyPrice = buyPrice;
|
tempItemData.buyPrice = buyPrice;
|
||||||
tempItemData.itemType = getItemTypeData(itemType).databaseId;
|
tempItemData.itemType = getItemTypeData(itemType).databaseId;
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function loadClansFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempClanData = new serverClasses.clanData(dbAssoc);
|
let tempClanData = new ClanData(dbAssoc);
|
||||||
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
//tempClanData.members = loadClanMembersFromDatabase(tempClanData.databaseId);
|
||||||
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
tempClanData.ranks = loadClanRanksFromDatabase(tempClanData.databaseId);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
@@ -59,7 +59,7 @@ function loadClanMembersFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempClanData = new serverClasses.clanData(dbAssoc);
|
let tempClanData = new ClanData(dbAssoc);
|
||||||
tempClans.push(tempClanData);
|
tempClans.push(tempClanData);
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan '${tempClanData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempClanRankData = new serverClasses.clanRankData(dbAssoc);
|
let tempClanRankData = new ClanRankData(dbAssoc);
|
||||||
tempClanRanks.push(tempClanRankData);
|
tempClanRanks.push(tempClanRankData);
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
logToConsole(LOG_VERBOSE, `[VRR.Clan]: Clan rank '${tempClanRankData.name}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ function loadClanRanksFromDatabase(clanDatabaseId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createClanRank(clanId, rankId, rankName) {
|
function createClanRank(clanId, rankId, rankName) {
|
||||||
let tempClanRankData = new serverClasses.clanRankData(false);
|
let tempClanRankData = new ClanRankData(false);
|
||||||
tempClanRankData.level = rankId;
|
tempClanRankData.level = rankId;
|
||||||
tempClanRankData.name = rankName;
|
tempClanRankData.name = rankName;
|
||||||
tempClanRankData.clan = getClanData(clanId).databaseId;
|
tempClanRankData.clan = getClanData(clanId).databaseId;
|
||||||
@@ -770,7 +770,7 @@ function createClan(name) {
|
|||||||
escapedName = escapeDatabaseString(dbConnection, escapedName)
|
escapedName = escapeDatabaseString(dbConnection, escapedName)
|
||||||
queryDatabase(dbConnection, `INSERT INTO clan_main (clan_server, clan_name) VALUES (${getServerId()}, '${escapedName}')`);
|
queryDatabase(dbConnection, `INSERT INTO clan_main (clan_server, clan_name) VALUES (${getServerId()}, '${escapedName}')`);
|
||||||
|
|
||||||
let tempClan = new serverClasses.clanData(false);
|
let tempClan = new ClanData(false);
|
||||||
tempClan.databaseId = getDatabaseInsertId(dbConnection);
|
tempClan.databaseId = getDatabaseInsertId(dbConnection);
|
||||||
tempClan.name = name;
|
tempClan.name = name;
|
||||||
getServerData().clans.push(tempClan);
|
getServerData().clans.push(tempClan);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -434,6 +434,13 @@ function sendPlayerMouseCameraToggle(client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setPlayerMouseCameraState(client, state) {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
|
||||||
|
triggerNetworkEvent("vrr.mouseCameraForce", client, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function sendPlayerMouseCursorToggle(client) {
|
function sendPlayerMouseCursorToggle(client) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
|
||||||
triggerNetworkEvent("vrr.mouseCursor", client);
|
triggerNetworkEvent("vrr.mouseCursor", client);
|
||||||
@@ -1006,3 +1013,9 @@ function forcePlayerToSyncElementProperties(client, element) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function sendPlayerPedPartsAndProps(client) {
|
||||||
|
triggerNetworkEvent("vrr.ped")
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -247,10 +247,12 @@ function loadCommands() {
|
|||||||
commandData("r", walkieTalkieChatCommand, "", getStaffFlagValue("none"), true, false),
|
commandData("r", walkieTalkieChatCommand, "", getStaffFlagValue("none"), true, false),
|
||||||
|
|
||||||
commandData("additemtype", createItemTypeCommand, "<name>", getStaffFlagValue("manageItems"), true, false),
|
commandData("additemtype", createItemTypeCommand, "<name>", getStaffFlagValue("manageItems"), true, false),
|
||||||
commandData("itemusetype", setItemTypeUseTypeCommand, "<item type> <use type>", getStaffFlagValue("manageItems"), true, false),
|
commandData("itemtypeusetype", setItemTypeUseTypeCommand, "<item type> <use type>", getStaffFlagValue("manageItems"), true, false),
|
||||||
commandData("itemuseval", setItemTypeUseValueCommand, "<item type> <use value>", getStaffFlagValue("manageItems"), true, false),
|
commandData("itemtypeuseval", setItemTypeUseValueCommand, "<item type> <use value>", getStaffFlagValue("manageItems"), true, false),
|
||||||
commandData("itemorderprice", setItemTypeOrderPriceCommand, "<item type> <price>", getStaffFlagValue("manageItems"), true, false),
|
commandData("itemtypeorderprice", setItemTypeOrderPriceCommand, "<item type> <price>", getStaffFlagValue("manageItems"), true, false),
|
||||||
commandData("itemriskmult", setItemTypeRiskMultiplierCommand, "<item type> <risk multiplier>", getStaffFlagValue("manageItems"), true, false),
|
commandData("itemtyperiskmult", setItemTypeRiskMultiplierCommand, "<item type> <risk multiplier>", getStaffFlagValue("manageItems"), true, false),
|
||||||
|
|
||||||
|
commandData("delplritem", deleteItemInPlayerInventoryCommand, "<player name/id> <item slot>", getStaffFlagValue("manageItems"), true, false),
|
||||||
],
|
],
|
||||||
job: [
|
job: [
|
||||||
commandData("takejob", takeJobCommand, "", getStaffFlagValue("none"), true, false),
|
commandData("takejob", takeJobCommand, "", getStaffFlagValue("none"), true, false),
|
||||||
@@ -462,7 +464,7 @@ function getCommands() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function commandData(command, handlerFunction, syntaxString = "", requiredStaffFlags = getStaffFlagValue("none"), requireLogin = true, allowOnDiscord = true, usageHelpMessage) {
|
function commandData(command, handlerFunction, syntaxString = "", requiredStaffFlags = getStaffFlagValue("none"), requireLogin = true, allowOnDiscord = true, usageHelpMessage) {
|
||||||
return new serverClasses.commandData(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, usageHelpMessage);
|
return new CommandData(command, handlerFunction, syntaxString, requiredStaffFlags, requireLogin, allowOnDiscord, usageHelpMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ function loadServerConfigFromGameAndPort(gameId, port, mpMod) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempServerConfigData = new serverClasses.serverConfigData(dbAssoc);
|
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
return tempServerConfigData;
|
return tempServerConfigData;
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ function loadServerConfigFromId(tempServerId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
let tempServerConfigData = serverClasses.serverConfigData(dbAssoc);
|
let tempServerConfigData = new ServerConfigData(dbAssoc);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
return tempServerConfigData;
|
return tempServerConfigData;
|
||||||
}
|
}
|
||||||
@@ -134,62 +134,62 @@ function applyConfigToServer(tempServerConfig) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function saveServerConfigToDatabase(serverConfigData) {
|
function saveServerConfigToDatabase() {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Config]: Saving server ${serverConfigData.databaseId} configuration to database ...`);
|
logToConsole(LOG_DEBUG, `[VRR.Config]: Saving server ${serverConfigData.databaseId} configuration to database ...`);
|
||||||
if(getServerConfig().needsSaved) {
|
if(getServerConfig().needsSaved) {
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if(dbConnection) {
|
if(dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
["svr_logo", boolToInt(serverConfigData.showLogo)],
|
["svr_logo", boolToInt(getServerConfig().showLogo)],
|
||||||
["svr_gui", boolToInt(serverConfigData.useGUI)],
|
["svr_gui", boolToInt(getServerConfig().useGUI)],
|
||||||
["svr_start_time_hour", serverConfigData.hour],
|
["svr_start_time_hour", getServerConfig().hour],
|
||||||
["svr_start_time_min", serverConfigData.minute],
|
["svr_start_time_min", getServerConfig().minute],
|
||||||
["svr_start_weather", serverConfigData.weather],
|
["svr_start_weather", getServerConfig().weather],
|
||||||
["svr_start_snow_falling", boolToInt(serverConfigData.fallingSnow)],
|
["svr_start_snow_falling", boolToInt(getServerConfig().fallingSnow)],
|
||||||
["svr_start_snow_ground", boolToInt(serverConfigData.groundSnow)],
|
["svr_start_snow_ground", boolToInt(getServerConfig().groundSnow)],
|
||||||
["svr_newchar_pos_x", serverConfigData.newCharacter.spawnPosition.x],
|
["svr_newchar_pos_x", getServerConfig().newCharacter.spawnPosition.x],
|
||||||
["svr_newchar_pos_y", serverConfigData.newCharacter.spawnPosition.y],
|
["svr_newchar_pos_y", getServerConfig().newCharacter.spawnPosition.y],
|
||||||
["svr_newchar_pos_z", serverConfigData.newCharacter.spawnPosition.z],
|
["svr_newchar_pos_z", getServerConfig().newCharacter.spawnPosition.z],
|
||||||
["svr_newchar_rot_z", serverConfigData.newCharacter.spawnHeading],
|
["svr_newchar_rot_z", getServerConfig().newCharacter.spawnHeading],
|
||||||
["svr_newchar_skin", serverConfigData.newCharacter.skin],
|
["svr_newchar_skin", getServerConfig().newCharacter.skin],
|
||||||
["svr_newchar_money", serverConfigData.newCharacter.money],
|
["svr_newchar_money", getServerConfig().newCharacter.money],
|
||||||
["svr_gui_col1_r", serverConfigData.guiColour[0]],
|
["svr_gui_col1_r", getServerConfig().guiColour[0]],
|
||||||
["svr_gui_col1_g", serverConfigData.guiColour[1]],
|
["svr_gui_col1_g", getServerConfig().guiColour[1]],
|
||||||
["svr_gui_col1_b", serverConfigData.guiColour[2]],
|
["svr_gui_col1_b", getServerConfig().guiColour[2]],
|
||||||
["svr_connectcam_pos_x", serverConfigData.connectCameraPosition.x],
|
["svr_connectcam_pos_x", getServerConfig().connectCameraPosition.x],
|
||||||
["svr_connectcam_pos_y", serverConfigData.connectCameraPosition.y],
|
["svr_connectcam_pos_y", getServerConfig().connectCameraPosition.y],
|
||||||
["svr_connectcam_pos_z", serverConfigData.connectCameraPosition.z],
|
["svr_connectcam_pos_z", getServerConfig().connectCameraPosition.z],
|
||||||
["svr_connectcam_lookat_x", serverConfigData.connectCameraLookAt.x],
|
["svr_connectcam_lookat_x", getServerConfig().connectCameraLookAt.x],
|
||||||
["svr_connectcam_lookat_y", serverConfigData.connectCameraLookAt.y],
|
["svr_connectcam_lookat_y", getServerConfig().connectCameraLookAt.y],
|
||||||
["svr_connectcam_lookat_z", serverConfigData.connectCameraLookAt.z],
|
["svr_connectcam_lookat_z", getServerConfig().connectCameraLookAt.z],
|
||||||
["svr_charselect_cam_pos_x", serverConfigData.characterSelectCameraPosition.x],
|
["svr_charselect_cam_pos_x", getServerConfig().characterSelectCameraPosition.x],
|
||||||
["svr_charselect_cam_pos_y", serverConfigData.characterSelectCameraPosition.y],
|
["svr_charselect_cam_pos_y", getServerConfig().characterSelectCameraPosition.y],
|
||||||
["svr_charselect_cam_pos_z", serverConfigData.characterSelectCameraPosition.z],
|
["svr_charselect_cam_pos_z", getServerConfig().characterSelectCameraPosition.z],
|
||||||
["svr_charselect_cam_lookat_x", serverConfigData.characterSelectCameraLookAt.x],
|
["svr_charselect_cam_lookat_x", getServerConfig().characterSelectCameraLookAt.x],
|
||||||
["svr_charselect_cam_lookat_y", serverConfigData.characterSelectCameraLookAt.y],
|
["svr_charselect_cam_lookat_y", getServerConfig().characterSelectCameraLookAt.y],
|
||||||
["svr_charselect_cam_lookat_z", serverConfigData.characterSelectCameraLookAt.z],
|
["svr_charselect_cam_lookat_z", getServerConfig().characterSelectCameraLookAt.z],
|
||||||
["svr_charselect_ped_pos_x", serverConfigData.characterSelectPedPosition.x],
|
["svr_charselect_ped_pos_x", getServerConfig().characterSelectPedPosition.x],
|
||||||
["svr_charselect_ped_pos_y", serverConfigData.characterSelectPedPosition.y],
|
["svr_charselect_ped_pos_y", getServerConfig().characterSelectPedPosition.y],
|
||||||
["svr_charselect_ped_pos_z", serverConfigData.characterSelectPedPosition.z],
|
["svr_charselect_ped_pos_z", getServerConfig().characterSelectPedPosition.z],
|
||||||
["svr_charselect_ped_rot_z", serverConfigData.characterSelectPedHeading],
|
["svr_charselect_ped_rot_z", getServerConfig().characterSelectPedHeading],
|
||||||
["svr_charselect_int", serverConfigData.characterSelectInterior],
|
["svr_charselect_int", getServerConfig().characterSelectInterior],
|
||||||
["svr_charselect_vw", serverConfigData.characterSelectDimension],
|
["svr_charselect_vw", getServerConfig().characterSelectDimension],
|
||||||
["svr_inflation_multiplier", serverConfigData.inflationMultiplier],
|
["svr_inflation_multiplier", getServerConfig().inflationMultiplier],
|
||||||
["svr_ac_enabled", serverConfigData.antiCheat.enabled],
|
["svr_ac_enabled", getServerConfig().antiCheat.enabled],
|
||||||
["svr_ac_check_scripts", serverConfigData.antiCheat.checkGameScripts],
|
["svr_ac_check_scripts", getServerConfig().antiCheat.checkGameScripts],
|
||||||
["svr_ac_script_wl", serverConfigData.antiCheat.gameScriptWhiteListEnabled],
|
["svr_ac_script_wl", getServerConfig().antiCheat.gameScriptWhiteListEnabled],
|
||||||
["svr_ac_script_bl", serverConfigData.antiCheat.gameScriptBlackListEnabled],
|
["svr_ac_script_bl", getServerConfig().antiCheat.gameScriptBlackListEnabled],
|
||||||
["svr_job_pickups", boolToInt(serverConfigData.createJobPickups)],
|
["svr_job_pickups", boolToInt(getServerConfig().createJobPickups)],
|
||||||
["svr_job_blips", boolToInt(serverConfigData.createJobBlips)],
|
["svr_job_blips", boolToInt(getServerConfig().createJobBlips)],
|
||||||
["svr_biz_pickups", boolToInt(serverConfigData.createBusinessPickups)],
|
["svr_biz_pickups", boolToInt(getServerConfig().createBusinessPickups)],
|
||||||
["svr_biz_blips", boolToInt(serverConfigData.createBusinessBlips)],
|
["svr_biz_blips", boolToInt(getServerConfig().createBusinessBlips)],
|
||||||
["svr_house_pickups", boolToInt(serverConfigData.createHousePickups)],
|
["svr_house_pickups", boolToInt(getServerConfig().createHousePickups)],
|
||||||
["svr_house_blips", boolToInt(serverConfigData.createHouseBlips)],
|
["svr_house_blips", boolToInt(getServerConfig().createHouseBlips)],
|
||||||
["svr_intro_music", serverConfigData.intromUsic],
|
["svr_intro_music", getServerConfig().introMusic],
|
||||||
];
|
];
|
||||||
|
|
||||||
let dbQuery = null;
|
let dbQuery = null;
|
||||||
let queryString = createDatabaseUpdateQuery("svr_main", data, `svr_id=${serverConfigData.databaseId}`);
|
let queryString = createDatabaseUpdateQuery("svr_main", data, `svr_id=${serverConfig.databaseId}`);
|
||||||
dbQuery = queryDatabase(dbConnection, queryString);
|
dbQuery = queryDatabase(dbConnection, queryString);
|
||||||
|
|
||||||
getServerConfig().needsSaved = false;
|
getServerConfig().needsSaved = false;
|
||||||
@@ -203,6 +203,12 @@ function saveServerConfigToDatabase(serverConfigData) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a command handler function.
|
||||||
|
*
|
||||||
|
* @return {ServerConfigData} - Server configuration data
|
||||||
|
*
|
||||||
|
*/
|
||||||
function getServerConfig() {
|
function getServerConfig() {
|
||||||
return serverConfig;
|
return serverConfig;
|
||||||
}
|
}
|
||||||
@@ -256,7 +262,7 @@ function setTimeCommand(command, params, client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
getServerConfig().hour = minute;
|
getServerConfig().hour = hour;
|
||||||
getServerConfig().minute = minute;
|
getServerConfig().minute = minute;
|
||||||
|
|
||||||
gta.time.hour = getServerConfig().hour;
|
gta.time.hour = getServerConfig().hour;
|
||||||
|
|||||||
@@ -308,3 +308,7 @@ const VRR_BIZ_TYPE_NONE = 0; // None (invalid)
|
|||||||
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
const VRR_BIZ_TYPE_NORMAL = 1; // Normal business (sells items)
|
||||||
const VRR_BIZ_TYPE_BANK = 2; // Bank
|
const VRR_BIZ_TYPE_BANK = 2; // Bank
|
||||||
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
const VRR_BIZ_TYPE_PUBLIC = 3; // Public business (Government, public service, etc)
|
||||||
|
|
||||||
|
const VRR_RETURNTO_TYPE_NONE = 0; // "Return to" data is invalid
|
||||||
|
const VRR_RETURNTO_TYPE_ADMINGET = 1; // "Return to" data is from admin teleporting
|
||||||
|
const VRR_RETURNTO_TYPE_SKINSELECT = 2; // "Return to" data is from skin select
|
||||||
@@ -243,16 +243,16 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
vehicle.engine = getVehicleData(vehicle).engine;
|
vehicle.engine = getVehicleData(vehicle).engine;
|
||||||
|
|
||||||
if(getVehicleData(vehicle).buyPrice > 0) {
|
if(getVehicleData(vehicle).buyPrice > 0) {
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).buyPrice}`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for sale! Cost: ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).buyPrice)}`);
|
||||||
messagePlayerTip(client, `Use /vehbuy if you want to buy it.`);
|
messagePlayerTip(client, `Use /vehbuy if you want to buy it.`);
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
} else if(getVehicleData(vehicle).rentPrice > 0) {
|
||||||
if(getVehicleData(vehicle).rentedBy != client) {
|
if(getVehicleData(vehicle).rentedBy != client) {
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).rentPrice} per minute`);
|
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} is for rent! Cost: ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute`);
|
||||||
messagePlayerTip(client, `Use /vehrent if you want to rent it.`);
|
messagePlayerTip(client, `Use /vehrent if you want to rent it.`);
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for ${getInlineChatColourByName("lightGrey")}$${getVehicleData(vehicle).rentPrice} per minute. ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/stoprent ${getInlineChatColourByName("white")}if you want to stop renting it.`);
|
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. ${getInlineChatColourByName("white")}Use ${getInlineChatColourByName("lightGrey")}/stoprent ${getInlineChatColourByName("white")}if you want to stop renting it.`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let ownerName = "Nobody";
|
let ownerName = "Nobody";
|
||||||
@@ -365,7 +365,7 @@ function onPlayerDeath(client, position) {
|
|||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
if(getPlayerCurrentSubAccount(client).inJail) {
|
if(getPlayerCurrentSubAccount(client).inJail) {
|
||||||
let closestJail = getClosestJail(getPlayerPosition(client));
|
let closestJail = getClosestJail(getPlayerPosition(client));
|
||||||
client.despawnPlayer();
|
//client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||||
if(getServerGame() == GAME_GTA_IV) {
|
if(getServerGame() == GAME_GTA_IV) {
|
||||||
@@ -380,7 +380,7 @@ function onPlayerDeath(client, position) {
|
|||||||
updatePlayerSpawnedState(client, true);
|
updatePlayerSpawnedState(client, true);
|
||||||
} else {
|
} else {
|
||||||
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
let closestHospital = getClosestHospital(getPlayerPosition(client));
|
||||||
client.despawnPlayer();
|
//client.despawnPlayer();
|
||||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||||
if(getServerGame() == GAME_GTA_IV) {
|
if(getServerGame() == GAME_GTA_IV) {
|
||||||
@@ -421,21 +421,21 @@ function onPlayerSpawn(client) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s player data`);
|
||||||
if(!getPlayerData(client)) {
|
if(!getPlayerData(client)) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is invalid. Kicking them from server.`);
|
||||||
client.despawnPlayer();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s login status`);
|
||||||
if(!getPlayerData(client).loggedIn) {
|
if(!getPlayerData(client).loggedIn) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} is NOT logged in. Despawning their player.`);
|
||||||
client.despawnPlayer();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking ${getPlayerDisplayForConsole(client)}'s selected character status`);
|
||||||
if(getPlayerData(client).currentSubAccount == -1) {
|
if(getPlayerData(client).currentSubAccount == -1) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} has NOT selected a character. Despawning their player.`);
|
||||||
client.despawnPlayer();
|
client.disconnect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,22 +534,25 @@ function onPlayerSpawn(client) {
|
|||||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isGTAIV()) {
|
//if(isGTAIV()) {
|
||||||
setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
// setEntityData(client.player, "vrr.bodyPartHair", getPlayerCurrentSubAccount(client).bodyParts.hair, true);
|
||||||
setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyParts.head, true);
|
||||||
setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
// setEntityData(client.player, "vrr.bodyPartUpper", getPlayerCurrentSubAccount(client).bodyParts.upper, true);
|
||||||
setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
// setEntityData(client.player, "vrr.bodyPartLower", getPlayerCurrentSubAccount(client).bodyParts.lower, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
||||||
|
// setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
||||||
|
//}
|
||||||
|
|
||||||
setEntityData(client.player, "vrr.bodyPropHair", getPlayerCurrentSubAccount(client).bodyProps.hair, true);
|
if(isGTAIV()) {
|
||||||
setEntityData(client.player, "vrr.bodyPropEyes", getPlayerCurrentSubAccount(client).bodyProps.eyes, true);
|
sendPlayerPedPartsAndProps(client);
|
||||||
setEntityData(client.player, "vrr.bodyPartHead", getPlayerCurrentSubAccount(client).bodyProps.head, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartLeftHand", getPlayerCurrentSubAccount(client).bodyProps.leftHand, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartRightHand", getPlayerCurrentSubAccount(client).bodyProps.rightHand, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartLeftWrist", getPlayerCurrentSubAccount(client).bodyProps.leftWrist, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartRightWrist", getPlayerCurrentSubAccount(client).bodyProps.rightWrist, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartHip", getPlayerCurrentSubAccount(client).bodyProps.hip, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartLeftFoot", getPlayerCurrentSubAccount(client).bodyProps.leftFoot, true);
|
|
||||||
setEntityData(client.player, "vrr.bodyPartRightFoot", getPlayerCurrentSubAccount(client).bodyProps.rightFoot, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function loadHousesFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempHouseData = new serverClasses.houseData(dbAssoc);
|
let tempHouseData = new HouseData(dbAssoc);
|
||||||
tempHouses.push(tempHouseData);
|
tempHouses.push(tempHouseData);
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
logToConsole(LOG_VERBOSE, `[VRR.House]: House '${tempHouseData.description}' (ID ${tempHouseData.databaseId}) loaded!`);
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ function loadHousesFromDatabase() {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createHouseCommand(command, params, client) {
|
function createHouseCommand(command, params, client) {
|
||||||
let entranceLocation = new serverClasses.houseLocationData(false);
|
let entranceLocation = new HouseLocationData(false);
|
||||||
entranceLocation.entrancePosition = getPlayerPosition(client);
|
entranceLocation.entrancePosition = getPlayerPosition(client);
|
||||||
entranceLocation.entranceRotation = 0.0;
|
entranceLocation.entranceRotation = 0.0;
|
||||||
entranceLocation.entrancePickupModel = getGameConfig().pickupModels[getServerGame()].house;
|
entranceLocation.entrancePickupModel = getGameConfig().pickupModels[getServerGame()].house;
|
||||||
@@ -82,10 +82,10 @@ function createHouseCommand(command, params, client) {
|
|||||||
|
|
||||||
saveHouseToDatabase(houseId-1);
|
saveHouseToDatabase(houseId-1);
|
||||||
|
|
||||||
createHouseEntrancePickup(houseId);
|
createHouseEntrancePickup(houseId-1);
|
||||||
createHouseExitPickup(houseId);
|
createHouseExitPickup(houseId-1);
|
||||||
createHouseEntranceBlip(houseId);
|
createHouseEntranceBlip(houseId-1);
|
||||||
createHouseExitBlip(houseId);
|
createHouseExitBlip(houseId-1);
|
||||||
|
|
||||||
//getHouseData(houseId).needsSaved = true;
|
//getHouseData(houseId).needsSaved = true;
|
||||||
|
|
||||||
@@ -382,7 +382,7 @@ function setHouseInteriorTypeCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(isNaN(typeParam)) {
|
if(isNaN(typeParam)) {
|
||||||
let tempHouseLocation = new serverClasses.houseLocationData(false);
|
let tempHouseLocation = new HouseLocationData(false);
|
||||||
|
|
||||||
if(toLowerCase(typeParam) == "none") {
|
if(toLowerCase(typeParam) == "none") {
|
||||||
tempHouseLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
|
tempHouseLocation.exitPosition = toVector3(0.0, 0.0, 0.0);
|
||||||
@@ -591,7 +591,7 @@ function deleteHouse(houseId, whoDeleted = 0) {
|
|||||||
|
|
||||||
removePlayersFromHouse(houseId);
|
removePlayersFromHouse(houseId);
|
||||||
|
|
||||||
getServerData().houses.splice(houseId, 1);
|
getServerData().houses[houseId] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -620,7 +620,7 @@ function removePlayerFromHouses(client) {
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function createHouse(description, entranceLocation) {
|
function createHouse(description, entranceLocation) {
|
||||||
let tempHouseData = new serverClasses.houseData(false);
|
let tempHouseData = new HouseData(false);
|
||||||
tempHouseData.description = description;
|
tempHouseData.description = description;
|
||||||
|
|
||||||
tempHouseData.entrancePosition = entranceLocation.entrancePosition;
|
tempHouseData.entrancePosition = entranceLocation.entrancePosition;
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ function loadItemsFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempItemData = new serverClasses.itemData(dbFetchAssoc);
|
let tempItemData = new ItemData(dbFetchAssoc);
|
||||||
tempItems.push(tempItemData);
|
tempItems.push(tempItemData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -53,7 +53,7 @@ function loadItemTypesFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(getQueryNumRows(dbQuery) > 0) {
|
if(getQueryNumRows(dbQuery) > 0) {
|
||||||
while(dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbFetchAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempItemTypeData = new serverClasses.itemTypeData(dbFetchAssoc);
|
let tempItemTypeData = new ItemTypeData(dbFetchAssoc);
|
||||||
tempItemTypes.push(tempItemTypeData);
|
tempItemTypes.push(tempItemTypeData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -68,7 +68,7 @@ function loadItemTypesFromDatabase() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createItem(itemTypeId, value, ownerType, ownerId, amount=1) {
|
function createItem(itemTypeId, value, ownerType, ownerId, amount=1) {
|
||||||
let tempItemData = new serverClasses.itemData(false);
|
let tempItemData = new ItemData(false);
|
||||||
tempItemData.itemType = getItemTypeData(itemTypeId).databaseId;
|
tempItemData.itemType = getItemTypeData(itemTypeId).databaseId;
|
||||||
tempItemData.ownerType = ownerType;
|
tempItemData.ownerType = ownerType;
|
||||||
tempItemData.ownerId = ownerId;
|
tempItemData.ownerId = ownerId;
|
||||||
@@ -991,18 +991,20 @@ function getPlayerFirstEmptyHotBarSlot(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function cachePlayerHotBarItems(client) {
|
function cachePlayerHotBarItems(client) {
|
||||||
if(!isPlayerWorking(client)) {
|
if(isPlayerWorking(client)) {
|
||||||
for(let i = 0 ; i <= 9 ; i++) {
|
return false;
|
||||||
getPlayerData(client).hotBarItems[i] = -1;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for(let i in getServerData().items) {
|
for(let i = 0 ; i <= 9 ; i++) {
|
||||||
if(getItemData(i).ownerType == VRR_ITEM_OWNER_PLAYER) {
|
getPlayerData(client).hotBarItems[i] = -1;
|
||||||
if(getItemData(i).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
}
|
||||||
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
|
||||||
if(firstSlot != -1) {
|
for(let i in getServerData().items) {
|
||||||
getPlayerData(client).hotBarItems[firstSlot] = i;
|
if(getItemData(i).ownerType == VRR_ITEM_OWNER_PLAYER) {
|
||||||
}
|
if(getItemData(i).ownerId == getPlayerCurrentSubAccount(client).databaseId) {
|
||||||
|
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
||||||
|
if(firstSlot != -1) {
|
||||||
|
getPlayerData(client).hotBarItems[firstSlot] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1067,7 +1069,8 @@ function deleteItem(itemId) {
|
|||||||
if(getItemData(itemId).databaseId > 0) {
|
if(getItemData(itemId).databaseId > 0) {
|
||||||
quickDatabaseQuery(`DELETE FROM item_main WHERE item_id = ${getItemData(itemId).databaseId}`);
|
quickDatabaseQuery(`DELETE FROM item_main WHERE item_id = ${getItemData(itemId).databaseId}`);
|
||||||
}
|
}
|
||||||
getServerData().items.splice(itemId, 1);
|
getServerData().items[itemId] = false;
|
||||||
|
setItemDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1285,14 +1288,12 @@ function saveItemToDatabase(itemId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function storePlayerItemsInJobLocker(client) {
|
function storePlayerItemsInJobLocker(client) {
|
||||||
for(let i in getPlayerData(client).hotBarItems) {
|
for(let i = 0 ; i <= 8 ; i++) {
|
||||||
//if(getPlayerData(client).hotBarItems[i] != -1) {
|
getPlayerData(client).jobLockerCache[i] = getPlayerData(client).hotBarItems[i];
|
||||||
getPlayerData(client).jobLockerCache[i] = getPlayerData(client).hotBarItems[i];
|
getPlayerData(client).hotBarItems[i] = -1;
|
||||||
getPlayerData(client).hotBarItems[i] = -1;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cachePlayerHotBarItems(client);
|
//cachePlayerHotBarItems(client);
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1305,15 +1306,12 @@ function restorePlayerJobLockerItems(client) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in getPlayerData(client).jobLockerCache) {
|
for(let i = 0 ; i <= 8 ; i++) {
|
||||||
//if(getPlayerData(client).jobLockerCache[i] != -1) {
|
getPlayerData(client).hotBarItems[i] = getPlayerData(client).jobLockerCache[i];
|
||||||
getPlayerData(client).hotBarItems[i] = getPlayerData(client).jobLockerCache[i];
|
getPlayerData(client).jobLockerCache[i] = -1;
|
||||||
getPlayerData(client).jobLockerCache[i] = -1;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cachePlayerHotBarItems(client);
|
cachePlayerHotBarItems(client);
|
||||||
|
|
||||||
updatePlayerHotBar(client);
|
updatePlayerHotBar(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1431,7 +1429,44 @@ function toggleItemEnabledCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getItemData(getPlayerActiveItem(client)).enabled = !getItemData(getPlayerActiveItem(client)).enabled;
|
getItemData(getPlayerActiveItem(client)).enabled = !getItemData(getPlayerActiveItem(client)).enabled;
|
||||||
messagePlayerNormal(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} ${getInlineChatColourByName("white")}your ${getItemName(getPlayerActiveItem(client))} in slot ${getPlayerActiveItemSlot(client)} ${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(getPlayerActiveItem(client))}`)
|
messagePlayerNormal(client, `You turned ${getBoolRedGreenInlineColour(getItemData(itemIndex).enabled)}${toUpperCase(getOnOffFromBool(getItemData(itemIndex).enabled))} ${getInlineChatColourByName("white")}your ${getItemName(getPlayerActiveItem(client))} in slot ${getPlayerActiveItemSlot(client)} ${getInlineChatColourByName("lightGrey")}${getItemValueDisplayForItem(getPlayerActiveItem(client))}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function deleteItemInPlayerInventoryCommand(command, params, client) {
|
||||||
|
if(areParamsEmpty(params)) {
|
||||||
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let splitParams = params.split(" ");
|
||||||
|
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||||
|
let hotBarSlot = splitParams[1];
|
||||||
|
|
||||||
|
if(isNaN(hotBarSlot)) {
|
||||||
|
messagePlayerError(client, `The item slot must be a number!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(toInteger(hotBarSlot) <= 0 || toInteger(hotBarSlot) > 9) {
|
||||||
|
messagePlayerError(client, `The item slot must be between 1 and 9!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getPlayerData(client).hotBarItems[hotBarSlot-1] == -1) {
|
||||||
|
messagePlayerError(client, `${getCharacterFullName(client)} doesn't have anything in that slot!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(getItemData(getPlayerData(client).hotBarItems[hotBarSlot-1])) {
|
||||||
|
messagePlayerError(client, `${getCharacterFullName(client)} doesn't have anything in that slot!`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let tempName = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[hotBarSlot-1]).itemTypeIndex).name
|
||||||
|
deleteItem(getPlayerData(client).hotBarItems[hotBarSlot-1]);
|
||||||
|
messagePlayerSuccess(client, `You deleted the ${getInlineChatColourByName("lightGrey")}${tempName} ${getInlineChatColourByName("white")}item in ${getInlineChatColourByName("lightGrey")}${getCharacterFullName(client)}'s ${getInlineChatColourByName("white")}inventory`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ function loadJobsFromDatabase() {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempJobData = new serverClasses.jobData(dbAssoc);
|
let tempJobData = new JobData(dbAssoc);
|
||||||
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
|
tempJobData.locations = loadJobLocationsFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
|
tempJobData.equipment = loadJobEquipmentsFromDatabase(tempJobData.databaseId);
|
||||||
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
|
tempJobData.uniforms = loadJobUniformsFromDatabase(tempJobData.databaseId);
|
||||||
@@ -95,7 +95,7 @@ function loadJobEquipmentsFromDatabase(jobDatabaseId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempJobEquipmentData = new serverClasses.jobEquipmentData(dbAssoc);
|
let tempJobEquipmentData = new JobEquipmentData(dbAssoc);
|
||||||
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
tempJobEquipmentData.items = loadJobEquipmentItemsFromDatabase(tempJobEquipmentData.databaseId);
|
||||||
tempJobEquipments.push(tempJobEquipmentData);
|
tempJobEquipments.push(tempJobEquipmentData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment '${tempJobEquipmentData.name}' loaded from database successfully!`);
|
||||||
@@ -125,7 +125,7 @@ function loadJobLocationsFromDatabase(jobDatabaseId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempJobLocationData = new serverClasses.jobLocationData(dbAssoc);
|
let tempJobLocationData = new JobLocationData(dbAssoc);
|
||||||
tempJobLocations.push(tempJobLocationData);
|
tempJobLocations.push(tempJobLocationData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job]: Job location '${tempJobLocationData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -154,7 +154,7 @@ function loadJobUniformsFromDatabase(jobDatabaseId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempJobUniformData = new serverClasses.jobUniformData(dbAssoc);
|
let tempJobUniformData = new JobUniformData(dbAssoc);
|
||||||
tempJobUniforms.push(tempJobUniformData);
|
tempJobUniforms.push(tempJobUniformData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job]: Job uniform '${tempJobUniformData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ function loadJobEquipmentItemsFromDatabase(jobEquipmentDatabaseId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
if(dbQuery.numRows > 0) {
|
if(dbQuery.numRows > 0) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempJobEquipmentItemData = new serverClasses.jobEquipmentItemData(dbAssoc);
|
let tempJobEquipmentItemData = new JobEquipmentItemData(dbAssoc);
|
||||||
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
tempJobEquipmentItems.push(tempJobEquipmentItemData);
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
logToConsole(LOG_DEBUG, `[VRR.Job]: Job equipment item '${tempJobEquipmentItemData.databaseId}' loaded from database successfully!`);
|
||||||
}
|
}
|
||||||
@@ -1363,7 +1363,7 @@ function setAllJobDataIndexes() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createJobLocation(jobId, position, interior, dimension) {
|
function createJobLocation(jobId, position, interior, dimension) {
|
||||||
let jobLocationData = new serverClasses.jobLocationData(false);
|
let jobLocationData = new JobLocationData(false);
|
||||||
jobLocationData.position = position;
|
jobLocationData.position = position;
|
||||||
jobLocationData.job = getJobData(jobId).databaseId;
|
jobLocationData.job = getJobData(jobId).databaseId;
|
||||||
jobLocationData.interior = interior;
|
jobLocationData.interior = interior;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ function removeKeyBindCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function addPlayerKeyBind(client, keyId, tempCommand, tempParams) {
|
function addPlayerKeyBind(client, keyId, tempCommand, tempParams) {
|
||||||
let keyBindData = new serverClasses.keyBindData(false, keyId, `${tempCommand} ${tempParams}`);
|
let keyBindData = new KeyBindData(false, keyId, `${tempCommand} ${tempParams}`);
|
||||||
getPlayerData(client).accountData.keyBinds.push(keyBindData);
|
getPlayerData(client).accountData.keyBinds.push(keyBindData);
|
||||||
sendAddAccountKeyBindToClient(client, keyId, KEYSTATE_UP);
|
sendAddAccountKeyBindToClient(client, keyId, KEYSTATE_UP);
|
||||||
|
|
||||||
|
|||||||
@@ -543,10 +543,10 @@ function getPlayerCommand(command, params, client) {
|
|||||||
|
|
||||||
removePlayerFromVehicle(targetClient);
|
removePlayerFromVehicle(targetClient);
|
||||||
|
|
||||||
getPlayerData(targetClient).returnToPosition = getPlayerPosition(targetClient);
|
//getPlayerData(targetClient).returnToPosition = getPlayerPosition(targetClient);
|
||||||
getPlayerData(targetClient).returnToHeading = getPlayerPosition(targetClient);
|
//getPlayerData(targetClient).returnToHeading = getPlayerPosition(targetClient);
|
||||||
getPlayerData(targetClient).returnToDimension = getPlayerDimension(targetClient);
|
//getPlayerData(targetClient).returnToDimension = getPlayerDimension(targetClient);
|
||||||
getPlayerData(targetClient).returnToInterior = getPlayerInterior(targetClient);
|
//getPlayerData(targetClient).returnToInterior = getPlayerInterior(targetClient);
|
||||||
|
|
||||||
if(isPlayerInAnyHouse(targetClient)) {
|
if(isPlayerInAnyHouse(targetClient)) {
|
||||||
getPlayerData(targetClient).returnToHouse = getEntityData(client, "vrr.inHouse");
|
getPlayerData(targetClient).returnToHouse = getEntityData(client, "vrr.inHouse");
|
||||||
|
|||||||
@@ -3047,6 +3047,51 @@ let gameData = {
|
|||||||
["sitback", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_BACK],
|
["sitback", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_BACK],
|
||||||
],
|
],
|
||||||
[ // GTA SA
|
[ // GTA SA
|
||||||
|
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["look1", 0, 4, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["holdrifle", 0, 11, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["talk1", 0, 12, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["wave1", 0, 13, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["swim1", 0, 14, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["die1", 0, 15, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["die2", 0, 16, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["diehead", 0, 19, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["diestomach", 0, 20, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["choke", 0, 21, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["remotepress", 0, 48, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["pickup1", 0, 99, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["pickup2", 0, 100, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["backhandright", 0, 103, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["backhandleft", 0, 104, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["knockback", 0, 105, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["idle1", 0, 135, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["knockback", 0, 105, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["cower", 0, 141, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["handsup", 0, 142, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["fucku", 0, 144, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["phoneout", 0, 145, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["phonein", 0, 146, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["phonetalk", 0, 146, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["sit1", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["atm", 0, 151, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["mindtrick", 0, 153, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["faceshocked", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["facesurprised", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["faceconfused", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["faceangry", 0, 159, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["facetalk1", 0, 160, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["look2", 0, 165, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["gestureno", 0, 166, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["gestureyes", 0, 167, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["wave2", 0, 168, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["snort", 0, 169, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_NONE],
|
||||||
|
["sitright", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_RIGHT],
|
||||||
|
["sitleft", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_LEFT],
|
||||||
|
["sitforward", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_FORWARD],
|
||||||
|
["sitback", 0, 150, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null, VRR_ANIMMOVE_BACK],
|
||||||
|
|
||||||
|
/*
|
||||||
["talk", "PED", "IDLE_CHAT", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["talk", "PED", "IDLE_CHAT", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["fucku", "PED", "FUCKU", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["fucku", "PED", "FUCKU", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["taichi", "PARK", "Tai_Chi_Loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["taichi", "PARK", "Tai_Chi_Loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
@@ -3063,10 +3108,9 @@ let gameData = {
|
|||||||
["sit2", "BEACH", "ParkSit_M_loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["sit2", "BEACH", "ParkSit_M_loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["sit3", "BEACH", "ParkSit_W_loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["sit3", "BEACH", "ParkSit_W_loop", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["sit4", "BEACH", "SitnWait_loop_W", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["sit4", "BEACH", "SitnWait_loop_W", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["sitleft", "FOOD", "FF_Sit_In_L", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
|
||||||
["sitright", "FOOD", "FF_Sit_In_R", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
|
||||||
["scratch", "MISC","Scratchballs_01", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["scratch", "MISC","Scratchballs_01", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
["standup", "ped", "SEAT_up", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
["standup", "ped", "SEAT_up", VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||||
|
*/
|
||||||
],
|
],
|
||||||
null,
|
null,
|
||||||
[ // GTA IV
|
[ // GTA IV
|
||||||
@@ -4841,6 +4885,13 @@ function getElementHeading(element) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setElementInterior(element, interior) {
|
||||||
|
setEntityData(element, "vrr.interior", interior, true);
|
||||||
|
forcePlayerToSyncElementProperties(null, element);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementCollisionsEnabled(element, state) {
|
function setElementCollisionsEnabled(element, state) {
|
||||||
triggerNetworkEvent("vrr.elementCollisions", getClientFromSyncerId(element.syncer), element.id, state);
|
triggerNetworkEvent("vrr.elementCollisions", getClientFromSyncerId(element.syncer), element.id, state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -889,7 +889,7 @@ let gameData = {
|
|||||||
false,
|
false,
|
||||||
|
|
||||||
[ // Mafia 1
|
[ // Mafia 1
|
||||||
//new serverClasses.removedWorldObjectData("fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot
|
//new RemovedWorldObjectData("fraightback04", toVector3(1229.88, -84.8012, 13.4004), 50.0), // Truck trailer in Easy Credit Autos dealership parking lot
|
||||||
],
|
],
|
||||||
|
|
||||||
[ // Mafia 2
|
[ // Mafia 2
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function loadRadioStationsFromDatabase() {
|
|||||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempRadioStationData = new serverClasses.radioStationData(dbAssoc);
|
let tempRadioStationData = new RadioStationData(dbAssoc);
|
||||||
tempRadioStations.push(tempRadioStationData);
|
tempRadioStations.push(tempRadioStationData);
|
||||||
}
|
}
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ function loadSubAccountFromName(firstName, lastName) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
return new serverClasses.subAccountData(dbAssoc);
|
return new SubAccountData(dbAssoc);
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
@@ -42,7 +42,7 @@ function loadSubAccountFromId(subAccountId) {
|
|||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
return new serverClasses.subAccountData(dbAssoc);
|
return new SubAccountData(dbAssoc);
|
||||||
}
|
}
|
||||||
disconnectFromDatabase(dbConnection);
|
disconnectFromDatabase(dbConnection);
|
||||||
}
|
}
|
||||||
@@ -62,7 +62,7 @@ function loadSubAccountsFromAccount(accountId) {
|
|||||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempSubAccount = new serverClasses.subAccountData(dbAssoc);
|
let tempSubAccount = new SubAccountData(dbAssoc);
|
||||||
|
|
||||||
// Make sure skin is valid
|
// Make sure skin is valid
|
||||||
if(tempSubAccount.skin == -1) {
|
if(tempSubAccount.skin == -1) {
|
||||||
@@ -425,7 +425,7 @@ function switchCharacterCommand(command, params, client) {
|
|||||||
|
|
||||||
resetClientStuff(client);
|
resetClientStuff(client);
|
||||||
|
|
||||||
client.despawnPlayer();
|
//client.despawnPlayer();
|
||||||
getPlayerData(client).switchingCharacter = true;
|
getPlayerData(client).switchingCharacter = true;
|
||||||
//spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
|
//spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
|
||||||
//showCharacterSelectCameraToPlayer(client);
|
//showCharacterSelectCameraToPlayer(client);
|
||||||
|
|||||||
@@ -25,13 +25,55 @@ function saveAllServerDataToDatabase() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saving all server data to database ...");
|
logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saving all server data to database ...");
|
||||||
saveAllClientsToDatabase();
|
|
||||||
saveAllClansToDatabase();
|
try {
|
||||||
saveAllHousesToDatabase();
|
saveAllClientsToDatabase();
|
||||||
saveAllBusinessesToDatabase();
|
} catch(error) {
|
||||||
saveServerConfigToDatabase(getServerConfig());
|
logToConsole(LOG_ERROR, `Could not save clients to database: ${error}`);
|
||||||
saveAllVehiclesToDatabase();
|
}
|
||||||
saveAllItemsToDatabase();
|
|
||||||
|
try {
|
||||||
|
saveAllClansToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save clans to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveAllHousesToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save houses to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveAllBusinessesToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save businesses to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveServerConfigToDatabase(getServerConfig());
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save server config to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveAllVehiclesToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save vehicles to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveAllItemsToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save items to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
saveServerConfigToDatabase();
|
||||||
|
} catch(error) {
|
||||||
|
logToConsole(LOG_ERROR, `Could not save server config to database: ${error}`);
|
||||||
|
}
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saved all server data to database!");
|
logToConsole(LOG_DEBUG, "[VRR.Utilities]: Saved all server data to database!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ function makeReadableTime(hour, minute) {
|
|||||||
meridianStr = "AM";
|
meridianStr = "AM";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hour > 12) {
|
if(hour > 11) {
|
||||||
let actualHour = hour-12;
|
let actualHour = hour-12;
|
||||||
if(actualHour < 10) {
|
if(actualHour < 10) {
|
||||||
hourStr = "0" + toString(hour-12);
|
hourStr = "0" + toString(hour-12);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function loadVehiclesFromDatabase() {
|
|||||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||||
if(dbQuery) {
|
if(dbQuery) {
|
||||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||||
let tempVehicleData = new serverClasses.vehicleData(dbAssoc);
|
let tempVehicleData = new VehicleData(dbAssoc);
|
||||||
tempVehicles.push(tempVehicleData);
|
tempVehicles.push(tempVehicleData);
|
||||||
}
|
}
|
||||||
freeDatabaseQuery(dbQuery);
|
freeDatabaseQuery(dbQuery);
|
||||||
@@ -213,7 +213,7 @@ function createVehicleCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
|
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
|
||||||
let vehicle = createPermanentVehicle(modelId, frontPos, getPlayerHeading(client));
|
let vehicle = createPermanentVehicle(modelId, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client));
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}!`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}!`);
|
||||||
}
|
}
|
||||||
@@ -234,7 +234,7 @@ function createTemporaryVehicleCommand(command, params, client) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
|
let frontPos = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getGlobalConfig().spawnCarDistance);
|
||||||
let vehicle = createTemporaryVehicle(modelId, frontPos, getPlayerHeading(client));
|
let vehicle = createTemporaryVehicle(modelId, frontPos, getPlayerHeading(client), getPlayerInterior(client), getPlayerDimension(client));
|
||||||
|
|
||||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a temporary ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}`);
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}created a temporary ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}`);
|
||||||
}
|
}
|
||||||
@@ -877,6 +877,24 @@ function setVehicleOwnerCommand(command, params, client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setVehiclePublicCommand(command, params, client) {
|
||||||
|
if(!isPlayerInAnyVehicle(client)) {
|
||||||
|
messagePlayerError(client, "You need to be in a vehicle!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let vehicle = getPlayerVehicle(client);
|
||||||
|
|
||||||
|
getVehicleData(vehicle).ownerType = VRR_VEHOWNER_PUBLIC;
|
||||||
|
getVehicleData(vehicle).ownerId = 0;
|
||||||
|
|
||||||
|
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)} ${getInlineChatColourByName("white")}a public vehicle!`);
|
||||||
|
|
||||||
|
getVehicleData(vehicle).needsSaved = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
function setVehicleRentPriceCommand(command, params, client) {
|
function setVehicleRentPriceCommand(command, params, client) {
|
||||||
if(!isPlayerInAnyVehicle(client)) {
|
if(!isPlayerInAnyVehicle(client)) {
|
||||||
messagePlayerError(client, "You need to be in a vehicle!");
|
messagePlayerError(client, "You need to be in a vehicle!");
|
||||||
@@ -1089,7 +1107,7 @@ function reloadAllVehiclesCommand(command, params, client) {
|
|||||||
|
|
||||||
function respawnAllVehiclesCommand(command, params, client) {
|
function respawnAllVehiclesCommand(command, params, client) {
|
||||||
for(let i in getServerData().vehicles) {
|
for(let i in getServerData().vehicles) {
|
||||||
respawnVehicle(vehicle);
|
respawnVehicle(getServerData().vehicles[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//spawnAllVehicles();
|
//spawnAllVehicles();
|
||||||
@@ -1127,7 +1145,7 @@ function respawnVehicle(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function spawnVehicle(vehicleData) {
|
function spawnVehicle(vehicleData) {
|
||||||
let vehicle = gta.createVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
let vehicle = createGameVehicle(vehicleData.model, vehicleData.spawnPosition, vehicleData.spawnRotation);
|
||||||
addToWorld(vehicle);
|
addToWorld(vehicle);
|
||||||
|
|
||||||
if(doesGameHaveServerElements()) {
|
if(doesGameHaveServerElements()) {
|
||||||
@@ -1140,20 +1158,26 @@ function spawnVehicle(vehicleData) {
|
|||||||
vehicle.colour4 = vehicleData.colour4;
|
vehicle.colour4 = vehicleData.colour4;
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicle.engine = intToBool(vehicleData.engine);
|
if(vehicleData.spawnLocked) {
|
||||||
|
vehicle.engine = false;
|
||||||
|
} else {
|
||||||
|
vehicle.engine = intToBool(vehicleData.engine);
|
||||||
|
}
|
||||||
|
|
||||||
|
vehicle.locked = intToBool(vehicleData.locked);
|
||||||
|
|
||||||
//vehicle.lights = intToBool(vehicleData.lights);
|
//vehicle.lights = intToBool(vehicleData.lights);
|
||||||
//vehicle.health = vehicleData.health;
|
//vehicle.health = vehicleData.health;
|
||||||
|
|
||||||
//vehicle.position = vehicleData.spawnPosition;
|
//vehicle.position = vehicleData.spawnPosition;
|
||||||
vehicle.heading = vehicleData.spawnRotation;
|
vehicle.heading = vehicleData.spawnRotation;
|
||||||
|
|
||||||
vehicle.locked = intToBool(vehicleData.locked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vehicleData.vehicle = vehicle;
|
vehicleData.vehicle = vehicle;
|
||||||
|
|
||||||
setEntityData(vehicle, "vrr.livery", vehicleData.livery);
|
setEntityData(vehicle, "vrr.livery", vehicleData.livery);
|
||||||
setEntityData(vehicle, "vrr.upgrades", vehicleData.extras);
|
setEntityData(vehicle, "vrr.upgrades", vehicleData.extras);
|
||||||
|
setEntityData(vehicle, "vrr.interior", vehicleData.interior);
|
||||||
|
|
||||||
return vehicle;
|
return vehicle;
|
||||||
}
|
}
|
||||||
@@ -1212,15 +1236,17 @@ async function getPlayerNewVehicle(client) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price, dealershipId) {
|
function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price, dealershipId, interior = 0, dimension = 0) {
|
||||||
let vehicle = createGameVehicle(model, spawnPosition, spawnRotation);
|
let vehicle = createGameVehicle(model, spawnPosition, spawnRotation);
|
||||||
if(!vehicle) {
|
if(!vehicle) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
setVehicleHeading(vehicle, spawnRotation);
|
setVehicleHeading(vehicle, spawnRotation);
|
||||||
|
setElementInterior(vehicle, interior);
|
||||||
|
setElementDimension(vehicle, dimension);
|
||||||
addToWorld(vehicle);
|
addToWorld(vehicle);
|
||||||
|
|
||||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
let tempVehicleData = new VehicleData(false, vehicle);
|
||||||
tempVehicleData.buyPrice = price;
|
tempVehicleData.buyPrice = price;
|
||||||
tempVehicleData.spawnLocked = true;
|
tempVehicleData.spawnLocked = true;
|
||||||
tempVehicleData.spawnPosition = spawnPosition;
|
tempVehicleData.spawnPosition = spawnPosition;
|
||||||
@@ -1235,12 +1261,14 @@ function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price,
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createTemporaryVehicle(modelId, position, heading) {
|
function createTemporaryVehicle(modelId, position, heading, interior = 0, dimension = 0) {
|
||||||
let vehicle = createGameVehicle(modelId, position, heading);
|
let vehicle = createGameVehicle(modelId, position, heading);
|
||||||
setVehicleHeading(vehicle, heading);
|
setVehicleHeading(vehicle, heading);
|
||||||
|
setElementInterior(vehicle, interior);
|
||||||
|
setElementDimension(vehicle, dimension);
|
||||||
addToWorld(vehicle);
|
addToWorld(vehicle);
|
||||||
|
|
||||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
let tempVehicleData = new VehicleData(false, vehicle);
|
||||||
tempVehicleData.databaseId = -1;
|
tempVehicleData.databaseId = -1;
|
||||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||||
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
||||||
@@ -1250,12 +1278,14 @@ function createTemporaryVehicle(modelId, position, heading) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createPermanentVehicle(modelId, position, heading) {
|
function createPermanentVehicle(modelId, position, heading, interior = 0, dimension = 0) {
|
||||||
let vehicle = createGameVehicle(modelId, position, heading);
|
let vehicle = createGameVehicle(modelId, position, heading);
|
||||||
setVehicleHeading(vehicle, heading);
|
setVehicleHeading(vehicle, heading);
|
||||||
|
setElementInterior(vehicle, interior);
|
||||||
|
setElementDimension(vehicle, dimension);
|
||||||
addToWorld(vehicle);
|
addToWorld(vehicle);
|
||||||
|
|
||||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
let tempVehicleData = new VehicleData(false, vehicle);
|
||||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||||
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user