Merge branch 'gtaiv' into 1.4.0-prep
This commit is contained in:
84
scripts/client/business.js
Normal file
84
scripts/client/business.js
Normal file
@@ -0,0 +1,84 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: business.js
|
||||
// DESC: Provides business functions and usage
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
class BusinessData {
|
||||
constructor(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
this.index = -1;
|
||||
this.businessId = businessId;
|
||||
this.name = name;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.hasItems = hasItems;
|
||||
this.blipId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveBusinessFromServer(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getBusinessData(businessId) != false) {
|
||||
if(blipModel == -1) {
|
||||
natives.removeBlipAndClearIndex(getBusinessData(businessId).blipId);
|
||||
getBusinessData(businessId).blipId = -1;
|
||||
//businesses.splice(getBusinessData(businessId).index, 1);
|
||||
//setAllBusinessDataIndexes();
|
||||
} else {
|
||||
if(getBusinessData(businessId).blipId != -1) {
|
||||
natives.setBlipCoordinates(getBusinessData(businessId).blipId, getBusinessData(businessId).entrancePosition);
|
||||
natives.changeBlipSprite(getBusinessData(businessId).blipId, getBusinessData(businessId).blipModel);
|
||||
natives.changeBlipNameFromAscii(getBusinessData(businessId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
} else {
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
getBusinessData(businessId).blipId = blipId;
|
||||
natives.changeBlipSprite(blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(blipId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(blipModel != -1) {
|
||||
let tempBusinessData = new BusinessData(businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
tempBusinessData.blipId = blipId;
|
||||
natives.changeBlipSprite(blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(blipId, false);
|
||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
businesses.push(tempBusinessData);
|
||||
setAllBusinessDataIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @param {number} businessId - The ID of the business (initially provided by server)
|
||||
* @return {BusinessData} The business's data (class instance)
|
||||
*/
|
||||
function getBusinessData(businessId) {
|
||||
let tempBusinessData = businesses.find((b) => b.businessId == businessId);
|
||||
return (typeof tempBusinessData != "undefined") ? tempBusinessData : false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllBusinessDataIndexes() {
|
||||
for(let i in businesses) {
|
||||
businesses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -8,7 +8,7 @@
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomImage(imageName) {
|
||||
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let image = contentResource.exports.getCustomImage(imageName);
|
||||
@@ -23,7 +23,7 @@ function getCustomImage(imageName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomFont(fontName) {
|
||||
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let font = contentResource.exports.getCustomFont(fontName);
|
||||
@@ -38,7 +38,7 @@ function getCustomFont(fontName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getCustomAudio(audioName) {
|
||||
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
let audioFile = contentResource.exports.getCustomAudio(audioName);
|
||||
@@ -53,7 +53,7 @@ function getCustomAudio(audioName) {
|
||||
// ===========================================================================
|
||||
|
||||
function playCustomAudio(audioName, volume = 0.5, loop = false) {
|
||||
let contentResource = findResourceByName(getGameData().extraContentResource[getGame()]);
|
||||
let contentResource = findResourceByName(getGameConfig().extraContentResource[getGame()]);
|
||||
if(contentResource != null) {
|
||||
if(contentResource.isStarted) {
|
||||
contentResource.exports.playCustomAudio(audioName, volume, loop);
|
||||
|
||||
@@ -104,6 +104,7 @@ function closeAllWindows() {
|
||||
listDialog.window.shown = false;
|
||||
resetPassword.window.shown = false;
|
||||
passwordChange.window.shown = false;
|
||||
|
||||
mexui.setInput(false);
|
||||
mexui.focusedControl = false;
|
||||
|
||||
@@ -299,14 +300,22 @@ function processGUIKeyPress(keyCode) {
|
||||
if(guiSubmitKey != false) {
|
||||
guiSubmitKey();
|
||||
}
|
||||
} else if(keyCode == SDLK_LEFT) {
|
||||
} else if(keyCode == getKeyIdFromParams("left") || keyCode == getKeyIdFromParams("a")) {
|
||||
if(guiLeftKey != false) {
|
||||
guiLeftKey();
|
||||
}
|
||||
} else if(keyCode == SDLK_RIGHT) {
|
||||
} else if(keyCode == getKeyIdFromParams("right") || keyCode == getKeyIdFromParams("d")) {
|
||||
if(guiRightKey != false) {
|
||||
guiRightKey();
|
||||
}
|
||||
} else if(keyCode == getKeyIdFromParams("down") || keyCode == getKeyIdFromParams("s")) {
|
||||
if(guiDownKey != false) {
|
||||
guiDownKey();
|
||||
}
|
||||
} else if(keyCode == getKeyIdFromParams("up") || keyCode == getKeyIdFromParams("w")) {
|
||||
if(guiUpKey != false) {
|
||||
guiUpKey();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,4 +15,6 @@ let clanManager = {
|
||||
vehiclesTab: null,
|
||||
businessesTab: null,
|
||||
housesTab: null,
|
||||
};
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -22,7 +22,7 @@ let login = {
|
||||
|
||||
function initLoginGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating login GUI ...`);
|
||||
login.window = mexui.window(game.width/2-150, game.height/2-130, 300, 260, 'LOGIN', {
|
||||
login.window = mexui.window(game.width/2-150, game.height/2-135, 300, 275, 'LOGIN', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
transitionTime: 500,
|
||||
@@ -42,7 +42,7 @@ function initLoginGUI() {
|
||||
login.window.titleBarIconSize = toVector2(0,0);
|
||||
login.window.titleBarHeight = 0;
|
||||
|
||||
login.logoImage = login.window.image(5, 20, 290, 80, mainLogoPath, {
|
||||
login.logoImage = login.window.image(5, 20, 290, 100, mainLogoPath, {
|
||||
focused: {
|
||||
borderColour: toColour(0, 0, 0, 0),
|
||||
},
|
||||
@@ -168,4 +168,6 @@ function switchToPasswordResetGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing password reset dialog window`);
|
||||
showResetPasswordGUI();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -21,7 +21,7 @@ let newCharacter = {
|
||||
|
||||
function initNewCharacterGUI() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating new character GUI ...`);
|
||||
newCharacter.window = mexui.window(game.width/2-130, game.height/2-100, 300, 200, 'New Character', {
|
||||
newCharacter.window = mexui.window(game.width/2-130, game.height/2-115, 300, 230, 'New Character', {
|
||||
main: {
|
||||
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||
transitionTime: 500,
|
||||
@@ -46,7 +46,7 @@ function initNewCharacterGUI() {
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.messageLabel = newCharacter.window.text(20, 75, 260, 20, 'Name your character', {
|
||||
newCharacter.messageLabel = newCharacter.window.text(20, 100, 260, 20, 'Name your character', {
|
||||
main: {
|
||||
textSize: 10.0,
|
||||
textAlign: 0.5,
|
||||
@@ -58,7 +58,7 @@ function initNewCharacterGUI() {
|
||||
},
|
||||
});
|
||||
|
||||
newCharacter.firstNameInput = newCharacter.window.textInput(20, 100, 260, 25, '', {
|
||||
newCharacter.firstNameInput = newCharacter.window.textInput(20, 125, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
@@ -77,7 +77,7 @@ function initNewCharacterGUI() {
|
||||
});
|
||||
newCharacter.firstNameInput.placeholder = "First Name";
|
||||
|
||||
newCharacter.lastNameInput = newCharacter.window.textInput(20, 130, 260, 25, '', {
|
||||
newCharacter.lastNameInput = newCharacter.window.textInput(20, 155, 260, 25, '', {
|
||||
main: {
|
||||
backgroundColour: toColour(0, 0, 0, 120),
|
||||
textColour: toColour(200, 200, 200, 255),
|
||||
@@ -96,7 +96,7 @@ function initNewCharacterGUI() {
|
||||
});
|
||||
newCharacter.lastNameInput.placeholder = "Last Name";
|
||||
|
||||
newCharacter.createCharacterButton = newCharacter.window.button(20, 160, 260, 25, 'CREATE CHARACTER', {
|
||||
newCharacter.createCharacterButton = newCharacter.window.button(20, 185, 260, 25, 'CREATE CHARACTER', {
|
||||
main: {
|
||||
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], buttonAlpha),
|
||||
textColour: toColour(255, 255, 255, 255),
|
||||
|
||||
82
scripts/client/house.js
Normal file
82
scripts/client/house.js
Normal file
@@ -0,0 +1,82 @@
|
||||
// ===========================================================================
|
||||
// Vortrex's Roleplay Resource
|
||||
// https://github.com/VortrexFTW/gtac_roleplay
|
||||
// ===========================================================================
|
||||
// FILE: house.js
|
||||
// DESC: Provides house functions and usage
|
||||
// TYPE: Client (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
class HouseData {
|
||||
constructor(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
this.index = -1;
|
||||
this.houseId = houseId;
|
||||
this.entrancePosition = entrancePosition;
|
||||
this.blipModel = blipModel;
|
||||
this.pickupModel = pickupModel;
|
||||
this.hasInterior = hasInterior;
|
||||
this.blipId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
if(getHouseData(houseId) != false) {
|
||||
if(blipModel == -1) {
|
||||
natives.removeBlipAndClearIndex(getHouseData(houseId).blipId);
|
||||
getHouseData(houseId).blipId = -1;
|
||||
//houses.splice(getHouseData(houseId).index, 1);
|
||||
//setAllHouseDataIndexes();
|
||||
} else {
|
||||
if(getHouseData(houseId).blipId != -1) {
|
||||
natives.setBlipCoordinates(getHouseData(houseId).blipId, getHouseData(houseId).entrancePosition);
|
||||
natives.changeBlipSprite(getHouseData(houseId).blipId, getHouseData(houseId).blipModel);
|
||||
//natives.changeBlipNameFromAscii(getHouseData(houseId).blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
} else {
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
getHouseData(houseId).blipId = blipId;
|
||||
natives.changeBlipSprite(blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(blipId, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(blipModel != -1) {
|
||||
let tempHouseData = new HouseData(houseId, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
let blipId = natives.addBlipForCoord(entrancePosition);
|
||||
if(blipId) {
|
||||
tempHouseData.blipId = blipId;
|
||||
natives.changeBlipSprite(blipId, blipModel);
|
||||
natives.setBlipMarkerLongDistance(blipId, false);
|
||||
//natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
||||
}
|
||||
houses.push(tempHouseData);
|
||||
setAllHouseDataIndexes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* @param {number} houseId - The ID of the house (initially provided by server)
|
||||
* @return {HouseData} The house's data (class instance)
|
||||
*/
|
||||
function getHouseData(houseId) {
|
||||
let tempHouseData = houses.find((h) => h.houseId == houseId);
|
||||
return (typeof tempHouseData != "undefined") ? tempHouseData : false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setAllHouseDataIndexes() {
|
||||
for(let i in houses) {
|
||||
houses[i].index = i;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -249,42 +249,54 @@ function renderJobLabel(name, position, jobType) {
|
||||
function processLabelRendering() {
|
||||
if(renderLabels && areWorldLabelsSupported()) {
|
||||
if(localPlayer != null) {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(pickups[i].getData("vrr.label.type") != null) {
|
||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||
if(!pickups[i].isOnScreen) {
|
||||
let price = "0";
|
||||
let rentPrice = "0";
|
||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||
if(pickups[i].getData("vrr.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.help") != null) {
|
||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||
}
|
||||
|
||||
switch(pickups[i].getData("vrr.label.type")) {
|
||||
case VRR_LABEL_BUSINESS:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||
break;
|
||||
|
||||
case VRR_LABEL_EXIT:
|
||||
renderPropertyExitLabel(pickups[i].position);
|
||||
break;
|
||||
if(!areServerElementsSupported()) {
|
||||
//for(let i in businesses) {
|
||||
// if(getDistance(localPlayer.position, businesses[i].entrancePosition) <= 75.0) {
|
||||
// natives.drawColouredCylinder(businesses[i].entrancePosition, 0.0, 0.0, 0, 153, 255);
|
||||
// }
|
||||
//}
|
||||
|
||||
// natives.getScreenViewportId
|
||||
// natives.getGameViewportId
|
||||
// natives.getViewportPositionOfCoord
|
||||
} else {
|
||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||
for(let i in pickups) {
|
||||
if(pickups[i].getData("vrr.label.type") != null) {
|
||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||
if(!pickups[i].isOnScreen) {
|
||||
let price = "0";
|
||||
let rentPrice = "0";
|
||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||
if(pickups[i].getData("vrr.label.price") != null) {
|
||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||
}
|
||||
|
||||
if(pickups[i].getData("vrr.label.help") != null) {
|
||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||
}
|
||||
|
||||
switch(pickups[i].getData("vrr.label.type")) {
|
||||
case VRR_LABEL_BUSINESS:
|
||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_HOUSE:
|
||||
renderPropertyEntranceLabel("House", pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
||||
break;
|
||||
|
||||
case VRR_LABEL_JOB:
|
||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
||||
break;
|
||||
|
||||
case VRR_LABEL_EXIT:
|
||||
renderPropertyExitLabel(pickups[i].position);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,4 +69,9 @@ let forceWantedLevel = 0;
|
||||
// Pre-cache all allowed skins
|
||||
let allowedSkins = getAllowedSkins(getGame());
|
||||
|
||||
let businesses = [];
|
||||
let houses = [];
|
||||
let jobs = [];
|
||||
let vehicles = [];
|
||||
|
||||
// ===========================================================================
|
||||
@@ -52,7 +52,7 @@ function deleteGameElement(element, position) {
|
||||
// ===========================================================================
|
||||
|
||||
function createGameVehicle(modelIndex, position, heading) {
|
||||
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -85,7 +85,6 @@ function addAllNetworkHandlers() {
|
||||
addNetworkEventHandler("vrr.localPlayerSkin", setLocalPlayerSkin);
|
||||
addNetworkEventHandler("vrr.forcePedAnim", forcePedAnimation);
|
||||
addNetworkEventHandler("vrr.hideAllGUI", hideAllGUI);
|
||||
addNetworkEventHandler("vrr.gameScript", setGameScriptState);
|
||||
addNetworkEventHandler("vrr.clientInfo", serverRequestedClientInfo);
|
||||
addNetworkEventHandler("vrr.interiorLights", updateInteriorLightsState);
|
||||
|
||||
@@ -101,6 +100,13 @@ function addAllNetworkHandlers() {
|
||||
|
||||
addNetworkEventHandler("vrr.logLevel", setLogLevel);
|
||||
addNetworkEventHandler("vrr.infiniteRun", setLocalPlayerInfiniteRun);
|
||||
|
||||
addNetworkEventHandler("vrr.business", receiveBusinessFromServer);
|
||||
addNetworkEventHandler("vrr.house", receiveHouseFromServer);
|
||||
|
||||
addNetworkEventHandler("vrr.holdObject", makePedHoldObject);
|
||||
|
||||
addNetworkEventHandler("vrr.playerPedId", sendLocalPlayerNetworkIdToServer);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -133,6 +139,8 @@ function setPlayer2DRendering(hudState, labelState, smallGameMessageState, score
|
||||
natives.displayCash(hudState);
|
||||
natives.displayAmmo(hudState);
|
||||
natives.displayHud(hudState);
|
||||
natives.displayRadar(hudState);
|
||||
natives.displayAreaName(hudState);
|
||||
} else {
|
||||
if(typeof setHUDEnabled != "undefined") {
|
||||
setHUDEnabled(hudState);
|
||||
@@ -205,18 +213,6 @@ function setEnterPropertyKey(key) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setGameScriptState(scriptName, state) {
|
||||
if(state == VRR_GAMESCRIPT_FORCE) {
|
||||
logToConsole(`[VRR.Server] Starting game script '${scriptName}'`);
|
||||
game.startNewScript(scriptName);
|
||||
} else if(state == VRR_GAMESCRIPT_DENY) {
|
||||
logToConsole(`[VRR.Server] Terminating game script '${scriptName}'`);
|
||||
game.terminateScript(scriptName);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function serverRequestedClientInfo() {
|
||||
sendServerClientInfo();
|
||||
}
|
||||
@@ -266,6 +262,9 @@ function setElementCollisionsEnabled(elementId, state) {
|
||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||
for(let i in parts) {
|
||||
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
||||
}
|
||||
|
||||
for(let i in props) {
|
||||
localPlayer.changeBodyProp(props[0], props[1]);
|
||||
}
|
||||
}
|
||||
@@ -304,11 +303,26 @@ function setLocalPlayerInfiniteRun(state) {
|
||||
|
||||
function setLocalPlayerSkin(skinId) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
//natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||
//localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
|
||||
} else {
|
||||
localPlayer.skin = skinId;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makePedHoldObject(pedId, modelIndex) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendLocalPlayerNetworkIdToServer() {
|
||||
sendNetworkEventToServer("vrr.playerPedId", natives.getNetworkIdFromPed(localPlayer));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -55,7 +55,8 @@ function processSkinSelectKeyPress(keyCode) {
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
@@ -69,7 +70,8 @@ function processSkinSelectKeyPress(keyCode) {
|
||||
skinSelectMessageTextTop = allowedSkins[skinSelectorIndex][1];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
//natives.changePlayerModel(natives.getPlayerId(), allowedSkins[skinSelectorIndex][0]);
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
//localPlayer.modelIndex = allowedSkins[skinSelectorIndex][0];
|
||||
} else {
|
||||
localPlayer.skin = allowedSkins[skinSelectorIndex][0];
|
||||
}
|
||||
|
||||
@@ -24,6 +24,146 @@ function initClientScripts() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setUpInitialGame() {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
|
||||
game.REQUEST_ANIMATION("bikev");
|
||||
game.REQUEST_ANIMATION("bikeh");
|
||||
game.REQUEST_ANIMATION("biked");
|
||||
game.REQUEST_ANIMATION("knife");
|
||||
game.REQUEST_ANIMATION("python");
|
||||
game.REQUEST_ANIMATION("shotgun");
|
||||
game.REQUEST_ANIMATION("buddy");
|
||||
game.REQUEST_ANIMATION("tec");
|
||||
game.REQUEST_ANIMATION("uzi");
|
||||
game.REQUEST_ANIMATION("rifle");
|
||||
game.REQUEST_ANIMATION("m60");
|
||||
game.REQUEST_ANIMATION("sniper");
|
||||
game.REQUEST_ANIMATION("grenade");
|
||||
game.REQUEST_ANIMATION("flame");
|
||||
game.REQUEST_ANIMATION("medic");
|
||||
game.REQUEST_ANIMATION("sunbathe");
|
||||
//game.REQUEST_ANIMATION("playidles");
|
||||
game.REQUEST_ANIMATION("riot");
|
||||
game.REQUEST_ANIMATION("strip");
|
||||
game.REQUEST_ANIMATION("lance");
|
||||
game.REQUEST_ANIMATION("skate");
|
||||
|
||||
game.LOAD_ALL_MODELS_NOW();
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||
game.setGameStat(STAT_FAT, 9999);
|
||||
game.setGameStat(STAT_ENERGY, 9999);
|
||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||
game.setGameStat(STAT_GAMBLING, 9999);
|
||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||
game.setGameStat(STAT_RESPECT, 0);
|
||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||
game.setGameStat(STAT_STAMINA, 9999);
|
||||
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
||||
|
||||
game.setDefaultInteriors(false);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.loadAllObjectsNow();
|
||||
natives.setCellphoneRanked(false);
|
||||
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
||||
natives.setSyncWeatherAndGameTime(false);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.disablePauseMenu(true);
|
||||
natives.allowReactionAnims(localPlayer, true);
|
||||
natives.allowGameToPauseForStreaming(false);
|
||||
natives.allowStuntJumpsToTrigger(false);
|
||||
natives.setPickupsFixCars(false);
|
||||
|
||||
// HUD and Display
|
||||
//natives.displayCash(false);
|
||||
//natives.displayAmmo(false);
|
||||
//natives.displayHud(false);
|
||||
//natives.displayRadar(false);
|
||||
//natives.displayAreaName(false);
|
||||
//natives.displayPlayerNames(false);
|
||||
natives.setPoliceRadarBlips(false);
|
||||
natives.removeTemporaryRadarBlipsForPickups();
|
||||
natives.displayNonMinigameHelpMessages(false);
|
||||
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
|
||||
|
||||
// Item/Money Dropping
|
||||
natives.setMoneyCarriedByAllNewPeds(0);
|
||||
natives.setDeadPedsDropWeapons(false);
|
||||
natives.setPlayersDropMoneyInNetworkGame(false);
|
||||
|
||||
// Population
|
||||
//natives.dontSuppressAnyCarModels(5.0);
|
||||
//natives.dontSuppressAnyPedModels(5.0);
|
||||
//natives.forceGenerateParkedCarsTooCloseToOthers(true);
|
||||
//natives.setParkedCarDensityMultiplier(5.0);
|
||||
//natives.setRandomCarDensityMultiplier(5.0);
|
||||
//natives.setPedDensityMultiplier(5.0);
|
||||
//natives.setCarDensityMultiplier(5.0);
|
||||
//natives.setScenarioPedDensityMultiplier(5.0, 5.0);
|
||||
natives.switchRandomTrains(true);
|
||||
natives.switchRandomBoats(true);
|
||||
natives.switchAmbientPlanes(true);
|
||||
natives.switchMadDrivers(false);
|
||||
|
||||
natives.requestAnims("DANCING");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
initClientScripts();
|
||||
|
||||
// ===========================================================================
|
||||
@@ -14,18 +14,6 @@ function processSync(event, deltaTime) {
|
||||
sendNetworkEventToServer("vrr.player.heading", localPlayer.heading);
|
||||
}
|
||||
|
||||
//if(game.game == VRR_GAME_GTA_SA) {
|
||||
// let lookAtPos = getLocalPlayerLookAtPosition();
|
||||
// sendNetworkEventToServer("vrr.player.lookat", lookAtPos);
|
||||
// setEntityData(localPlayer, "vrr.headLook", lookAtPos);
|
||||
// let peds = getPeds();
|
||||
// for(let i in peds) {
|
||||
// if(doesEntityDataExist(peds[i], "vrr.headLook")) {
|
||||
// peds[i].lookAt(getEntityData(peds[i], "vrr.headLook"), 99999);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if(localPlayer.health <= 0) {
|
||||
if(!calledDeathEvent) {
|
||||
logToConsole(LOG_DEBUG, `Local player died`);
|
||||
@@ -116,7 +104,7 @@ function syncVehicleProperties(vehicle) {
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
let allUpgrades = getGameData().vehicleUpgrades[getGame()];
|
||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||
for(let i in allUpgrades) {
|
||||
vehicle.removeUpgrade(i);
|
||||
}
|
||||
@@ -391,4 +379,14 @@ function syncElementProperties(element) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function receiveHouseFromServer(houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -275,9 +275,17 @@ function runClientCode(code, returnTo) {
|
||||
function enterVehicleAsPassenger() {
|
||||
if(localPlayer.vehicle == null) {
|
||||
let tempVehicle = getClosestVehicle(localPlayer.position);
|
||||
if(tempVehicle != null) {
|
||||
localPlayer.enterVehicle(tempVehicle, false);
|
||||
}
|
||||
if(getGame() != VRR_GAME_GTA_IV) {
|
||||
if(tempVehicle != null) {
|
||||
localPlayer.enterVehicle(tempVehicle, false);
|
||||
}
|
||||
} else {
|
||||
for(let i = 0 ; i <= natives.getMaximumNumberOfPassengers(tempVehicle); i++) {
|
||||
if(natives.isCarPassengerSeatFree(tempVehicle, i)) {
|
||||
natives.taskEnterCarAsPassenger(localPlayer, tempVehicle, i, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -348,6 +356,9 @@ function setLocalPlayerInterior(interior) {
|
||||
if(!isGTAIV()) {
|
||||
localPlayer.interior = interior;
|
||||
game.cameraInterior = interior;
|
||||
} else {
|
||||
let interiorId = natives.getInteriorAtCoords(localPlayer.position);
|
||||
natives.activateInterior(interiorId, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,7 +412,11 @@ function clearLocalPedState() {
|
||||
// ===========================================================================
|
||||
|
||||
function getWeaponSlot(weaponId) {
|
||||
return weaponSlots[game.game][weaponId];
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return weaponSlots[getGame()][weaponId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -498,6 +513,10 @@ function setLocalPlayerCash(amount) {
|
||||
if(typeof localPlayer.money != "undefined") {
|
||||
localPlayer.money = toInteger(amount);
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.setMultiplayerHudCash(amount);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -615,12 +634,12 @@ function forceLocalPlayerEquippedWeaponItem() {
|
||||
if(forceWeapon != 0) {
|
||||
if(localPlayer.weapon != forceWeapon) {
|
||||
localPlayer.weapon = forceWeapon;
|
||||
if(getGame() <= VRR_GAME_GTA_IV) {
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
localPlayer.setWeaponClipAmmunition(getWeaponSlot(forceWeapon), forceWeaponClipAmmo);
|
||||
localPlayer.setWeaponAmmunition(getWeaponSlot(forceWeapon), forceWeaponAmmo);
|
||||
}
|
||||
} else {
|
||||
if(getGame() <= VRR_GAME_GTA_IV) {
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
forceWeaponClipAmmo = localPlayer.getWeaponClipAmmunition(getWeaponSlot(forceWeapon));
|
||||
forceWeaponAmmo = localPlayer.getWeaponAmmunition(getWeaponSlot(forceWeapon));
|
||||
}
|
||||
@@ -745,119 +764,6 @@ function processNearbyPickups() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setUpInitialGame() {
|
||||
if(getGame() == VRR_GAME_GTA_III) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_VC) {
|
||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), 0);
|
||||
game.setGameStat(STAT_PROGRESSMADE, 9999);
|
||||
game.setGameStat(STAT_TOTALPROGRESSINGAME, 9999);
|
||||
game.SET_CAR_DENSITY_MULTIPLIER(3.0);
|
||||
game.SET_PED_DENSITY_MULTIPLIER(3.0);
|
||||
|
||||
game.REQUEST_ANIMATION("bikev");
|
||||
game.REQUEST_ANIMATION("bikeh");
|
||||
game.REQUEST_ANIMATION("biked");
|
||||
game.REQUEST_ANIMATION("knife");
|
||||
game.REQUEST_ANIMATION("python");
|
||||
game.REQUEST_ANIMATION("shotgun");
|
||||
game.REQUEST_ANIMATION("buddy");
|
||||
game.REQUEST_ANIMATION("tec");
|
||||
game.REQUEST_ANIMATION("uzi");
|
||||
game.REQUEST_ANIMATION("rifle");
|
||||
game.REQUEST_ANIMATION("m60");
|
||||
game.REQUEST_ANIMATION("sniper");
|
||||
game.REQUEST_ANIMATION("grenade");
|
||||
game.REQUEST_ANIMATION("flame");
|
||||
game.REQUEST_ANIMATION("medic");
|
||||
game.REQUEST_ANIMATION("sunbathe");
|
||||
//game.REQUEST_ANIMATION("playidles");
|
||||
game.REQUEST_ANIMATION("riot");
|
||||
game.REQUEST_ANIMATION("strip");
|
||||
game.REQUEST_ANIMATION("lance");
|
||||
game.REQUEST_ANIMATION("skate");
|
||||
|
||||
game.LOAD_ALL_MODELS_NOW();
|
||||
game.onMission = true;
|
||||
SetStandardControlsEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_SA) {
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_PISTOL_SILENCED_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_DESERT_EAGLE_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SAWNOFF_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_SPAS12_SHOTGUN_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MICRO_UZI_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_MP5_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_AK47_SKILL, 400);
|
||||
game.setGameStat(STAT_WEAPONTYPE_M4_SKILL, 400);
|
||||
game.setGameStat(STAT_DRIVING_SKILL, 9999);
|
||||
game.setGameStat(STAT_FAT, 9999);
|
||||
game.setGameStat(STAT_ENERGY, 9999);
|
||||
game.setGameStat(STAT_CYCLE_SKILL, 9999);
|
||||
game.setGameStat(STAT_BIKE_SKILL, 9999);
|
||||
game.setGameStat(STAT_GAMBLING, 9999);
|
||||
game.setGameStat(STAT_PROGRESS_MADE, 9999);
|
||||
game.setGameStat(STAT_RESPECT, 0);
|
||||
game.setGameStat(STAT_RESPECT_TOTAL, 0);
|
||||
game.setGameStat(STAT_SEX_APPEAL, 0);
|
||||
game.setGameStat(STAT_STAMINA, 9999);
|
||||
game.setGameStat(STAT_TOTAL_PROGRESS, 9999);
|
||||
game.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
|
||||
game.setGameStat(STAT_BODY_MUSCLE, 9999);
|
||||
|
||||
game.setDefaultInteriors(false);
|
||||
game.onMission = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
natives.allowEmergencyServices(false);
|
||||
natives.setCreateRandomCops(true);
|
||||
natives.setMaxWantedLevel(0);
|
||||
natives.setWantedMultiplier(0.0);
|
||||
natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
|
||||
natives.setPlayerTeam(natives.getPlayerId(), 0);
|
||||
natives.loadAllObjectsNow();
|
||||
natives.setCellphoneRanked(false);
|
||||
natives.setOverrideNoSprintingOnPhoneInMultiplayer(false);
|
||||
natives.setPlayersDropMoneyInNetworkGame(false);
|
||||
natives.setSyncWeatherAndGameTime(false);
|
||||
natives.usePlayerColourInsteadOfTeamColour(true);
|
||||
natives.setDisplayPlayerNameAndIcon(natives.getPlayerId(), false);
|
||||
natives.removeTemporaryRadarBlipsForPickups();
|
||||
natives.setPickupsFixCars(false);
|
||||
natives.displayCash(false);
|
||||
natives.displayAmmo(false);
|
||||
natives.displayHud(false);
|
||||
natives.displayAreaName(false);
|
||||
natives.setPoliceRadarBlips(false);
|
||||
|
||||
natives.requestAnims("DANCING");
|
||||
return true;
|
||||
}
|
||||
|
||||
if(getGame() == VRR_GAME_MAFIA_ONE) {
|
||||
game.mapEnabled = false;
|
||||
game.setTrafficEnabled(false);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function processGameSpecifics() {
|
||||
if(game.game < VRR_GAME_GTA_IV) {
|
||||
game.clearMessages();
|
||||
|
||||
@@ -63,8 +63,7 @@ function listAccentsCommand(command, params, client) {
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(accentList, 8);
|
||||
|
||||
messagePlayerInfo(client, `{clanOrange}== {jobYellow}Accents {clanOrange}==================================`);
|
||||
|
||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "AccentList")));
|
||||
for(let i in chunkedList) {
|
||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||
}
|
||||
@@ -112,7 +111,7 @@ function addAccentCommand(command, params, client) {
|
||||
|
||||
getGlobalConfig().accents.push(newAccentName);
|
||||
saveAccentConfig();
|
||||
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`);
|
||||
messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -132,7 +131,7 @@ function removeAccentCommand(command, params, client) {
|
||||
|
||||
getGlobalConfig().accents.push(newAccentName);
|
||||
saveAccentConfig();
|
||||
messageAdmins(`${client.name} {MAINCOLOUR}added a new accent: ${newAccentName}`);
|
||||
messageAdmins(`${client.name}{MAINCOLOUR} added a new accent: ${newAccentName}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -599,7 +599,6 @@ function loginSuccess(client) {
|
||||
|
||||
getPlayerData(client).accountData.ipAddress = client.ip;
|
||||
|
||||
//sendRemovedWorldObjectsToPlayer(client);
|
||||
sendPlayerChatScrollLines(client, getPlayerData(client).accountData.chatScrollLines);
|
||||
|
||||
messagePlayerNormal(null, `👋 ${getPlayerName(client)} has joined the server`, getColourByName("softYellow"));
|
||||
@@ -1127,6 +1126,7 @@ function initClient(client) {
|
||||
updatePlayerSnowState(client);
|
||||
|
||||
showConnectCameraToPlayer(client);
|
||||
|
||||
messageClient(`Please wait ...`, client, getColourByName("softGreen"));
|
||||
|
||||
setTimeout(function() {
|
||||
|
||||
@@ -70,7 +70,7 @@ function stopPlayerAnimationCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showAnimationListCommand(command, params, client) {
|
||||
let animList = getGameData().animations[getServerGame()].map(function(x) { return x[0]; });
|
||||
let animList = getGameConfig().animations[getServerGame()].map(function(x) { return x[0]; });
|
||||
|
||||
let chunkedList = splitArrayIntoChunks(animList, 10);
|
||||
|
||||
@@ -88,7 +88,7 @@ function showAnimationListCommand(command, params, client) {
|
||||
* @return {Array} The animation's data (array)
|
||||
*/
|
||||
function getAnimationData(animationSlot, gameId = getServerGame()) {
|
||||
return getGameData().animations[gameId][animationSlot];
|
||||
return getGameConfig().animations[gameId][animationSlot];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -145,13 +145,13 @@ function makePlayerStopAnimation(client) {
|
||||
|
||||
function getAnimationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().animations[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().animations[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().animations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().animations[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().animations[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,57 +9,8 @@
|
||||
|
||||
function initAntiCheatScript() {
|
||||
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Initializing anticheat script ...");
|
||||
getServerData().antiCheat.whiteListedGameScripts = loadAntiCheatGameScriptWhiteListFromDatabase();
|
||||
getServerData().antiCheat.blackListedGameScripts = loadAntiCheatGameScriptBlackListFromDatabase();
|
||||
logToConsole(LOG_DEBUG, "[VRR.AntiCheat]: Anticheat script initialized!");
|
||||
}
|
||||
// ===========================================================================
|
||||
|
||||
function loadAntiCheatGameScriptWhiteListFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading whitelisted game scripts ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempWhiteListedGameScripts = [];
|
||||
|
||||
if(dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM ac_script_wl WHERE ac_script_wl_enabled = 1 AND ac_script_wl_server = ${getServerId()}`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
if(dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(dbAssoc);
|
||||
tempWhiteListedGameScripts.push(tempWhiteListedGameScriptData);
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Whitelisted game script '${tempWhiteListedGameScriptData.scriptName}' loaded successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempWhiteListedGameScripts.length} whitelisted game scripts loaded!`);
|
||||
return tempWhiteListedGameScripts;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadAntiCheatGameScriptBlackListFromDatabase() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Loading blacklisted game scripts ...`);
|
||||
let dbConnection = connectToDatabase();
|
||||
let tempBlackListedGameScripts = [];
|
||||
|
||||
if(dbConnection) {
|
||||
let dbQueryString = `SELECT * FROM ac_script_bl WHERE ac_script_bl_enabled = 1 AND ac_script_bl_server = ${getServerId()}`;
|
||||
let dbQuery = queryDatabase(dbConnection, dbQueryString);
|
||||
if(dbQuery) {
|
||||
if(dbQuery.numRows > 0) {
|
||||
let dbAssoc = fetchQueryAssoc(dbQuery);
|
||||
let tempBlackListedGameScriptData = new BlackListedGameScriptData(dbAssoc);
|
||||
tempBlackListedGameScripts.push(tempBlackListedGameScriptData);
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] Blacklisted game script '${tempBlackListedGameScriptData.scriptName}' loaded successfully!`);
|
||||
}
|
||||
}
|
||||
disconnectFromDatabase(dbConnection);
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.AntiCheat] ${tempBlackListedGameScripts.length} blacklisted game scripts loaded!`);
|
||||
return tempBlackListedGameScripts;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -76,170 +27,6 @@ function clearPlayerStateToEnterExitProperty(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function addAntiCheatBlackListedScriptCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let scriptName = params;
|
||||
let tempBlackListedGameScriptData = new BlackListedGameScriptData(false);
|
||||
tempBlackListedGameScriptData.scriptName = scriptName;
|
||||
tempBlackListedGameScriptData.serverId = getServerId();
|
||||
tempBlackListedGameScriptData.enabled = true;
|
||||
tempBlackListedGameScriptData.needsSaved = true;
|
||||
getServerConfig().antiCheat.blackListedGameScripts.push(tempBlackListedGameScriptData);
|
||||
|
||||
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
|
||||
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_DENY);
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script blacklist`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function addAntiCheatWhiteListedScriptCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let scriptName = params;
|
||||
let tempWhiteListedGameScriptData = new WhiteListedGameScriptData(false);
|
||||
tempWhiteListedGameScriptData.scriptName = scriptName;
|
||||
tempWhiteListedGameScriptData.serverId = getServerId();
|
||||
tempWhiteListedGameScriptData.enabled = true;
|
||||
tempWhiteListedGameScriptData.needsSaved = true;
|
||||
getServerConfig().antiCheat.whiteListedGameScripts.push(tempWhiteListedGameScriptData);
|
||||
|
||||
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
|
||||
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_ALLOW);
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You added {ALTCOLOUR}${scriptName} {MAINCOLOUR} to the anticheat game script whitelist`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function removeAntiCheatWhiteListedScriptCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let whiteListScriptId = getAntiCheatWhiteListedScriptFromParams(params);
|
||||
|
||||
getServerConfig().antiCheat.whiteListedGameScripts.splice(whiteListScriptId, 1);
|
||||
|
||||
if(getServerConfig().antiCheat.gameScriptWhiteListEnabled) {
|
||||
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script whitelist`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function removeAntiCheatBlackListedScriptCommand(command, params, client) {
|
||||
if(areParamsEmpty(params)) {
|
||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||
return false;
|
||||
}
|
||||
|
||||
let blackListScriptId = getAntiCheatBlackListedScriptFromParams(params);
|
||||
|
||||
getServerConfig().antiCheat.blackListedGameScripts.splice(blackListScriptId, 1);
|
||||
|
||||
if(getServerConfig().antiCheat.gameScriptBlackListEnabled) {
|
||||
sendPlayerGameScriptState(null, scriptName, VRR_GAMESCRIPT_NONE);
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You removed {ALTCOLOUR}${scriptName} {MAINCOLOUR} from the anticheat game script blacklist`);
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function toggleAntiCheatScriptWhiteListCommand(command, params, client) {
|
||||
getServerConfig().antiCheat.gameScriptWhiteListEnabled = !getServerConfig().antiCheat.gameScriptWhiteListEnabled;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script whitelist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptWhiteListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptWhiteListEnabled))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
* This is a command handler function.
|
||||
*
|
||||
* @param {string} command - The command name used by the player
|
||||
* @param {string} params - The parameters/args string used with the command by the player
|
||||
* @param {Client} client - The client/player that used the command
|
||||
* @return {bool} Whether or not the command was successful
|
||||
*
|
||||
*/
|
||||
function toggleAntiCheatScriptBlackListCommand(command, params, client) {
|
||||
getServerConfig().antiCheat.gameScriptBlackListEnabled = !getServerConfig().antiCheat.gameScriptBlackListEnabled;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned anticheat game script blacklist ${getBoolRedGreenInlineColour(getServerConfig().antiCheat.gameScriptBlackListEnabled)}${toUpperCase(getOnOffFromBool(getServerConfig().antiCheat.gameScriptBlackListEnabled))}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerExemptFromAntiCheat(client) {
|
||||
if(hasBitFlag(getPlayerData(client).accountData.flags.moderation, getModerationFlagValue("ExemptFromAntiCheat"))) {
|
||||
return true;
|
||||
|
||||
@@ -58,7 +58,7 @@ function loadBusinessesFromDatabase() {
|
||||
while(dbAssoc = fetchQueryAssoc(dbQuery)) {
|
||||
let tempBusinessData = new BusinessData(dbAssoc);
|
||||
tempBusinessData.locations = loadBusinessLocationsFromDatabase(tempBusinessData.databaseId);
|
||||
tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||
//tempBusinessData.gameScripts = loadBusinessGameScriptsFromDatabase(tempBusinessData.databaseId);
|
||||
tempBusinesses.push(tempBusinessData);
|
||||
logToConsole(LOG_INFO, `[VRR.Business]: Business '${tempBusinessData.name}' (ID ${tempBusinessData.databaseId}) loaded from database successfully!`);
|
||||
}
|
||||
@@ -105,6 +105,7 @@ function loadBusinessLocationsFromDatabase(businessId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/*
|
||||
function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Business]: Loading business game scripts for business ${businessId} from database ...`);
|
||||
|
||||
@@ -133,6 +134,7 @@ function loadBusinessGameScriptsFromDatabase(businessId) {
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Business]: ${tempBusinessGameScripts.length} game scripts for business ${businessId} loaded from database successfully!`);
|
||||
return tempBusinessGameScripts;
|
||||
}
|
||||
*/
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1335,7 +1337,7 @@ function createAllBusinessBlips() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
function createBusinessEntrancePickup(businessId) {
|
||||
if(!getServerConfig().createBusinessPickups) {
|
||||
return false;
|
||||
}
|
||||
@@ -1348,18 +1350,26 @@ function createBusinessEntrancePickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entrancePickup = createGamePickup(pickupModelId, getBusinessData(businessId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entrancePickup, false);
|
||||
setElementDimension(getBusinessData(businessId).entrancePickup, getBusinessData(businessId).entranceDimension);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).entrancePickup);
|
||||
} else {
|
||||
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId), getBusinessData(businessId).entrancePosition, getBusinessData(businessId).entranceBlipModel, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createBusinessEntranceBlip(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getServerConfig().createBusinessBlips) {
|
||||
return false;
|
||||
}
|
||||
@@ -1372,11 +1382,15 @@ function createBusinessEntranceBlip(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating entrance blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).entranceBlip = createGameBlip(getBusinessData(businessId).entrancePosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementOnAllDimensions(getBusinessData(businessId).entranceBlip, false);
|
||||
setElementDimension(getBusinessData(businessId).entranceBlip, getBusinessData(businessId).entranceDimension);
|
||||
addToWorld(getBusinessData(businessId).entranceBlip);
|
||||
} else {
|
||||
sendBusinessEntranceToPlayer(null, businessId, getBusinessData(businessId).name, getBusinessData(businessId).entrancePosition, blipModelId, getBusinessData(businessId).entrancePickupModel, getBusinessData(businessId).hasInterior, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1396,12 +1410,14 @@ function createBusinessExitPickup(businessId) {
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit pickup for business ${getBusinessData(businessId).name} (model ${pickupModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getBusinessData(businessId).exitPickup = createGamePickup(pickupModelId, getBusinessData(businessId).exitPosition, getGameConfig().pickupTypes[getServerGame()].business);
|
||||
setElementDimension(getBusinessData(businessId).exitPickup, getBusinessData(businessId).exitDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitPickup, false);
|
||||
updateBusinessPickupLabelData(businessId);
|
||||
addToWorld(getBusinessData(businessId).exitPickup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1421,15 +1437,17 @@ function createBusinessExitBlip(businessId) {
|
||||
blipModelId = getBusinessData(businessId).exitBlipModel;
|
||||
}
|
||||
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
if(areServerElementsSupported()) {
|
||||
logToConsole(LOG_VERBOSE, `[VRR.Job]: Creating exit blip for business ${getBusinessData(businessId).name} (model ${blipModelId})`);
|
||||
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
getBusinessData(businessId).exitBlip = createGameBlip(getBusinessData(businessId).exitPosition, blipModelId, 1, getColourByName("businessBlue"));
|
||||
setElementDimension(getBusinessData(businessId).exitBlip, getBusinessData(businessId).entranceDimension);
|
||||
setElementOnAllDimensions(getBusinessData(businessId).exitBlip, false);
|
||||
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
|
||||
//setEntityData(getBusinessData(businessId).exitBlip, "vrr.owner.id", businessId, false);
|
||||
addToWorld(getBusinessData(businessId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1535,6 +1553,10 @@ function doesBusinessHaveInterior(businessId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntrancePickup(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).entrancePickup != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).entrancePickup);
|
||||
deleteGameElement(getBusinessData(businessId).entrancePickup);
|
||||
@@ -1545,6 +1567,10 @@ function deleteBusinessEntrancePickup(businessId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitPickup(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).exitPickup != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).exitPickup);
|
||||
deleteGameElement(getBusinessData(businessId).exitPickup);
|
||||
@@ -1555,6 +1581,10 @@ function deleteBusinessExitPickup(businessId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessEntranceBlip(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).entranceBlip != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).entranceBlip);
|
||||
deleteGameElement(getBusinessData(businessId).entranceBlip);
|
||||
@@ -1565,6 +1595,10 @@ function deleteBusinessEntranceBlip(businessId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteBusinessExitBlip(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).exitBlip != null) {
|
||||
//removeFromWorld(getBusinessData(businessId).exitBlip);
|
||||
deleteGameElement(getBusinessData(businessId).exitBlip);
|
||||
@@ -1907,6 +1941,10 @@ function getBusinessIdFromDatabaseId(databaseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateBusinessPickupLabelData(businessId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getBusinessData(businessId).exitPickup != null) {
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
|
||||
setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
|
||||
@@ -2022,19 +2060,19 @@ function doesBusinessHaveAnyItemsToBuy(businessId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerBusinessGameScripts(client, businessId) {
|
||||
for(let i in getBusinessData(businessId).gameScripts) {
|
||||
sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
|
||||
}
|
||||
}
|
||||
//function sendPlayerBusinessGameScripts(client, businessId) {
|
||||
// for(let i in getBusinessData(businessId).gameScripts) {
|
||||
// sendPlayerGameScriptState(client, getBusinessData(businessId).gameScripts[i].state);
|
||||
// }
|
||||
//}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerBusinessGameScripts(client, businessId) {
|
||||
for(let i in getBusinessData(businessId).gameScripts) {
|
||||
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
|
||||
}
|
||||
}
|
||||
//function clearPlayerBusinessGameScripts(client, businessId) {
|
||||
// for(let i in getBusinessData(businessId).gameScripts) {
|
||||
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
|
||||
// }
|
||||
//}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
|
||||
@@ -62,11 +62,11 @@ class ServerData {
|
||||
|
||||
this.antiCheat = {
|
||||
enabled: false,
|
||||
checkGameScripts: false,
|
||||
gameScriptWhiteListEnabled: false,
|
||||
gameScriptBlackListEnabled: false,
|
||||
gameScriptWhiteList: [],
|
||||
gameScriptBlackList: [],
|
||||
//checkGameScripts: false,
|
||||
//gameScriptWhiteListEnabled: false,
|
||||
//gameScriptBlackListEnabled: false,
|
||||
//gameScriptWhiteList: [],
|
||||
//gameScriptBlackList: [],
|
||||
};
|
||||
|
||||
this.discordBotToken = "";
|
||||
@@ -113,38 +113,14 @@ class ServerData {
|
||||
this.minute = toInteger(dbAssoc["svr_start_time_min"]);
|
||||
this.minuteDuration = toInteger(dbAssoc["svr_time_min_duration"]);
|
||||
this.weather = toInteger(dbAssoc["svr_start_weather"]);
|
||||
this.fallingSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
this.groundSnow = hasBitFlag(this.settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
this.useGUI = hasBitFlag(this.settings, getServerSettingsFlagValue("GUI"));
|
||||
this.guiColourPrimary = [toInteger(dbAssoc["svr_gui_col1_r"]), toInteger(dbAssoc["svr_gui_col1_g"]), toInteger(dbAssoc["svr_gui_col1_b"])];
|
||||
this.guiColourSecondary = [toInteger(dbAssoc["svr_gui_col2_r"]), toInteger(dbAssoc["svr_gui_col2_g"]), toInteger(dbAssoc["svr_gui_col2_b"])];
|
||||
this.guiTextColourPrimary = [toInteger(dbAssoc["svr_gui_textcol1_r"]), toInteger(dbAssoc["svr_gui_textcol1_g"]), toInteger(dbAssoc["svr_gui_textcol1_b"])];
|
||||
//this.guiTextColourSecondary = [toInteger(dbAssoc["svr_gui_textcol2_r"]), toInteger(dbAssoc["svr_gui_textcol2_g"]), toInteger(dbAssoc["svr_gui_textcol2_b"])];
|
||||
this.showLogo = hasBitFlag(this.settings, getServerSettingsFlagValue("Logo"));
|
||||
this.inflationMultiplier = toFloat(dbAssoc["svr_inflation_multiplier"]);
|
||||
this.testerOnly = hasBitFlag(this.settings, getServerSettingsFlagValue("Testing"));
|
||||
|
||||
this.antiCheat = {
|
||||
enabled: hasBitFlag(this.settings, getServerSettingsFlagValue("Anticheat")),
|
||||
checkGameScripts: hasBitFlag(this.settings, getServerSettingsFlagValue("CheckGameScripts")),
|
||||
gameScriptBlackListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptBlackList")),
|
||||
gameScriptWhiteListEnabled: hasBitFlag(this.settings, getServerSettingsFlagValue("GameScriptWhiteList")),
|
||||
gameScriptWhiteList: [],
|
||||
gameScriptBlackList: [],
|
||||
};
|
||||
|
||||
this.discordBotToken = intToBool(dbAssoc["svr_discord_bot_token"]);
|
||||
this.discordEnabled = hasBitFlag(this.settings, getServerSettingsFlagValue("DiscordBot"));
|
||||
|
||||
this.createJobPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("JobPickups"));
|
||||
this.createBusinessPickups = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
this.createHousePickups = hasBitFlag(this.settings, getServerSettingsFlagValue("HousePickups"));
|
||||
this.createJobBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("JobBlips"));
|
||||
this.createBusinessBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
this.createHouseBlips = hasBitFlag(this.settings, getServerSettingsFlagValue("HouseBlips"));
|
||||
|
||||
this.introMusicURL = dbAssoc["svr_intro_music"];
|
||||
this.useRealTime = hasBitFlag(this.settings, getServerSettingsFlagValue("RealTime"));
|
||||
this.realTimeZone = dbAssoc["svr_time_realtime_timezone"];
|
||||
|
||||
this.discordConfig = {
|
||||
@@ -263,6 +239,8 @@ class ClientData {
|
||||
this.locale = 0;
|
||||
|
||||
this.enteringVehicle = null;
|
||||
|
||||
this.pedId = -1;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -672,7 +650,7 @@ class HouseData {
|
||||
|
||||
this.itemCache = [];
|
||||
this.locations = [];
|
||||
this.gameScripts = [];
|
||||
//this.gameScripts = [];
|
||||
|
||||
this.entrancePosition = false;
|
||||
this.entranceRotation = 0.0;
|
||||
|
||||
@@ -74,6 +74,7 @@ function addAllNetworkHandlers() {
|
||||
addNetworkEventHandler("vrr.skinSelected", playerFinishedSkinSelection);
|
||||
addNetworkEventHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
|
||||
addNetworkEventHandler("vrr.vehBuyState", receiveVehiclePurchaseStateUpdateFromClient);
|
||||
addNetworkEventHandler("vrr.playerPedId", receivePlayerPedNetworkId);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -223,29 +224,6 @@ function updatePlayerSnowState(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendExcludedModelsForGroundSnowToPlayer(client) {
|
||||
if(getGameConfig().excludedGroundSnowModels[getServerGame()].length > 0) {
|
||||
for(let i in getGameConfig().excludedGroundSnowModels[getServerGame()]) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Misc] Sending excluded model ${i} for ground snow to ${getPlayerName(client)}`);
|
||||
sendNetworkEventToPlayer("vrr.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendRemovedWorldObjectsToPlayer(client) {
|
||||
if(getGameConfig().removedWorldObjects[getServerGame()].length > 0) {
|
||||
for(let i in getGameConfig().removedWorldObjects[getServerGame()]) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending removed world object ${i} (${getGameConfig().removedWorldObjects[getServerGame()][i][0]}) to ${getPlayerName(client)}`);
|
||||
sendNetworkEventToPlayer("vrr.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i][0], getGameConfig().removedWorldObjects[getServerGame()][i][1], getGameConfig().removedWorldObjects[getServerGame()][i][2]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updatePlayerHotBar(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Client] Sending updated hotbar data to ${getPlayerDisplayForConsole(client)}`);
|
||||
let tempHotBarItems = [];
|
||||
@@ -1053,12 +1031,6 @@ function setPlayerHeadLookPosition(client, position) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerGameScriptState(client, scriptName, state) {
|
||||
sendNetworkEventToPlayer("vrr.gameScript", client, scriptName, state);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function requestClientInfo(client) {
|
||||
sendNetworkEventToPlayer("vrr.clientInfo", client);
|
||||
}
|
||||
@@ -1078,7 +1050,10 @@ function forcePlayerToSyncElementProperties(client, element) {
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerPedPartsAndProps(client) {
|
||||
sendNetworkEventToPlayer("vrr.ped")
|
||||
let bodyParts = getPlayerCurrentSubAccount(client).bodyParts;
|
||||
let bodyProps = getPlayerCurrentSubAccount(client).bodyProps;
|
||||
|
||||
sendNetworkEventToPlayer("vrr.ped", client, [bodyParts.hair, bodyParts.head, bodyParts.upper, bodyParts.lower], [bodyProps.hair, bodyProps.eyes, bodyProps.head, bodyProps.leftHand, bodyProps.rightHand, bodyProps.leftWrist, bodyProps.rightWrist, bodyParts.hip, bodyProps.leftFoot, bodyProps.rightFoot]);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1134,4 +1109,56 @@ function setPlayerInfiniteRun(client, state) {
|
||||
sendNetworkEventToPlayer("vrr.infiniteRun", client, state);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendBusinessEntranceToPlayer(client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems) {
|
||||
sendNetworkEventToPlayer("vrr.business", client, businessId, name, entrancePosition, blipModel, pickupModel, hasInterior, hasItems);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendHouseEntranceToPlayer(client, houseId, entrancePosition, blipModel, pickupModel, hasInterior) {
|
||||
sendNetworkEventToPlayer("vrr.house", client, houseId, entrancePosition, blipModel, pickupModel, hasInterior);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllBusinessEntrancesToPlayer(client) {
|
||||
let businesses = getServerData().businesses;
|
||||
for(let i in businesses) {
|
||||
if(businesses[i].entranceBlipModel > 0) {
|
||||
sendBusinessEntranceToPlayer(client, businesses[i].index, businesses[i].name, businesses[i].entrancePosition, businesses[i].entranceBlipModel, businesses[i].entrancePickupModel, businesses[i].hasInterior, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function sendAllHouseEntrancesToPlayer(client) {
|
||||
let houses = getServerData().houses;
|
||||
for(let i in houses) {
|
||||
if(houses[i].entranceBlipModel > 0) {
|
||||
sendBusinessEntranceToPlayer(client, businesses[i].index, houses[i].entrancePosition, houses[i].entranceBlipModel, houses[i].entrancePickupModel, houses[i].hasInterior);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function makePlayerHoldObjectModel(client, modelIndex) {
|
||||
sendNetworkEventToPlayer("vrr.holdObject", client, getPlayerData(client).pedId, modelIndex);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function receivePlayerPedNetworkId(client, pedId) {
|
||||
getPlayerData(client).pedId = pedId;
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
|
||||
function requestPlayerPedNetworkId(client) {
|
||||
sendNetworkEventToPlayer("vrr.playerPedId", client);
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
@@ -68,12 +68,6 @@ function loadCommands() {
|
||||
commandData("stopanim", stopPlayerAnimationCommand, "", getStaffFlagValue("None"), true, true, "Stops your current animation"),
|
||||
],
|
||||
antiCheat: [
|
||||
commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("delacscriptwl", removeAntiCheatWhiteListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("addacscriptbl", addAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("delacscriptbl", removeAntiCheatBlackListedScriptCommand, "<script name>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("setacscriptbl", toggleAntiCheatScriptBlackListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
commandData("setacscriptwl", toggleAntiCheatScriptWhiteListCommand, "<0/1 state>", getStaffFlagValue("ManageAntiCheat"), true, true),
|
||||
//commandData("setac", toggleGlobalAntiCheatCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
//commandData("ac", getGlobalAntiCheatStatusCommand, "<0/1 state>", getStaffFlagValue("Developer"), true, true),
|
||||
],
|
||||
|
||||
@@ -7,10 +7,10 @@
|
||||
// TYPE: Server (JavaScript)
|
||||
// ===========================================================================
|
||||
|
||||
let serverConfig = {};
|
||||
let databaseConfig = {};
|
||||
let emailConfig = {};
|
||||
let gameConfig = {};
|
||||
let serverConfig = false;
|
||||
let databaseConfig = false;
|
||||
let emailConfig = false;
|
||||
let gameConfig = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -75,9 +75,38 @@ let globalConfig = {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadGameConfig() {
|
||||
return gameData;
|
||||
};
|
||||
function initConfigScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading global config ...");
|
||||
loadGlobalConfig();
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Loading server config ...");
|
||||
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: Applying server config ...");
|
||||
|
||||
getServerConfig().fallingSnow = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
getServerConfig().groundSnow = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
getServerConfig().useGUI = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||
getServerConfig().showLogo = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Logo"));
|
||||
getServerConfig().testerOnly = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing"));
|
||||
getServerConfig().discordEnabled = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("DiscordBot"));
|
||||
getServerConfig().createJobPickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
|
||||
getServerConfig().createBusinessPickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
getServerConfig().createHousePickups = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||
getServerConfig().createJobBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
|
||||
getServerConfig().createBusinessBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
getServerConfig().createHouseBlips = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
|
||||
getServerConfig().useRealTime = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||
getServerConfig().antiCheat.enabled = hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Anticheat"));
|
||||
|
||||
applyConfigToServer(serverConfig);
|
||||
|
||||
logToConsole(LOG_DEBUG, "[VRR.Config]: All config loaded and applied successfully!");
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
|
||||
}
|
||||
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -89,19 +118,6 @@ function loadGlobalConfig() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function initConfigScript() {
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Initializing config script ...");
|
||||
gameConfig = loadGameConfig();
|
||||
serverConfig = loadServerConfigFromGameAndPort(server.game, server.port, getMultiplayerMod());
|
||||
applyConfigToServer(serverConfig);
|
||||
|
||||
loadGlobalConfig();
|
||||
|
||||
logToConsole(LOG_INFO, "[VRR.Config]: Config script initialized!");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function loadServerConfigFromGameAndPort(gameId, port, mpMod) {
|
||||
let dbConnection = connectToDatabase();
|
||||
if(dbConnection) {
|
||||
@@ -144,10 +160,12 @@ function loadServerConfigFromId(tempServerId) {
|
||||
|
||||
function applyConfigToServer(tempServerConfig) {
|
||||
if(isTimeSupported()) {
|
||||
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration)
|
||||
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting time to to ${tempServerConfig.hour}:${tempServerConfig.minute} with minute duration of ${tempServerConfig.minuteDuration}`);
|
||||
setGameTime(tempServerConfig.hour, tempServerConfig.minute, tempServerConfig.minuteDuration);
|
||||
}
|
||||
|
||||
if(isWeatherSupported()) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Config]: Setting weather to ${tempServerConfig.weather}`);
|
||||
game.forceWeather(tempServerConfig.weather);
|
||||
}
|
||||
|
||||
@@ -220,21 +238,15 @@ function saveServerConfigToDatabase() {
|
||||
* @return {ServerData} - Server configuration data
|
||||
*
|
||||
*/
|
||||
function getServerConfig(serverId = getServerId()) {
|
||||
if(serverId != getServerId()) {
|
||||
return loadServerConfigFromId(serverId);
|
||||
}
|
||||
function getServerConfig() {
|
||||
//if(serverId != getServerId()) {
|
||||
// return loadServerConfigFromId(serverId);
|
||||
//}
|
||||
return serverConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGameConfig() {
|
||||
return gameConfig;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGlobalConfig() {
|
||||
return globalConfig;
|
||||
}
|
||||
@@ -351,7 +363,7 @@ function setWeatherCommand(command, params, client) {
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameData().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
messageAdminAction(`${getPlayerName(client)} set the weather to {ALTCOLOUR}${getGameConfig().weatherNames[getServerGame()][toInteger(weatherId)]}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
@@ -380,18 +392,6 @@ function setSnowingCommand(command, params, client) {
|
||||
getServerConfig().fallingSnow = intToBool(falling);
|
||||
getServerConfig().groundSnow = intToBool(ground);
|
||||
|
||||
if(falling == true && doesServerHaveFallingSnowEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
} else if(falling == false && !doesServerHaveFallingSnowEnabled()) {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
}
|
||||
|
||||
if(ground == true && doesServerHaveGroundSnowEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
} else if(ground == false && !doesServerHaveGroundSnowEnabled()) {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
}
|
||||
|
||||
updatePlayerSnowState(null);
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
@@ -449,13 +449,7 @@ function setServerGUIColoursCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerLogoCommand(command, params, client) {
|
||||
if(doesServerHaveServerLogoEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("ServerLogo"));
|
||||
getServerConfig().useLogo = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("ServerLogo"));
|
||||
getServerConfig().useLogo = true;
|
||||
}
|
||||
getServerConfig().useLogo = !getServerConfig().useLogo;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
updatePlayerShowLogoState(null, getServerConfig().useLogo);
|
||||
@@ -477,13 +471,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerJobBlipsCommand(command, params, client) {
|
||||
if(doesServerHaveJobBlipsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
|
||||
getServerConfig().createJobBlips = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
|
||||
getServerConfig().createJobBlips = true;
|
||||
}
|
||||
getServerConfig().createJobBlips = !getServerConfig().createJobBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobBlips))} {MAINCOLOUR}all job blips`);
|
||||
@@ -503,13 +491,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerJobPickupsCommand(command, params, client) {
|
||||
if(doesServerHaveJobPickupsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
|
||||
getServerConfig().createJobPickups = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
|
||||
getServerConfig().createJobPickups = true;
|
||||
}
|
||||
getServerConfig().createJobPickups = !getServerConfig().createJobPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveJobPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createJobPickups))} {MAINCOLOUR}all job pickups`);
|
||||
@@ -529,13 +511,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessBlipsCommand(command, params, client) {
|
||||
if(doesServerHaveBusinessBlipsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
getServerConfig().createBusinessBlips = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
getServerConfig().createBusinessBlips = true;
|
||||
}
|
||||
getServerConfig().createBusinessBlips = !getServerConfig().createBusinessBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessBlips))} {MAINCOLOUR}all business blips`);
|
||||
@@ -555,13 +531,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerBusinessPickupsCommand(command, params, client) {
|
||||
if(doesServerHaveBusinessPickupsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
getServerConfig().createBusinessPickups = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
getServerConfig().createBusinessPickups = true;
|
||||
}
|
||||
getServerConfig().createBusinessPickups = !getServerConfig().createBusinessPickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveBusinessPickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createBusinessPickups))} {MAINCOLOUR}all business pickups`);
|
||||
@@ -581,13 +551,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerHouseBlipsCommand(command, params, client) {
|
||||
if(doesServerHaveHouseBlipsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||
getServerConfig().createHouseBlips = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
|
||||
getServerConfig().createHousePickups = true;
|
||||
}
|
||||
getServerConfig().createHouseBlips = !getServerConfig().createHouseBlips;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHouseBlipsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHouseBlips))} {MAINCOLOUR}all house blips`);
|
||||
@@ -607,13 +571,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerHousePickupsCommand(command, params, client) {
|
||||
if(doesServerHaveHousePickupsEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||
getServerConfig().createHousePickups = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||
getServerConfig().createHousePickups = true;
|
||||
}
|
||||
getServerConfig().createHousePickups = !getServerConfig().createHousePickups;
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned ${getBoolRedGreenInlineColour(doesServerHaveHousePickupsEnabled())}${toUpperCase(getOnOffFromBool(getServerConfig().createHousePickups))} {MAINCOLOUR}all house pickups`);
|
||||
@@ -633,13 +591,7 @@ function toggleServerLogoCommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerGUICommand(command, params, client) {
|
||||
if(doesServerHaveGUIEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||
getServerConfig().useGUI = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||
getServerConfig().useGUI = true;
|
||||
}
|
||||
getServerConfig().useGUI = !getServerConfig().useGUI;
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
@@ -660,17 +612,11 @@ function toggleServerGUICommand(command, params, client) {
|
||||
*
|
||||
*/
|
||||
function toggleServerUseRealWorldTimeCommand(command, params, client) {
|
||||
if(doesServerHaveRealTimeEnabled()) {
|
||||
getServerConfig().settings = removeBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||
getServerConfig().useRealTime = false;
|
||||
} else {
|
||||
getServerConfig().settings = addBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||
getServerConfig().useRealTime = true;
|
||||
}
|
||||
getServerConfig().useRealTime = !getServerConfig().useRealTime;
|
||||
|
||||
getServerConfig().needsSaved = true;
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${toLowerCase(getOnOffFromBool(doesServerHaveRealTimeEnabled()))} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
messageAdminAction(`${getPlayerName(client)} {MAINCOLOUR}turned real-world time ${getServerConfig().useRealTime} for this server (GMT ${addPositiveNegativeSymbol(getServerConfig().realTimeZone)})`);
|
||||
updateServerGameTime();
|
||||
updateServerRules();
|
||||
return true;
|
||||
@@ -803,67 +749,67 @@ function loadAccentConfig() {
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveGUIEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GUI"));
|
||||
return getServerConfig().useGUI;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveTesterOnlyEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("Testing"));
|
||||
return getServerConfig().testerOnly;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveRealTimeEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("RealTime"));
|
||||
return getServerConfig().useRealTime;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveBusinessPickupsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessPickups"));
|
||||
return getServerConfig().createBusinessPickups
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveHousePickupsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HousePickups"));
|
||||
return getServerConfig().createHousePickups;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveJobPickupsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobPickups"));
|
||||
return getServerConfig().createJobPickups;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveBusinesBlipsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("BusinessBlips"));
|
||||
return getServerConfig().createBusinessBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveHouseBlipsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("HouseBlips"));
|
||||
return getServerConfig().createHouseBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveJobBlipsEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("JobBlips"));
|
||||
return getServerConfig().createJobBlips;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveFallingSnowEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("FallingSnow"));
|
||||
return getServerConfig().fallingSnow;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function doesServerHaveGroundSnowEnabled() {
|
||||
return hasBitFlag(getServerConfig().settings, getServerSettingsFlagValue("GroundSnow"));
|
||||
return getServerConfig().groundSnow;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
let scriptVersion = "1.0";
|
||||
let serverStartTime = 0;
|
||||
let logLevel = LOG_ERROR|LOG_WARN|LOG_INFO;
|
||||
let logLevel = LOG_INFO;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -25,8 +25,8 @@ let serverData = {
|
||||
itemTypes: [],
|
||||
clans: [],
|
||||
antiCheat: {
|
||||
whiteListedGameScripts: [],
|
||||
blackListedGameScripts: [],
|
||||
//whiteListedGameScripts: [],
|
||||
//blackListedGameScripts: [],
|
||||
},
|
||||
localeStrings: {},
|
||||
cachedTranslations: [],
|
||||
|
||||
@@ -408,7 +408,7 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestJail.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestJail.dimension;
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
spawnPlayer(client, closestJail.position, closestJail.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
@@ -421,7 +421,7 @@ function onPlayerDeath(client, position) {
|
||||
client.despawnPlayer();
|
||||
getPlayerCurrentSubAccount(client).interior = closestHospital.interior;
|
||||
getPlayerCurrentSubAccount(client).dimension = closestHospital.dimension;
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameData().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
spawnPlayer(client, closestHospital.position, closestHospital.heading, getGameConfig().skins[getGame()][getPlayerCurrentSubAccount(client).skin][0]);
|
||||
|
||||
if(isFadeCameraSupported()) {
|
||||
fadeCamera(client, true, 1.0);
|
||||
@@ -596,6 +596,14 @@ function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||
updateAllPlayerNameTags();
|
||||
|
||||
if(!areServerElementsSupported()) {
|
||||
sendAllBusinessEntrancesToPlayer(client);
|
||||
sendAllHouseEntrancesToPlayer(client);
|
||||
//sendAllJobLocationsToPlayer(client);
|
||||
}
|
||||
|
||||
requestPlayerPedNetworkId(client);
|
||||
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -873,6 +873,7 @@ function createHouseEntrancePickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
||||
}
|
||||
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
@@ -897,15 +898,17 @@ function createHouseEntranceBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).entranceBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).entranceBlip, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).entranceBlip = createGameBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).entranceBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entranceBlip, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).entranceBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).entranceBlip, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,13 +927,16 @@ function createHouseExitPickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).exitPickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).exitPickup, false);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitPickup = createGamePickup(pickupModelId, getHouseData(houseId).exitPosition, getGameConfig().pickupTypes[getServerGame()].house);
|
||||
setElementDimension(getHouseData(houseId).exitPickup, getHouseData(houseId).exitDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitPickup, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).exitPickup, getGlobalConfig().housePickupStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).exitPickup, false);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
}
|
||||
updateHousePickupLabelData(houseId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -950,15 +956,17 @@ function createHouseExitBlip(houseId) {
|
||||
blipModelId = getHouseData(houseId).exitBlipModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
if(areServerElementsSupported()) {
|
||||
getHouseData(houseId).exitBlip = createGameBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
setElementDimension(getHouseData(houseId).exitBlip, getHouseData(houseId).entranceDimension);
|
||||
setElementOnAllDimensions(getHouseData(houseId).exitBlip, false);
|
||||
setElementStreamInDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamInDistance);
|
||||
setElementStreamOutDistance(getBusinessData(businessId).exitBlip, getGlobalConfig().houseBlipStreamOutDistance);
|
||||
setElementTransient(getHouseData(houseId).exitBlip, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1140,6 +1148,10 @@ function doesHouseHaveInterior(houseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseEntrancePickup(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getHouseData(houseId).entrancePickup != null) {
|
||||
//removeFromWorld(getHouseData(houseId).entrancePickup);
|
||||
deleteGameElement(getHouseData(houseId).entrancePickup);
|
||||
@@ -1150,6 +1162,10 @@ function deleteHouseEntrancePickup(houseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseExitPickup(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getHouseData(houseId).exitPickup != null) {
|
||||
//removeFromWorld(getHouseData(houseId).exitPickup);
|
||||
deleteGameElement(getHouseData(houseId).exitPickup);
|
||||
@@ -1160,6 +1176,10 @@ function deleteHouseExitPickup(houseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseEntranceBlip(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getHouseData(houseId).entranceBlip != null) {
|
||||
//removeFromWorld(getHouseData(houseId).entranceBlip);
|
||||
deleteGameElement(getHouseData(houseId).entranceBlip);
|
||||
@@ -1170,6 +1190,10 @@ function deleteHouseEntranceBlip(houseId) {
|
||||
// ===========================================================================
|
||||
|
||||
function deleteHouseExitBlip(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getHouseData(houseId).exitBlip != null) {
|
||||
//removeFromWorld(getHouseData(houseId).exitBlip);
|
||||
deleteGameElement(getHouseData(houseId).exitBlip);
|
||||
@@ -1265,19 +1289,19 @@ function getHouseIdFromDatabaseId(databaseId) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function sendPlayerHouseGameScripts(client, houseId) {
|
||||
for(let i in getHouseData(houseId).gameScripts) {
|
||||
sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
|
||||
}
|
||||
}
|
||||
//function sendPlayerHouseGameScripts(client, houseId) {
|
||||
// for(let i in getHouseData(houseId).gameScripts) {
|
||||
// sendPlayerGameScriptState(client, getHouseData(houseId).gameScripts[i].state);
|
||||
// }
|
||||
//}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function clearPlayerHouseGameScripts(client, houseId) {
|
||||
for(let i in getHouseData(houseId).gameScripts) {
|
||||
sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
|
||||
}
|
||||
}
|
||||
//function clearPlayerHouseGameScripts(client, houseId) {
|
||||
// for(let i in getHouseData(houseId).gameScripts) {
|
||||
// sendPlayerGameScriptState(client, VRR_GAMESCRIPT_DENY);
|
||||
// }
|
||||
//}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -1411,6 +1435,10 @@ function getHouseFromParams(params) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateHousePickupLabelData(houseId) {
|
||||
if(!areServerElementsSupported()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let houseData = getHouseData(houseId);
|
||||
|
||||
if(houseData.entrancePickup != null) {
|
||||
|
||||
@@ -1732,7 +1732,7 @@ function getItemValueDisplay(itemType, value) {
|
||||
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_WALKIETALKIE) {
|
||||
return toString(toString(value).slice(0,-2)+"."+toString(value).slice(-1)+"MHz");
|
||||
} else if(getItemTypeData(itemType).useType == VRR_ITEM_USETYPE_VEHCOLOUR) {
|
||||
return `[${getGameData().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
|
||||
return `[${getGameConfig().vehicleColourHex[value]}]SAMPLE[#FFFFFF]`;
|
||||
} else {
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -962,8 +962,8 @@ function createJob(name) {
|
||||
tempJobData.name = name;
|
||||
tempJobData.enabled = true;
|
||||
tempJobData.needsSaved = true;
|
||||
tempJobData.blipModel = getGameData().blipSprites[getGame()].job;
|
||||
tempJobData.pickupModel = getGameData().pickupModels[getGame()].job;
|
||||
tempJobData.blipModel = getGameConfig().blipSprites[getGame()].job;
|
||||
tempJobData.pickupModel = getGameConfig().pickupModels[getGame()].job;
|
||||
|
||||
getServerData().jobs.push(tempJobData);
|
||||
saveJobToDatabase(tempJobData);
|
||||
|
||||
@@ -120,40 +120,70 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
let isEntrance = false;
|
||||
let isBusiness = false;
|
||||
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
switch(ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_BUSINESS_EXIT:
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_EXIT:
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
default:
|
||||
if(areServerElementsSupported()) {
|
||||
if(!getPlayerData(client).currentPickup) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let ownerType = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.type");
|
||||
let ownerId = getEntityData(getPlayerData(client).currentPickup, "vrr.owner.id");
|
||||
|
||||
switch(ownerType) {
|
||||
case VRR_PICKUP_BUSINESS_ENTRANCE:
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_BUSINESS_EXIT:
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_ENTRANCE:
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
case VRR_PICKUP_HOUSE_EXIT:
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().houses[ownerId];
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
for(let i in getServerData().businesses) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
|
||||
let businessId = getClosestBusinessEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
} else {
|
||||
let businessId = getClosestBusinessExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = true;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[businessId];
|
||||
}
|
||||
}
|
||||
|
||||
for(let j in getServerData().houses) {
|
||||
if(getPlayerDimension(client) == getGameConfig().mainWorldDimension[getGame()] && getPlayerInterior(client) == getGameConfig().mainWorldInterior[getGame()]) {
|
||||
let houseId = getClosestHouseEntrance(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = true;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
} else {
|
||||
let houseId = getClosestHouseExit(getPlayerPosition(client), getPlayerDimension(client));
|
||||
isBusiness = false;
|
||||
isEntrance = false;
|
||||
closestProperty = getServerData().businesses[houseId];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(closestProperty == null) {
|
||||
@@ -451,7 +481,7 @@ function gpsCommand(command, params, client) {
|
||||
} else {
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
if(gameLocationId != false) {
|
||||
position = getGameData().locations[getServerGame()][gameLocationId][1]
|
||||
position = getGameConfig().locations[getServerGame()][gameLocationId][1]
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -548,8 +578,8 @@ function stuckPlayerCommand(command, params, client) {
|
||||
}
|
||||
} else {
|
||||
setPlayerDimension(client, 1);
|
||||
setPlayerDimension(client, getGameData().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameData().mainWorldInterior[getGame()]);
|
||||
setPlayerDimension(client, getGameConfig().mainWorldDimension[getGame()]);
|
||||
setPlayerInterior(client, getGameConfig().mainWorldInterior[getGame()]);
|
||||
setPlayerPosition(client, getPosAbovePos(getPlayerPosition(client), 2.0));
|
||||
}
|
||||
|
||||
|
||||
@@ -207,11 +207,11 @@ function removePlayerFromVehicle(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerSkin(client, skinIndex) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameData().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameData().skins[getGame()][skinIndex][1]})`);
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s skin to ${getGameConfig().skins[getGame()][skinIndex][0]} (Index: ${skinIndex}, Name: ${getGameConfig().skins[getGame()][skinIndex][1]})`);
|
||||
if(getGame() == VRR_GAME_GTA_IV) {
|
||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameData().skins[getGame()][skinIndex][0]);
|
||||
triggerNetworkEvent("vrr.localPlayerSkin", client, getGameConfig().skins[getGame()][skinIndex][0]);
|
||||
} else {
|
||||
client.player.modelIndex = getGameData().skins[getGame()][skinIndex][0];
|
||||
client.player.modelIndex = getGameConfig().skins[getGame()][skinIndex][0];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -429,7 +429,7 @@ function createGameObject(modelIndex, position) {
|
||||
if(!isGameFeatureSupported("objects")) {
|
||||
return false;
|
||||
}
|
||||
return game.createObject(getGameData().objects[getGame()][modelIndex][0], position);
|
||||
return game.createObject(getGameConfig().objects[getGame()][modelIndex][0], position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -451,7 +451,7 @@ function destroyGameElement(element) {
|
||||
// ===========================================================================
|
||||
|
||||
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
|
||||
return (getGameData().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||
return (getGameConfig().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -539,7 +539,7 @@ function setVehicleColours(vehicle, colour1, colour2, colour3 = -1, colour4 = -1
|
||||
// ===========================================================================
|
||||
|
||||
function createGameVehicle(modelIndex, position, heading) {
|
||||
return game.createVehicle(getGameData().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
return game.createVehicle(getGameConfig().vehicles[getGame()][modelIndex][0], position, heading);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -590,7 +590,7 @@ function setPlayerFightStyle(client, fightStyleId) {
|
||||
return false;
|
||||
}
|
||||
|
||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameData().fightStyles[getServerGame()][fightStyleId][1][0], getGameData().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
||||
setEntityData(getPlayerElement(client), "vrr.fightStyle", [getGameConfig().fightStyles[getServerGame()][fightStyleId][1][0], getGameConfig().fightStyles[getServerGame()][fightStyleId][1][1]]);
|
||||
forcePlayerToSyncElementProperties(null, getPlayerElement(client));
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ function setStaffTitleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(getParam(params, " ", 1));
|
||||
let staffTitle = splitParams.slice(1).join(" ");
|
||||
|
||||
@@ -374,19 +374,19 @@ function gotoGameLocationCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0));
|
||||
setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
|
||||
setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
|
||||
setPlayerInterior(client, 0);
|
||||
setPlayerDimension(client, 0);
|
||||
updateInteriorLightsForPlayer(client, true);
|
||||
|
||||
//setTimeout(function() {
|
||||
// setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
|
||||
// setPlayerPosition(client, getGameConfig().locations[getServerGame()][gameLocationId][1]);
|
||||
// setPlayerInterior(client, 0);
|
||||
// setPlayerDimension(client, 0);
|
||||
// updateInteriorLightsForPlayer(client, true);
|
||||
//}, 500);
|
||||
|
||||
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameData().locations[getServerGame()][gameLocationId][0]}`);
|
||||
messagePlayerSuccess(client, `You teleported to game location {ALTCOLOUR}${getGameConfig().locations[getServerGame()][gameLocationId][0]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -999,7 +999,7 @@ function forcePlayerSkinCommand(command, params, client) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getPlayerFromParams(splitParams[0]);
|
||||
let skinIndex = getSkinModelIndexFromParams(splitParams.slice(1).join(" "), getGame());
|
||||
|
||||
@@ -1008,15 +1008,15 @@ function forcePlayerSkinCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(skinIndex == false) {
|
||||
messagePlayerError(client, "That skin is invalid!");
|
||||
if(!skinIndex) {
|
||||
messagePlayerError(client, getLocaleString(client, "InvalidSkin"));
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(targetClient).skin = skinIndex;
|
||||
setPlayerSkin(targetClient, skinIndex);
|
||||
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
|
||||
messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s{MAINCOLOUR} skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1032,7 +1032,7 @@ function setPlayerHealthCommand(command, params, client) {
|
||||
// return false;
|
||||
//}
|
||||
|
||||
let splitParams = params.split("");
|
||||
let splitParams = params.split(" ");
|
||||
let targetClient = getParam(params, " ", 1);
|
||||
let health = getParam(params, " ", 2);
|
||||
|
||||
@@ -1112,7 +1112,7 @@ function forcePlayerWantedLevelCommand(command, params, client) {
|
||||
|
||||
forcePlayerWantedLevel(targetClient, wantedLevel);
|
||||
|
||||
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameData().skins[getGame()][skinIndex][1]}`);
|
||||
//messageAdmins(`${getPlayerName(client)} {MAINCOLOUR}set ${getPlayerName(targetClient)}'s {MAINCOLOUR}skin to {ALTCOLOUR}${getGameConfig().skins[getGame()][skinIndex][1]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -40,11 +40,12 @@ function initServerScripts() {
|
||||
initLocaleScript();
|
||||
|
||||
initCommandScript();
|
||||
initTimers();
|
||||
|
||||
serverStartTime = getCurrentUnixTimestamp();
|
||||
|
||||
initAllClients();
|
||||
|
||||
initTimers();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -237,7 +237,7 @@ function showCharacterSelectToClient(client) {
|
||||
let tempSubAccount = getPlayerData(client).subAccounts[0];
|
||||
let ClanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, ClanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
//spawnPlayer(client, getServerConfig().characterSelectPedPosition, getServerConfig().characterSelectPedHeading, getPlayerCurrentSubAccount(client).skin, getServerConfig().characterSelectInterior, getServerConfig().characterSelectDimension);
|
||||
//setTimeout(function() {
|
||||
@@ -321,7 +321,7 @@ function checkPreviousCharacter(client) {
|
||||
|
||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
}
|
||||
@@ -342,7 +342,7 @@ function checkNextCharacter(client) {
|
||||
|
||||
let clanName = (tempSubAccount.clan != 0) ? getClanData(getClanIdFromDatabaseId(tempSubAccount.clan)).name : "None";
|
||||
let lastPlayedText = (tempSubAccount.lastLogin != 0) ? `${msToTime(getCurrentUnixTimestamp()-tempSubAccount.lastLogin)} ago` : "Never";
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameData().skins[getGame()][tempSubAccount.skin][0]);
|
||||
showPlayerCharacterSelectGUI(client, tempSubAccount.firstName, tempSubAccount.lastName, tempSubAccount.cash, clanName, lastPlayedText, getGameConfig().skins[getGame()][tempSubAccount.skin][0]);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.SubAccount] Setting ${getPlayerDisplayForConsole(client)}'s character to ID ${getPlayerData(client).currentSubAccount}`);
|
||||
}
|
||||
@@ -372,11 +372,16 @@ function selectCharacter(client, characterId = -1) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_SPAWNING;
|
||||
|
||||
if(getGame() < VRR_GAME_GTA_IV) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameData().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
spawnPlayer(client, spawnPosition, spawnHeading, getGameConfig().skins[getGame()][skin][0], spawnInterior, spawnDimension);
|
||||
//setPlayerSkin(client, skin);
|
||||
//setPlayerPosition(client, spawnPosition);
|
||||
//setPlayerHeading(client, spawnHeading);
|
||||
//setPlayerInterior(client, spawnInterior);
|
||||
//setPlayerDimension(client, spawnDimension);
|
||||
} else if(getGame() >= VRR_GAME_MAFIA_ONE) {
|
||||
spawnPlayer(client, getGameData().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||
spawnPlayer(client, getGameConfig().skins[getGame()][skin][0], spawnPosition, spawnHeading);
|
||||
}
|
||||
|
||||
removePlayerKeyBind(client, getKeyIdFromParams("insert"));
|
||||
@@ -481,6 +486,11 @@ function isPlayerCreatingCharacter(client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {SubAccountData} - The player's current subaccount/character data
|
||||
*
|
||||
*/
|
||||
function getPlayerCurrentSubAccount(client) {
|
||||
if(!getPlayerData(client)) {
|
||||
return false;
|
||||
@@ -517,7 +527,7 @@ function setFightStyleCommand(command, params, client) {
|
||||
|
||||
if(!fightStyle) {
|
||||
messagePlayerError(client, `That fight style doesn't exist!`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -529,7 +539,7 @@ function setFightStyleCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setPlayerFightStyle(client, fightStyleId);
|
||||
messagePlayerSuccess(client, `Your fight style has been set to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
messagePlayerSuccess(client, `Your fight style has been set to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -562,13 +572,13 @@ function forceFightStyleCommand(command, params, client) {
|
||||
|
||||
if(!fightStyleId) {
|
||||
messagePlayerError(client, `That fight style doesn't exist!`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameData().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
messagePlayerError(client, `Fight styles: ${getGameConfig().fightStyles[getServerGame()].map(fs => fs[0]).join(", ")}`);
|
||||
return false;
|
||||
}
|
||||
|
||||
getPlayerCurrentSubAccount(client).fightStyle = fightStyleId;
|
||||
setPlayerFightStyle(client, fightStyleId);
|
||||
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameData().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
messagePlayerSuccess(client, `You set ${getCharacterFullName(targetClient)}'s fight style to ${getGameConfig().fightStyles[getServerGame()][fightStyleId][0]}`)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,14 +11,6 @@ let serverTimers = {};
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateTimeRule() {
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function saveAllServerDataToDatabase() {
|
||||
if(getServerConfig().pauseSavingToDatabase) {
|
||||
return false;
|
||||
@@ -136,14 +128,16 @@ function vehicleRentCheck() {
|
||||
// Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected)
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerData(clients[i]) != false) {
|
||||
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
|
||||
if(getPlayerData(clients[i]).rentingVehicle != false) {
|
||||
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
|
||||
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
|
||||
stopRentingVehicle(clients[i]);
|
||||
} else {
|
||||
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
|
||||
if(isClientInitialized(clients[i])) {
|
||||
if(getPlayerData(clients[i]) != false) {
|
||||
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
|
||||
if(getPlayerData(clients[i]).rentingVehicle != false) {
|
||||
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
|
||||
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
|
||||
stopRentingVehicle(clients[i]);
|
||||
} else {
|
||||
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -176,10 +170,12 @@ function vehicleRentCheck() {
|
||||
function updatePings() {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(!clients[i].console) {
|
||||
updatePlayerPing(clients[i]);
|
||||
if(isPlayerSpawned(clients[i])) {
|
||||
updatePlayerCash(clients[i]);
|
||||
if(isClientInitialized(clients[i])) {
|
||||
if(!clients[i].console) {
|
||||
updatePlayerPing(clients[i]);
|
||||
if(isPlayerSpawned(clients[i])) {
|
||||
updatePlayerCash(clients[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -188,7 +184,7 @@ function updatePings() {
|
||||
// ===========================================================================
|
||||
|
||||
function checkServerGameTime() {
|
||||
if(!getServerConfig().useRealTime) {
|
||||
//if(!getServerConfig().useRealTime) {
|
||||
if(getServerConfig().minute >= 59) {
|
||||
getServerConfig().minute = 0;
|
||||
if(getServerConfig().hour >= 23) {
|
||||
@@ -199,11 +195,11 @@ function checkServerGameTime() {
|
||||
} else {
|
||||
getServerConfig().minute = getServerConfig().minute + 1;
|
||||
}
|
||||
} else {
|
||||
let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
|
||||
getServerConfig().hour = dateTime.getHours();
|
||||
getServerConfig().minute = dateTime.getMinutes();
|
||||
}
|
||||
//} else {
|
||||
// let dateTime = getCurrentTimeStampWithTimeZone(getServerConfig().realTimeZone);
|
||||
// getServerConfig().hour = dateTime.getHours();
|
||||
// getServerConfig().minute = dateTime.getMinutes();
|
||||
//}
|
||||
|
||||
updateTimeRule();
|
||||
}
|
||||
@@ -213,14 +209,16 @@ function checkServerGameTime() {
|
||||
function checkPayDays() {
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||
getPlayerData(clients[i]).payDayStart = sdl.ticks;
|
||||
playerPayDay(clients[i]);
|
||||
if(isClientInitialized(clients[i])) {
|
||||
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||
getPlayerData(clients[i]).payDayStart = sdl.ticks;
|
||||
playerPayDay(clients[i]);
|
||||
|
||||
//if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) {
|
||||
// getPlayerData(clients[i]).payDayStart = sdl.ticks;
|
||||
// playerPayDay(clients[i]);
|
||||
//}
|
||||
//if(sdl.ticks-getPlayerData(clients[i]).payDayTickStart >= getGlobalConfig().payDayTickCount) {
|
||||
// getPlayerData(clients[i]).payDayStart = sdl.ticks;
|
||||
// playerPayDay(clients[i]);
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,9 +236,11 @@ function showRandomTipToAllPlayers() {
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
||||
messagePlayerTimedRandomTip(null, randomTips[tipId]);
|
||||
if(isClientInitialized(clients[i])) {
|
||||
if(isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||
if(!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
||||
messagePlayerTimedRandomTip(null, randomTips[tipId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ function getAreaName(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getGameAreas(gameId) {
|
||||
return getGameData().areas[gameId];
|
||||
return getGameConfig().areas[gameId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -63,7 +63,9 @@ function getGameAreas(gameId) {
|
||||
*/
|
||||
function getPlayerData(client) {
|
||||
if(client != null) {
|
||||
return getServerData().clients[client.index];
|
||||
if(isClientInitialized(client)) {
|
||||
return getServerData().clients[client.index];
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -79,30 +81,46 @@ function initAllClients() {
|
||||
// ===========================================================================
|
||||
|
||||
function updateServerRules() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Updating all server rules ...`);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Time support: ${isTimeSupported()}`);
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(getServerConfig().hour, getServerConfig().minute));
|
||||
if(getServerConfig() != false) {
|
||||
let value = makeReadableTime(getServerConfig().hour, getServerConfig().minute);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Time" as ${value}`);
|
||||
server.setRule("Time", value);
|
||||
}
|
||||
}
|
||||
|
||||
if(isWeatherSupported()) {
|
||||
server.setRule("Weather", getGameData().weatherNames[getServerGame()][getServerConfig().weather]);
|
||||
if(getServerConfig() != false) {
|
||||
let value = getGameConfig().weatherNames[getServerGame()][getServerConfig().weather];
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Weather" as ${value}`);
|
||||
server.setRule("Weather", value);
|
||||
}
|
||||
}
|
||||
|
||||
if(isSnowSupported()) {
|
||||
server.setRule("Snowing", getYesNoFromBool(getServerConfig().fallingSnow));
|
||||
if(getServerConfig() != false) {
|
||||
let value = getYesNoFromBool(getServerConfig().fallingSnow);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: Setting server rule "Snowing" as ${value}`);
|
||||
server.setRule("Snowing", value);
|
||||
}
|
||||
}
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities]: All server rules updated successfully!`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getWeatherFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().weatherNames[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().weatherNames[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().weatherNames[getServerGame()][i]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().weatherNames[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().weatherNames[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
@@ -114,13 +132,13 @@ function getWeatherFromParams(params) {
|
||||
|
||||
function getFightStyleFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().fightStyles[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
for(let i in getGameConfig().fightStyles[getServerGame()]) {
|
||||
if(toLowerCase(getGameConfig().fightStyles[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().fightStyles[getServerGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().fightStyles[getServerGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
@@ -132,26 +150,26 @@ function getFightStyleFromParams(params) {
|
||||
|
||||
function getClosestHospital(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameData().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameData().hospitals[getServerGame()][i].position, position) < getDistance(getGameData().hospitals[getServerGame()][closest].position, position)) {
|
||||
for(let i in getGameConfig().hospitals[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().hospitals[getServerGame()][i].position, position) < getDistance(getGameConfig().hospitals[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
|
||||
return getGameData().hospitals[getServerGame()][closest];
|
||||
return getGameConfig().hospitals[getServerGame()][closest];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getClosestPoliceStation(position) {
|
||||
let closest = 0;
|
||||
for(let i in getGameData().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameData().policeStations[getServerGame()][i].position, position) < getDistance(getGameData().policeStations[getServerGame()][closest].position, position)) {
|
||||
for(let i in getGameConfig().policeStations[getServerGame()]) {
|
||||
if(getDistance(getGameConfig().policeStations[getServerGame()][i].position, position) < getDistance(getGameConfig().policeStations[getServerGame()][closest].position, position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
|
||||
return getGameData().policeStations[getServerGame()][closest];
|
||||
return getGameConfig().policeStations[getServerGame()][closest];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -190,8 +208,8 @@ function getPlayerIsland(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function isAtPayAndSpray(position) {
|
||||
for(let i in getGameData().payAndSprays[getServerGame()]) {
|
||||
if(getDistance(position, getGameData().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
|
||||
for(let i in getGameConfig().payAndSprays[getServerGame()]) {
|
||||
if(getDistance(position, getGameConfig().payAndSprays[getServerGame()][i]) <= getGlobalConfig().payAndSprayDistance) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -265,6 +283,7 @@ function showConnectCameraToPlayer(client) {
|
||||
//setPlayerDimension(client, 0);
|
||||
setPlayerCameraLookAt(client, getServerConfig().connectCameraPosition, getServerConfig().connectCameraLookAt);
|
||||
}
|
||||
setPlayer2DRendering(client, false, false, false, false, false, false);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -429,4 +448,20 @@ function kickAllClients() {
|
||||
getClients().forEach((client) => {
|
||||
client.disconnect();
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateTimeRule() {
|
||||
if(isTimeSupported()) {
|
||||
server.setRule("Time", makeReadableTime(game.time.hour, game.time.minute));
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isClientInitialized(client) {
|
||||
return (typeof getServerData().clients[client.index] != "undefined");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -82,10 +82,10 @@ const VRR_MPMOD_GTAC = 1;
|
||||
const VRR_MPMOD_MAFIAC = 2;
|
||||
|
||||
// Business/House Game Script States
|
||||
const VRR_GAMESCRIPT_NONE = 0;
|
||||
const VRR_GAMESCRIPT_DENY = 1;
|
||||
const VRR_GAMESCRIPT_ALLOW = 2;
|
||||
const VRR_GAMESCRIPT_FORCE = 3;
|
||||
//const VRR_GAMESCRIPT_NONE = 0;
|
||||
//const VRR_GAMESCRIPT_DENY = 1;
|
||||
//const VRR_GAMESCRIPT_ALLOW = 2;
|
||||
//const VRR_GAMESCRIPT_FORCE = 3;
|
||||
|
||||
// Vehicle Purchase States
|
||||
const VRR_VEHBUYSTATE_NONE = 0;
|
||||
|
||||
@@ -2541,7 +2541,7 @@ let gameData = {
|
||||
[594, "BeerCan"],
|
||||
[592, "BottleYellow"],
|
||||
[500, "ArmourVest"],
|
||||
[510, "PizzzBox"],
|
||||
[510, "PizzaBox"],
|
||||
[597, "SodaBottle"],
|
||||
[502, "GenericPackage2"]
|
||||
],
|
||||
@@ -2603,7 +2603,9 @@ let gameData = {
|
||||
[2601, "CanSoda"],
|
||||
],
|
||||
[], // GTA UG
|
||||
[], // GTA IV
|
||||
[
|
||||
// GTA IV
|
||||
],
|
||||
[], // GTA IV EFLC
|
||||
[], // INVALID
|
||||
[], // INVALID
|
||||
@@ -2849,7 +2851,7 @@ let gameData = {
|
||||
["South Bohan Police Station", [435.40, 1592.29, 17.353], 3.087, null],
|
||||
["Northern Gardens Police Station", [974.93, 1870.45, 23.073], -1.621, null],
|
||||
["South Slopes Police Station", [1233.25, -89.13, 28.034], 1.568, null],
|
||||
["Middle Part East Police Station", [50.12, 679.88, 15.316], 1.569, null],
|
||||
["Middle Park East Police Station", [50.12, 679.88, 15.316], 1.569, null],
|
||||
["East Holland Police Station", [85.21, 1189.82, 14.755], 3.127, null],
|
||||
["Francis International Airport Police Station", [2170.87, 448.87, 6.085], 1.501, null],
|
||||
["Chinatown Police Station", [213.12, -211.70, 10.752], 0.200, null],
|
||||
@@ -3318,10 +3320,18 @@ let gameData = {
|
||||
],
|
||||
meleeWeapons: [
|
||||
[],
|
||||
[1],
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
[],
|
||||
[1], // III
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11], // VC
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15], // SA
|
||||
[], // UG
|
||||
[1, 3], // IV
|
||||
[], // Invalid
|
||||
[], // Invalid
|
||||
[], // Invalid
|
||||
[], // M1
|
||||
[], // M2
|
||||
[], // M3
|
||||
[], // M1DE
|
||||
],
|
||||
blipSprites: [
|
||||
false,
|
||||
@@ -3405,15 +3415,25 @@ let gameData = {
|
||||
Clothes: 50,
|
||||
Pizza: 0,
|
||||
Chicken: 22,
|
||||
Burger: 10,
|
||||
Burger: 21,
|
||||
Bar: 47,
|
||||
Club: 48,
|
||||
Club: 51,
|
||||
Gym: 54,
|
||||
RepairGarage: 75,
|
||||
Trophy: 81,
|
||||
Race: 65,
|
||||
Job: 80,
|
||||
Misc: 0,
|
||||
ComedyClub: 70,
|
||||
CabaretClub: 71,
|
||||
Ransom: 72,
|
||||
StripClub: 66,
|
||||
Male: 63,
|
||||
Female: 64,
|
||||
TrainStation: 58,
|
||||
Heart: 54,
|
||||
Bowling: 49,
|
||||
Internet: 24,
|
||||
},
|
||||
],
|
||||
pickupModels: [
|
||||
@@ -3488,6 +3508,24 @@ let gameData = {
|
||||
{
|
||||
// GTA Underground
|
||||
},
|
||||
{ // GTA IV
|
||||
PoliceStation: -1,
|
||||
FireStation: -1,
|
||||
Hospital: -1,
|
||||
Ammunation: -1,
|
||||
PayAndSpray: -1,
|
||||
VehicleDealership: -1,
|
||||
Restaurant: -1,
|
||||
FastFood: -1,
|
||||
Bank: -1,
|
||||
FuelStation: -1,
|
||||
Business: -1,
|
||||
House: -1,
|
||||
Clothes: -1,
|
||||
Misc: -1,
|
||||
Exit: -1,
|
||||
Job: -1,
|
||||
}
|
||||
],
|
||||
pickupTypes: [
|
||||
{},
|
||||
@@ -3517,7 +3555,18 @@ let gameData = {
|
||||
clothes: 1,
|
||||
info: 1,
|
||||
job: 1,
|
||||
}
|
||||
},
|
||||
{
|
||||
// GTA Underground
|
||||
},
|
||||
{ // GTA IV
|
||||
business: -1,
|
||||
house: -1,
|
||||
bank: -1,
|
||||
clothes: -1,
|
||||
info: -1,
|
||||
job: -1,
|
||||
}
|
||||
],
|
||||
|
||||
// THIS IS SCREEN HEIGHT, NOT ACTUAL DOOR POSITION IN THE WORLD
|
||||
@@ -3977,7 +4026,7 @@ let gameData = {
|
||||
},
|
||||
{}, // GTA UG
|
||||
{ // GTA IV
|
||||
clothingStore: [
|
||||
ClothingStore: [
|
||||
["Outfit", 500, 2]
|
||||
],
|
||||
LegalGunStore: [
|
||||
@@ -3997,8 +4046,8 @@ let gameData = {
|
||||
["M4", 500, 2],
|
||||
["Beretta Shotgun", 500, 2],
|
||||
["Sniper Rifle", 500, 2],
|
||||
["Micro Uzi Ammo", 500, 2],
|
||||
["MP5 Ammo", 500, 2],
|
||||
["Micro Uzi Ammo", 500, 2],
|
||||
["AK-47 Ammo", 500, 2],
|
||||
["M4 Ammo", 500, 2],
|
||||
["Beretta Shotgun Ammo", 500, 2],
|
||||
@@ -4386,7 +4435,34 @@ let gameData = {
|
||||
},
|
||||
|
||||
{ // GTA IV
|
||||
|
||||
Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
|
||||
House1: [toVector3(-426.16, 1466.52, 38.971), 0],
|
||||
House2: [toVector3(-969.77, 883.27, 18.817), 0],
|
||||
House3: [toVector3(95.75, 851.68, 45.051), 0],
|
||||
House4: [toVector3(603.04, 1404.06, 17.479), 0],
|
||||
House5: [toVector3(892.56, -502.13, 19.407), 0],
|
||||
House6: [toVector3(-524.09, 830.54, 23.627), 0],
|
||||
House7: [toVector3(806.36, 146.68, 29.243), 0],
|
||||
House8: [toVector3(356.91, 1511.28, 21.432), 0],
|
||||
House9: [toVector3(1319.40, -847.02, 8.872), 0],
|
||||
House10: [toVector3(1331.40, 126.60, 36.558), 0],
|
||||
House11: [toVector3(1387.81, 622.66, 35.857), 0],
|
||||
House12: [toVector3(932.74, -189.29, 35.143), 0],
|
||||
House13: [toVector3(-1397.85, 1473.89, 26.447), 0],
|
||||
House14: [toVector3(806.36, 146.68, 29.243), 0],
|
||||
House15: [toVector3(-526.49, 829.41, 23.627), 0],
|
||||
Gym: [toVector3(403.31, 1480.32, 11.834), 0],
|
||||
PoliceStation: [toVector3(-406.52, 286.57, 13.682), 0],
|
||||
FancyRestaurant: [toVector3(-118.24, -259.06, 12.654), 0],
|
||||
Basement: [toVector3(1304.38, -856.66, 5.490), 0],
|
||||
Office1: [toVector3(-409.31, 285.49, 18.592), 0],
|
||||
Office2: [toVector3(-1153.30, 417.37, 5.578), 0],
|
||||
Office3: [toVector3(817.64, -259.77, 15.343), 0],
|
||||
Office4: [toVector3(-86.35, 56.70, 75.953), 0],
|
||||
HospitalRoom: [toVector3(1240.00, 192.44, 33.553), 0],
|
||||
Church: [toVector3(-286.72, -282.36, 15.632), 0],
|
||||
Prison: [toVector3(-1082.69, -364.05, 7.404), 0],
|
||||
Ship: [toVector3(-336.53, -1494.56, 9.945), 0],
|
||||
},
|
||||
|
||||
{}, // GTA IV EFLC
|
||||
@@ -5353,5 +5429,21 @@ let gameData = {
|
||||
0, // Mafia 3
|
||||
0, // Mafia Definitive Edition
|
||||
],
|
||||
mainWorldInterior: [
|
||||
0, // Invalid
|
||||
0, // GTA 3
|
||||
0, // GTA VC
|
||||
0, // GTA SA
|
||||
0, // GTA UG
|
||||
0, // GTA IV
|
||||
0, // GTA IV EFLC
|
||||
0, // Invalid
|
||||
0, // Invalid
|
||||
0, // Invalid
|
||||
0, // Mafia 1
|
||||
0, // Mafia 2
|
||||
0, // Mafia 3
|
||||
0, // Mafia Definitive Edition
|
||||
],
|
||||
};
|
||||
|
||||
|
||||
@@ -1125,6 +1125,10 @@ let serverEmoji = [
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGameConfig() {
|
||||
return gameData;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function makeLargeNumberReadable(num) {
|
||||
@@ -1537,13 +1541,7 @@ function isGameFeatureSupported(featureName) {
|
||||
// ===========================================================================
|
||||
|
||||
function getAllowedSkins(gameId = getGame()) {
|
||||
return getGameData().skins[gameId].filter(skin => skin[2] == true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getGameData() {
|
||||
return gameData;
|
||||
return getGameConfig().skins[gameId].filter(skin => skin[2] == true);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1561,7 +1559,7 @@ function getAllowedSkinIndexFromSkin(skin) {
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinIndexFromModel(model, gameId = getGame()) {
|
||||
let skins = getGameData().skins[gameId];
|
||||
let skins = getGameConfig().skins[gameId];
|
||||
for(let i in skins) {
|
||||
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
return i;
|
||||
@@ -1574,7 +1572,7 @@ function getSkinIndexFromModel(model, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinIndexFromName(name, gameId = getGame()) {
|
||||
let skins = getGameData().skins[gameId];
|
||||
let skins = getGameConfig().skins[gameId];
|
||||
for(let i in skins) {
|
||||
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||
return i;
|
||||
@@ -1587,7 +1585,7 @@ function getSkinIndexFromName(name, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getObjectModelIndexFromModel(model, gameId = getGame()) {
|
||||
let objects = getGameData().objects[gameId];
|
||||
let objects = getGameConfig().objects[gameId];
|
||||
for(let i in objects) {
|
||||
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
return i;
|
||||
@@ -1600,7 +1598,7 @@ function getObjectModelIndexFromModel(model, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getGameName(gameId = getGame()) {
|
||||
return getGameData().gameNames[gameId];
|
||||
return getGameConfig().gameNames[gameId];
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1623,7 +1621,7 @@ function getVehicleModelIndexFromParams(params, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleModelIndexFromName(name, gameId = getGame()) {
|
||||
let vehicles = getGameData().vehicles[gameId];
|
||||
let vehicles = getGameConfig().vehicles[gameId];
|
||||
for(let i in vehicles) {
|
||||
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||
return i;
|
||||
@@ -1636,7 +1634,7 @@ function getVehicleModelIndexFromName(name, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleModelIndexFromModel(model, gameId = getGame()) {
|
||||
let vehicles = getGameData().vehicles[gameId];
|
||||
let vehicles = getGameConfig().vehicles[gameId];
|
||||
for(let i in vehicles) {
|
||||
if(isNaN(model)) {
|
||||
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
@@ -1655,7 +1653,7 @@ function getVehicleModelIndexFromModel(model, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleModelFromName(name, gameId = getGame()) {
|
||||
let vehicles = getGameData().vehicles[gameId];
|
||||
let vehicles = getGameConfig().vehicles[gameId];
|
||||
for(let i in vehicles) {
|
||||
if(toLowerCase(vehicles[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||
return vehicles[i][0];
|
||||
@@ -1668,7 +1666,7 @@ function getVehicleModelFromName(name, gameId = getGame()) {
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleNameFromModel(model, gameId = getGame()) {
|
||||
let vehicles = getGameData().vehicles[gameId];
|
||||
let vehicles = getGameConfig().vehicles[gameId];
|
||||
for(let i in vehicles) {
|
||||
if(isNaN(model)) {
|
||||
if(toLowerCase(vehicles[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
@@ -1686,7 +1684,7 @@ function getVehicleNameFromModel(model, gameId = getGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinModelIndexFromParams(params, gameId = getServerGame()) {
|
||||
function getSkinModelIndexFromParams(params, gameId = getGame()) {
|
||||
let fromName = getSkinIndexFromName(params, gameId);
|
||||
let fromModel = getSkinIndexFromModel(params, gameId);
|
||||
|
||||
@@ -1703,8 +1701,8 @@ function getSkinModelIndexFromParams(params, gameId = getServerGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinNameFromModel(model, gameId = getServerGame()) {
|
||||
let skins = getGameData().skins[gameId];
|
||||
function getSkinNameFromModel(model, gameId = getGame()) {
|
||||
let skins = getGameConfig().skins[gameId];
|
||||
for(let i in skins) {
|
||||
if(toLowerCase(skins[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
return skins[i][1];
|
||||
@@ -1716,8 +1714,8 @@ function getSkinNameFromModel(model, gameId = getServerGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getSkinModelFromName(name, gameId = getServerGame()) {
|
||||
let skins = getGameData().skins[gameId];
|
||||
function getSkinModelFromName(name, gameId = getGame()) {
|
||||
let skins = getGameConfig().skins[gameId];
|
||||
for(let i in skins) {
|
||||
if(toLowerCase(skins[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||
return skins[i][0];
|
||||
@@ -1727,7 +1725,7 @@ function getSkinModelFromName(name, gameId = getServerGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getObjectModelIndexFromParams(params, gameId = getServerGame()) {
|
||||
function getObjectModelIndexFromParams(params, gameId = getGame()) {
|
||||
let fromName = getObjectModelIndexFromName(params, gameId);
|
||||
let fromModel = getObjectModelIndexFromModel(params, gameId);
|
||||
|
||||
@@ -1744,8 +1742,8 @@ function getObjectModelIndexFromParams(params, gameId = getServerGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getObjectNameFromModel(model, gameId = getServerGame()) {
|
||||
let objects = getGameData().objects[gameId];
|
||||
function getObjectNameFromModel(model, gameId = getGame()) {
|
||||
let objects = getGameConfig().objects[gameId];
|
||||
for(let i in objects) {
|
||||
if(toLowerCase(objects[i][0]).indexOf(toLowerCase(model)) != -1) {
|
||||
return objects[i][1];
|
||||
@@ -1757,8 +1755,8 @@ function getObjectNameFromModel(model, gameId = getServerGame()) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getObjectModelFromName(name, gameId = getServerGame()) {
|
||||
let objects = getGameData().objects[gameId];
|
||||
function getObjectModelFromName(name, gameId = getGame()) {
|
||||
let objects = getGameConfig().objects[gameId];
|
||||
for(let i in objects) {
|
||||
if(toLowerCase(objects[i][1]).indexOf(toLowerCase(name)) != -1) {
|
||||
return objects[i][0];
|
||||
@@ -2074,14 +2072,14 @@ async function waitUntil(condition) {
|
||||
|
||||
function getGameLocationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
let locations = getGameData().locations[getGame()];
|
||||
let locations = getGameConfig().locations[getGame()];
|
||||
for(let i in locations) {
|
||||
if(toLowerCase(locations[i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof getGameData().locations[getGame()][params] != "undefined") {
|
||||
if(typeof getGameConfig().locations[getGame()][params] != "undefined") {
|
||||
return toInteger(params);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user