Bunch of stuff
This commit is contained in:
69
scripts/client/gui/localepicker.js
Normal file
69
scripts/client/gui/localepicker.js
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
// ===========================================================================
|
||||||
|
// Vortrex's Roleplay Resource
|
||||||
|
// https://github.com/VortrexFTW/gtac_roleplay
|
||||||
|
// ===========================================================================
|
||||||
|
// FILE: localechooser.js
|
||||||
|
// DESC: Provides locale chooser GUI
|
||||||
|
// TYPE: Client (JavaScript)
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
let localeChooser = {
|
||||||
|
window: null,
|
||||||
|
flagImages: []
|
||||||
|
};
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function initLocaleChooserGUI() {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating locale chooser GUI ...`);
|
||||||
|
localeChooser.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Choose a language', {
|
||||||
|
main: {
|
||||||
|
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
textSize: 11.0,
|
||||||
|
textColour: toColour(primaryTextColour[0], primaryTextColour[1], primaryTextColour[2], 255),
|
||||||
|
backgroundColour: toColour(primaryColour[0], primaryColour[1], primaryColour[2], windowTitleAlpha),
|
||||||
|
},
|
||||||
|
icon: {
|
||||||
|
textSize: 0.0,
|
||||||
|
textColour: toColour(0, 0, 0, 0),
|
||||||
|
backgroundColour: toColour(0, 0, 0, 0),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
login.window.titleBarShown = false;
|
||||||
|
|
||||||
|
for(let i in localeOptions) {
|
||||||
|
let flagImage = localeChooser.window.image(25, 25, 100, 100, localeOptions[i].flagImage, {
|
||||||
|
focused: {
|
||||||
|
borderColour: toColour(0, 0, 0, 0),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
flagImage.callback = function() {
|
||||||
|
localeChooserSetLocale(localeOptions[i].locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
localeChooser.flagImages.push(flagImage);
|
||||||
|
}
|
||||||
|
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Created locale chooser GUI`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function closeLocaleChooser() {
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Closing locale chooser window`);
|
||||||
|
localeChooser.window.shown = false;
|
||||||
|
mexui.setInput(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function showLocaleChooser() {
|
||||||
|
closeAllWindows();
|
||||||
|
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing locale chooser window`);
|
||||||
|
mexui.setInput(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -7,9 +7,6 @@
|
|||||||
// TYPE: Client (JavaScript)
|
// TYPE: Client (JavaScript)
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let flagImagesPosition = toVector2(getScreenWidth()/2, login.window.position.y+100);
|
|
||||||
let flagImageSize = toVector2(50, 50);
|
|
||||||
|
|
||||||
function getLocaleString(stringName, ...args) {
|
function getLocaleString(stringName, ...args) {
|
||||||
if(typeof getServerData().localeStrings[stringName] == undefined) {
|
if(typeof getServerData().localeStrings[stringName] == undefined) {
|
||||||
return "";
|
return "";
|
||||||
@@ -32,3 +29,12 @@ function receiveLocaleStringFromServer(stringName, stringValue) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function receiveLocaleStringsFromServer(strings) {
|
||||||
|
for(let i in strings) {
|
||||||
|
let stringName = strings[i][0];
|
||||||
|
getServerData().localeStrings[stringName] = strings[i][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -580,3 +580,69 @@ function getScreenHeight() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function openAllGarages() {
|
||||||
|
switch(getGame()) {
|
||||||
|
case VRR_GAME_GTA_III:
|
||||||
|
for(let i=0;i<=26;i++) {
|
||||||
|
openGarage(i);
|
||||||
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_GAME_GTA_VC:
|
||||||
|
for(let i=0;i<=32;i++) {
|
||||||
|
openGarage(i);
|
||||||
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_GAME_GTA_SA:
|
||||||
|
for(let i=0;i<=44;i++) {
|
||||||
|
openGarage(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function closeAllGarages() {
|
||||||
|
switch(getGame()) {
|
||||||
|
case VRR_GAME_GTA_III:
|
||||||
|
for(let i=0;i<=26;i++) {
|
||||||
|
closeGarage(i);
|
||||||
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_GAME_GTA_VC:
|
||||||
|
for(let i=0;i<=32;i++) {
|
||||||
|
closeGarage(i);
|
||||||
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_GAME_GTA_SA:
|
||||||
|
for(let i=0;i<=44;i++) {
|
||||||
|
closeGarage(i);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setPedInvincible(ped, state) {
|
||||||
|
ped.invincible = state;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -94,6 +94,7 @@ function addAllNetworkHandlers() {
|
|||||||
|
|
||||||
// Locale
|
// Locale
|
||||||
addNetworkEventHandler("vrr.localeString", receiveLocaleStringFromServer);
|
addNetworkEventHandler("vrr.localeString", receiveLocaleStringFromServer);
|
||||||
|
addNetworkEventHandler("vrr.localeStrings", receiveLocaleStringsFromServer);
|
||||||
|
|
||||||
// Misc
|
// Misc
|
||||||
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
addNetworkEventHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ function setUpInitialGame() {
|
|||||||
natives.requestAnims("DANCING");
|
natives.requestAnims("DANCING");
|
||||||
|
|
||||||
// Some last steps
|
// Some last steps
|
||||||
natives.loadAllObjectsNow();
|
//natives.loadAllObjectsNow();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_GAME_MAFIA_ONE:
|
case VRR_GAME_MAFIA_ONE:
|
||||||
|
|||||||
@@ -7,173 +7,6 @@
|
|||||||
// TYPE: Client (JavaScript)
|
// TYPE: Client (JavaScript)
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
let weaponSlots = [
|
|
||||||
false,
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
8,
|
|
||||||
9,
|
|
||||||
10,
|
|
||||||
11
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
4,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
5,
|
|
||||||
5,
|
|
||||||
5,
|
|
||||||
6,
|
|
||||||
6,
|
|
||||||
8,
|
|
||||||
8,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
9,
|
|
||||||
-1,
|
|
||||||
9,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
0,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
8,
|
|
||||||
8,
|
|
||||||
8,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
-1,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
2,
|
|
||||||
3,
|
|
||||||
3,
|
|
||||||
3,
|
|
||||||
4,
|
|
||||||
4,
|
|
||||||
5,
|
|
||||||
5,
|
|
||||||
4,
|
|
||||||
6,
|
|
||||||
6,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
7,
|
|
||||||
8,
|
|
||||||
12,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
11,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
9,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
function openAllGarages() {
|
|
||||||
switch(getGame()) {
|
|
||||||
case VRR_GAME_GTA_III:
|
|
||||||
for(let i=0;i<=26;i++) {
|
|
||||||
openGarage(i);
|
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_GAME_GTA_VC:
|
|
||||||
for(let i=0;i<=32;i++) {
|
|
||||||
openGarage(i);
|
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_GAME_GTA_SA:
|
|
||||||
for(let i=0;i<=44;i++) {
|
|
||||||
openGarage(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function closeAllGarages() {
|
|
||||||
switch(getGame()) {
|
|
||||||
case VRR_GAME_GTA_III:
|
|
||||||
for(let i=0;i<=26;i++) {
|
|
||||||
closeGarage(i);
|
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_GAME_GTA_VC:
|
|
||||||
for(let i=0;i<=32;i++) {
|
|
||||||
closeGarage(i);
|
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case VRR_GAME_GTA_SA:
|
|
||||||
for(let i=0;i<=44;i++) {
|
|
||||||
closeGarage(i);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function setLocalPlayerFrozenState(state) {
|
function setLocalPlayerFrozenState(state) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting frozen state to ${state}`);
|
||||||
gui.showCursor(state, !state);
|
gui.showCursor(state, !state);
|
||||||
@@ -186,11 +19,9 @@ function setLocalPlayerControlState(controlState, cursorState = false) {
|
|||||||
controlsEnabled = controlState;
|
controlsEnabled = controlState;
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
game.SET_PLAYER_CONTROL(game.GET_PLAYER_ID(), boolToInt(controlState));
|
game.SET_PLAYER_CONTROL(game.GET_PLAYER_ID(), boolToInt(controlState));
|
||||||
}
|
} else if(getGame() != VRR_GAME_GTA_IV) {
|
||||||
|
setElementCollisionsEnabled(localPlayer, controlState);
|
||||||
if(getGame() != VRR_GAME_GTA_IV) {
|
setPedInvincible(localPlayer, true);
|
||||||
localPlayer.collisionsEnabled = controlState;
|
|
||||||
localPlayer.invincible = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -371,12 +202,12 @@ function setLocalPlayerInterior(interior) {
|
|||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
//let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
//for(let i in vehicles) {
|
for(let i in vehicles) {
|
||||||
// if(getEntityData(vehicles[i], "vrr.interior")) {
|
if(getEntityData(vehicles[i], "vrr.interior")) {
|
||||||
// vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
|
vehicles[i].interior = getEntityData(vehicles[i], "vrr.interior");
|
||||||
// }
|
}
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -398,12 +229,6 @@ function setLocalPlayerHealth(health) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function isSnowEnabled() {
|
|
||||||
return (typeof snowing != "undefined");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function playPedSpeech(pedName, speechId) {
|
function playPedSpeech(pedName, speechId) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] Making ${pedName}'s ped talk (${speechId})`);
|
||||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||||
@@ -421,18 +246,14 @@ function clearLocalPedState() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getWeaponSlot(weaponId) {
|
function getWeaponSlot(weaponId) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
return getGameConfig().weaponSlots[getGame()][weaponId];
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return weaponSlots[getGame()][weaponId];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerDrunkEffect(amount, duration) {
|
function setLocalPlayerDrunkEffect(amount, duration) {
|
||||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration}ms`);
|
logToConsole(LOG_DEBUG, `[VRR.Utilities] Drunk effect set to ${amount} for ${duration} ms`);
|
||||||
drunkEffectAmount = 0;
|
drunkEffectAmount = 0;
|
||||||
drunkEffectDurationTimer = setInterval(function() {
|
drunkEffectDurationTimer = setInterval(function() {
|
||||||
drunkEffectAmount = drunkEffectAmount;
|
drunkEffectAmount = drunkEffectAmount;
|
||||||
@@ -599,28 +420,6 @@ function processLocalPlayerVehicleControlState() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processLocalPlayerSphereEntryExitHandling() {
|
|
||||||
let position = getLocalPlayerPosition();
|
|
||||||
|
|
||||||
if(areMarkersSupported()) {
|
|
||||||
getElementsByType(ELEMENT_MARKER).forEach(function(sphere) {
|
|
||||||
if(getDistance(position, sphere.position) <= sphere.radius) {
|
|
||||||
if(!inSphere) {
|
|
||||||
inSphere = sphere;
|
|
||||||
triggerEvent("OnLocalPlayerEnterSphere", null, sphere);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(inSphere) {
|
|
||||||
inSphere = false;
|
|
||||||
triggerEvent("OnLocalPlayerExitSphere", null, sphere);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function processJobRouteSphere() {
|
function processJobRouteSphere() {
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if(getGame() == VRR_GAME_GTA_SA) {
|
||||||
let position = getLocalPlayerPosition();
|
let position = getLocalPlayerPosition();
|
||||||
@@ -670,29 +469,11 @@ function getLocalPlayerPosition() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processLocalPlayerVehicleEntryExitHandling() {
|
|
||||||
if(localPlayer.vehicle) {
|
|
||||||
if(!inVehicle) {
|
|
||||||
inVehicle = localPlayer.vehicle;
|
|
||||||
inVehicleSeat = getLocalPlayerVehicleSeat();
|
|
||||||
triggerEvent("OnLocalPlayerEnteredVehicle", inVehicle, inVehicleSeat);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(inVehicle) {
|
|
||||||
triggerEvent("OnLocalPlayerExitedVehicle", inVehicle, inVehicleSeat);
|
|
||||||
inVehicle = false;
|
|
||||||
inVehicleSeat = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function getVehicleForNetworkEvent(vehicle) {
|
function getVehicleForNetworkEvent(vehicle) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if(getGame() == VRR_GAME_GTA_IV) {
|
||||||
return natives.getNetworkIdFromVehicle(vehicle);
|
return natives.getNetworkIdFromVehicle(vehicle);
|
||||||
}
|
}
|
||||||
return vehicle;
|
return vehicle.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -781,59 +562,6 @@ function processGameSpecifics() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processVehiclePurchasing() {
|
|
||||||
if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
|
|
||||||
if(inVehicle == false) {
|
|
||||||
vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
|
|
||||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
if(vehiclePurchasing == inVehicle) {
|
|
||||||
if(getDistance(inVehicle.position, vehiclePurchasePosition) >= 25) {
|
|
||||||
vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
|
|
||||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
|
|
||||||
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function setVehiclePurchaseState(state, vehicleId, position) {
|
|
||||||
vehiclePurchaseState = state;
|
|
||||||
|
|
||||||
if(vehicleId != null) {
|
|
||||||
vehiclePurchasing = getElementFromId(vehicleId);
|
|
||||||
} else {
|
|
||||||
vehiclePurchasing = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
vehiclePurchasePosition = position;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function processVehicleFires() {
|
|
||||||
/*
|
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
|
||||||
for(let i in vehicles) {
|
|
||||||
if(vehicles[i].isSyncer) {
|
|
||||||
if(!doesEntityDataExist(vehicles[i], "vrr.fire")) {
|
|
||||||
triggerNetworkEvent("vrr.vehFire", vehicles[i].id);
|
|
||||||
} else {
|
|
||||||
vehicles[i].health = 249;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function getServerData() {
|
function getServerData() {
|
||||||
return serverData;
|
return serverData;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,3 +16,47 @@ function receiveVehicleFromServer(vehicleId, position, model, colour1, colour2,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
|
function processVehiclePurchasing() {
|
||||||
|
if(vehiclePurchaseState == VRR_VEHBUYSTATE_TESTDRIVE) {
|
||||||
|
if(getLocalPlayerVehicle() == false) {
|
||||||
|
vehiclePurchaseState = VRR_VEHBUYSTATE_EXITVEH;
|
||||||
|
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_EXITVEH);
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
if(vehiclePurchasing == getLocalPlayerVehicle()) {
|
||||||
|
if(getDistance(getLocalPlayerVehicle().position, vehiclePurchasePosition) >= 25) {
|
||||||
|
vehiclePurchaseState = VRR_VEHBUYSTATE_FARENOUGH;
|
||||||
|
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_FARENOUGH);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vehiclePurchaseState = VRR_VEHBUYSTATE_WRONGVEH;
|
||||||
|
sendNetworkEventToServer("vrr.vehBuyState", VRR_VEHBUYSTATE_WRONGVEH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function processVehicleBurning() {
|
||||||
|
getElementsByType(ELEMENT_VEHICLE).filter(vehicle => vehicle.isSyncer && vehicle.health < 250).forEach((vehicle) => {
|
||||||
|
vehicle.health = 250;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function setVehiclePurchaseState(state, vehicleId, position) {
|
||||||
|
vehiclePurchaseState = state;
|
||||||
|
|
||||||
|
if(vehicleId != null) {
|
||||||
|
vehiclePurchasing = getElementFromId(vehicleId);
|
||||||
|
} else {
|
||||||
|
vehiclePurchasing = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
vehiclePurchasePosition = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
@@ -72,6 +72,7 @@ let globalConfig = {
|
|||||||
vehicleInactiveRespawnDelay: 1800000, // 20 minutes
|
vehicleInactiveRespawnDelay: 1800000, // 20 minutes
|
||||||
chatSectionHeaderLength: 96,
|
chatSectionHeaderLength: 96,
|
||||||
useServerSideVehiclePurchaseCheck: true,
|
useServerSideVehiclePurchaseCheck: true,
|
||||||
|
useServerSideVehicleBurnCheck: false,
|
||||||
businessPickupStreamInDistance: 100,
|
businessPickupStreamInDistance: 100,
|
||||||
businessPickupStreamOutDistance: 120,
|
businessPickupStreamOutDistance: 120,
|
||||||
housePickupStreamInDistance: 100,
|
housePickupStreamInDistance: 100,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
let scriptVersion = "1.1";
|
let scriptVersion = "1.1";
|
||||||
let serverStartTime = 0;
|
let serverStartTime = 0;
|
||||||
let logLevel = LOG_INFO|LOG_ERROR|LOG_WARN|LOG_DEBUG;
|
let logLevel = LOG_INFO|LOG_ERROR|LOG_WARN;
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
@@ -20,8 +20,6 @@ let logLevel = LOG_INFO|LOG_ERROR|LOG_WARN|LOG_DEBUG;
|
|||||||
* @property {Array.<BusinessData>} businesses
|
* @property {Array.<BusinessData>} businesses
|
||||||
* @property {Array.<HouseData>} houses
|
* @property {Array.<HouseData>} houses
|
||||||
* @property {Array.<HouseData>} commands
|
* @property {Array.<HouseData>} commands
|
||||||
* @property {Array} groundItemCache
|
|
||||||
* @property {Array} groundPlantCache
|
|
||||||
* @property {Array.<ItemData>} items
|
* @property {Array.<ItemData>} items
|
||||||
* @property {Array.<ItemTypeData>} itemTypes
|
* @property {Array.<ItemTypeData>} itemTypes
|
||||||
* @property {Array.<ClanData>} clans
|
* @property {Array.<ClanData>} clans
|
||||||
@@ -30,6 +28,10 @@ let logLevel = LOG_INFO|LOG_ERROR|LOG_WARN|LOG_DEBUG;
|
|||||||
* @property {Array.<RaceData>} races
|
* @property {Array.<RaceData>} races
|
||||||
* @property {Array.<JobData>} jobs
|
* @property {Array.<JobData>} jobs
|
||||||
* @property {Array.<Gates>} gates
|
* @property {Array.<Gates>} gates
|
||||||
|
* @property {Array} groundItemCache
|
||||||
|
* @property {Array} groundPlantCache
|
||||||
|
* @property {Array} purchasingVehicleCache
|
||||||
|
* @property {Array} rentingVehicleCache
|
||||||
*/
|
*/
|
||||||
let serverData = {
|
let serverData = {
|
||||||
vehicles: [],
|
vehicles: [],
|
||||||
@@ -37,8 +39,6 @@ let serverData = {
|
|||||||
businesses: [],
|
businesses: [],
|
||||||
houses: [],
|
houses: [],
|
||||||
commands: {},
|
commands: {},
|
||||||
groundItemCache: [],
|
|
||||||
groundPlantCache: [],
|
|
||||||
items: [],
|
items: [],
|
||||||
itemTypes: [],
|
itemTypes: [],
|
||||||
clans: [],
|
clans: [],
|
||||||
@@ -50,6 +50,10 @@ let serverData = {
|
|||||||
races: [],
|
races: [],
|
||||||
jobs: [],
|
jobs: [],
|
||||||
gates: [],
|
gates: [],
|
||||||
|
groundItemCache: [],
|
||||||
|
groundPlantCache: [],
|
||||||
|
purchasingVehicleCache: [],
|
||||||
|
rentingVehicleCache: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -1297,7 +1297,7 @@ function getClosestItemOnGround(position) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setItemDataIndexes() {
|
function setAllItemDataIndexes() {
|
||||||
for(let i in getServerData().items) {
|
for(let i in getServerData().items) {
|
||||||
if(getServerData().items[i]) {
|
if(getServerData().items[i]) {
|
||||||
getServerData().items[i].index = i;
|
getServerData().items[i].index = i;
|
||||||
@@ -1308,7 +1308,7 @@ function setItemDataIndexes() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setItemTypeDataIndexes() {
|
function setAllItemTypeDataIndexes() {
|
||||||
for(let i in getServerData().itemTypes) {
|
for(let i in getServerData().itemTypes) {
|
||||||
if(getServerData().itemTypes[i]) {
|
if(getServerData().itemTypes[i]) {
|
||||||
getServerData().itemTypes[i].index = i;
|
getServerData().itemTypes[i].index = i;
|
||||||
@@ -1460,7 +1460,7 @@ function deleteItem(itemId) {
|
|||||||
quickDatabaseQuery(`DELETE FROM item_main WHERE item_id = ${getItemData(itemId).databaseId}`);
|
quickDatabaseQuery(`DELETE FROM item_main WHERE item_id = ${getItemData(itemId).databaseId}`);
|
||||||
}
|
}
|
||||||
getServerData().items[itemId] = false;
|
getServerData().items[itemId] = false;
|
||||||
setItemDataIndexes();
|
setAllItemDataIndexes();
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -926,17 +926,15 @@ function takeJob(client, jobId) {
|
|||||||
function reloadAllJobsCommand(command, params, client) {
|
function reloadAllJobsCommand(command, params, client) {
|
||||||
forceAllPlayersToStopWorking();
|
forceAllPlayersToStopWorking();
|
||||||
|
|
||||||
|
deleteAllJobBlips();
|
||||||
|
deleteAllJobPickups();
|
||||||
clearArray(getServerData().jobs);
|
clearArray(getServerData().jobs);
|
||||||
getServerData().jobs = loadJobsFromDatabase();
|
|
||||||
|
|
||||||
for(let i in getServerData().jobs) {
|
Promise.resolve().then(() => {
|
||||||
for(let j in getServerData().jobs[i].locations) {
|
getServerData().jobs = loadJobsFromDatabase();
|
||||||
deleteJobLocationPickup(i, j);
|
createJobLocationPickup(i, j);
|
||||||
deleteJobLocationBlip(i, j);
|
createJobLocationBlip(i, j);
|
||||||
createJobLocationPickup(i, j);
|
});
|
||||||
createJobLocationBlip(i, j);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
announceAdminAction("AllJobsReloaded");
|
announceAdminAction("AllJobsReloaded");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -799,9 +799,16 @@ function disconnectFromDatabase(dbConnection) {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function queryDatabase(dbConnection, queryString) {
|
function queryDatabase(dbConnection, queryString, useThread = false) {
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
|
logToConsole(LOG_DEBUG, `[VRR.Database] Query string: ${queryString}`);
|
||||||
return dbConnection.query(queryString);
|
if(useThread == true) {
|
||||||
|
Promise.resolve().then(() => {
|
||||||
|
let queryResult = dbConnection.query(queryString);
|
||||||
|
return queryResult;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
return dbConnection.query(queryString);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ function initServerScripts() {
|
|||||||
|
|
||||||
// Load all the server data
|
// Load all the server data
|
||||||
loadServerDataFromDatabase();
|
loadServerDataFromDatabase();
|
||||||
|
|
||||||
// Set indexes and cache necessary data
|
|
||||||
setAllServerDataIndexes();
|
setAllServerDataIndexes();
|
||||||
createAllServerElements();
|
createAllServerElements();
|
||||||
|
|
||||||
@@ -122,7 +120,6 @@ function loadServerDataFromDatabase() {
|
|||||||
getServerData().localeStrings = loadAllLocaleStrings();
|
getServerData().localeStrings = loadAllLocaleStrings();
|
||||||
getServerData().allowedSkins = getAllowedSkins(getGame());
|
getServerData().allowedSkins = getAllowedSkins(getGame());
|
||||||
|
|
||||||
|
|
||||||
// Translation Cache
|
// Translation Cache
|
||||||
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslations = new Array(getGlobalConfig().locale.locales.length);
|
||||||
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
getServerData().cachedTranslationFrom = new Array(getGlobalConfig().locale.locales.length);
|
||||||
@@ -150,8 +147,8 @@ function loadServerDataFromDatabase() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setAllServerDataIndexes() {
|
function setAllServerDataIndexes() {
|
||||||
setItemTypeDataIndexes();
|
setAllItemTypeDataIndexes();
|
||||||
setItemDataIndexes();
|
setAllItemDataIndexes();
|
||||||
setBusinessDataIndexes();
|
setBusinessDataIndexes();
|
||||||
setHouseDataIndexes();
|
setHouseDataIndexes();
|
||||||
setAllClanDataIndexes();
|
setAllClanDataIndexes();
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ function oneMinuteTimerFunction() {
|
|||||||
checkServerGameTime();
|
checkServerGameTime();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Checking rentable vehicles`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Checking rentable vehicles`);
|
||||||
vehicleRentCheck();
|
checkVehicleRenting();
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Updating all player name tags`);
|
||||||
updateAllPlayerNameTags();
|
updateAllPlayerNameTags();
|
||||||
@@ -130,19 +130,18 @@ function thirtyMinuteTimerFunction() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function vehicleRentCheck() {
|
function checkVehicleRenting() {
|
||||||
// Loop through players, not vehicles. Much more efficient (and doesn't consume resources when no players are connected)
|
let renting = getServerData().rentingVehicleCache;
|
||||||
let clients = getClients();
|
for(let i in renting) {
|
||||||
for(let i in clients) {
|
if(isClientInitialized(renting[i])) {
|
||||||
if(isClientInitialized(clients[i])) {
|
if(getPlayerData(renting[i]) != false) {
|
||||||
if(getPlayerData(clients[i]) != false) {
|
if(isPlayerLoggedIn(renting[i] && isPlayerSpawned(renting[i]))) {
|
||||||
if(isPlayerLoggedIn(clients[i] && isPlayerSpawned(clients[i]))) {
|
if(getPlayerData(renting[i]).rentingVehicle != false) {
|
||||||
if(getPlayerData(clients[i]).rentingVehicle != false) {
|
if(getPlayerCurrentSubAccount(renting[i]).cash < getServerData().vehicles[getPlayerData(renting[i]).rentingVehicle].rentPrice) {
|
||||||
if(getPlayerCurrentSubAccount(clients[i]).cash < getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice) {
|
messagePlayerAlert(renting[i], `You do not have enough money to continue renting this vehicle!`);
|
||||||
messagePlayerAlert(clients[i], `You do not have enough money to continue renting this vehicle!`);
|
stopRentingVehicle(renting[i]);
|
||||||
stopRentingVehicle(clients[i]);
|
|
||||||
} else {
|
} else {
|
||||||
takePlayerCash(clients[i], getServerData().vehicles[getPlayerData(clients[i]).rentingVehicle].rentPrice);
|
takePlayerCash(renting[i], getServerData().vehicles[getPlayerData(renting[i]).rentingVehicle].rentPrice);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ function saveVehicleToDatabase(vehicleDataId) {
|
|||||||
getServerData().vehicles[vehicleDataId].needsSaved = false;
|
getServerData().vehicles[vehicleDataId].needsSaved = false;
|
||||||
} else {
|
} else {
|
||||||
let queryString = createDatabaseUpdateQuery("veh_main", data, `veh_id=${tempVehicleData.databaseId}`);
|
let queryString = createDatabaseUpdateQuery("veh_main", data, `veh_id=${tempVehicleData.databaseId}`);
|
||||||
dbQuery = queryDatabase(dbConnection, queryString);
|
dbQuery = queryDatabase(dbConnection, queryString, true);
|
||||||
getServerData().vehicles[vehicleDataId].needsSaved = false;
|
getServerData().vehicles[vehicleDataId].needsSaved = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -547,6 +547,7 @@ function buyVehicleCommand(command, params, client) {
|
|||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_TESTDRIVE, vehicle.id, getVehiclePosition(vehicle));
|
||||||
meActionToNearbyPlayers(client, `receives a set of keys to test drive the ${getVehicleName(vehicle)} and starts the engine`);
|
meActionToNearbyPlayers(client, `receives a set of keys to test drive the ${getVehicleName(vehicle)} and starts the engine`);
|
||||||
messagePlayerInfo(client, getLocaleString(client, "DealershipPurchaseTestDrive"));
|
messagePlayerInfo(client, getLocaleString(client, "DealershipPurchaseTestDrive"));
|
||||||
|
getServerData().purchasingVehicleCache.push(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -593,7 +594,7 @@ function rentVehicleCommand(command, params, client) {
|
|||||||
getVehicleData(vehicle).rentedBy = client;
|
getVehicleData(vehicle).rentedBy = client;
|
||||||
getPlayerData(client).rentingVehicle = vehicle;
|
getPlayerData(client).rentingVehicle = vehicle;
|
||||||
getVehicleData(vehicle).rentStart = getCurrentUnixTimestamp();
|
getVehicleData(vehicle).rentStart = getCurrentUnixTimestamp();
|
||||||
|
getServerData().rentingVehicleCache.push(client);
|
||||||
getVehicleData(vehicle).needsSaved = true;
|
getVehicleData(vehicle).needsSaved = true;
|
||||||
|
|
||||||
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
|
meActionToNearbyPlayers(client, `rents the ${getVehicleName(vehicle)} and receives a set of vehicle keys!`);
|
||||||
@@ -1232,6 +1233,7 @@ function respawnBusinessVehiclesCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function stopRentingVehicle(client) {
|
function stopRentingVehicle(client) {
|
||||||
|
getServerData().rentingVehicleCache.splice(getServerData().rentingVehicleCache.indexOf(client), 1);
|
||||||
let vehicle = getPlayerData(client).rentingVehicle;
|
let vehicle = getPlayerData(client).rentingVehicle;
|
||||||
getPlayerData(client).rentingVehicle = false;
|
getPlayerData(client).rentingVehicle = false;
|
||||||
getVehicleData(vehicle).rentedBy = false;
|
getVehicleData(vehicle).rentedBy = false;
|
||||||
@@ -1465,9 +1467,9 @@ function processVehiclePurchasing() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clients = getClients();
|
let purchasingVehicles = getServerData().purchasingVehicleCache;
|
||||||
for(let i in clients) {
|
for(let i in purchasingVehicles) {
|
||||||
checkVehicleBuying(clients[i]);
|
checkVehiclePurchasing(purchasingVehicles[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1475,7 +1477,7 @@ function processVehiclePurchasing() {
|
|||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function checkVehicleBuying(client) {
|
function checkVehiclePurchasing(client) {
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if(!isPlayerLoggedIn(client)) {
|
||||||
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
setPlayerBuyingVehicleState(client, VRR_VEHBUYSTATE_NONE, null, null);
|
||||||
return false;
|
return false;
|
||||||
@@ -1498,6 +1500,7 @@ function checkVehicleBuying(client) {
|
|||||||
|
|
||||||
if(!isPlayerInAnyVehicle(client)) {
|
if(!isPlayerInAnyVehicle(client)) {
|
||||||
if(getPlayerData(client).buyingVehicle != false) {
|
if(getPlayerData(client).buyingVehicle != false) {
|
||||||
|
getServerData().purchasingVehicleCache.splice(getServerData().purchasingVehicleCache.indexOf(client), 1);
|
||||||
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
messagePlayerError(client, getLocaleString(client, "DealershipPurchaseExitedVehicle"));
|
||||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||||
getPlayerData(client).buyingVehicle = false;
|
getPlayerData(client).buyingVehicle = false;
|
||||||
@@ -1508,6 +1511,7 @@ function checkVehicleBuying(client) {
|
|||||||
|
|
||||||
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
if(getDistance(getVehiclePosition(getPlayerData(client).buyingVehicle), getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition) > getGlobalConfig().buyVehicleDriveAwayDistance) {
|
||||||
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
if(getPlayerCurrentSubAccount(client).cash < getVehicleData(getPlayerData(client).buyingVehicle).buyPrice) {
|
||||||
|
getServerData().purchasingVehicleCache.splice(getServerData().purchasingVehicleCache.indexOf(client), 1);
|
||||||
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
messagePlayerError(client, getLocaleString(client, "VehiclePurchaseNotEnoughMoney"));
|
||||||
respawnVehicle(getPlayerData(client).buyingVehicle);
|
respawnVehicle(getPlayerData(client).buyingVehicle);
|
||||||
getPlayerData(client).buyingVehicle = false;
|
getPlayerData(client).buyingVehicle = false;
|
||||||
@@ -1515,6 +1519,7 @@ function checkVehicleBuying(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getServerData().purchasingVehicleCache.splice(getServerData().purchasingVehicleCache.indexOf(client), 1);
|
||||||
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
createNewDealershipVehicle(getVehicleData(getPlayerData(client).buyingVehicle).model, getVehicleData(getPlayerData(client).buyingVehicle).spawnPosition, getVehicleData(getPlayerData(client).buyingVehicle).spawnRotation, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice, getVehicleData(getPlayerData(client).buyingVehicle).ownerId);
|
||||||
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
takePlayerCash(client, getVehicleData(getPlayerData(client).buyingVehicle).buyPrice);
|
||||||
updatePlayerCash(client);
|
updatePlayerCash(client);
|
||||||
@@ -1533,10 +1538,16 @@ function checkVehicleBuying(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processVehicleBurning() {
|
function processVehicleBurning() {
|
||||||
|
if(!getGlobalConfig().useServerSideVehicleBurnCheck) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
for(let i in vehicles) {
|
for(let i in vehicles) {
|
||||||
if(vehicles[i].health <= 250) {
|
if(vehicles[i].syncer == null) {
|
||||||
return false;
|
if(vehicles[i].health <= 250) {
|
||||||
|
vehicles[i].health = 250;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1361,7 +1361,7 @@ function getDistance(vec1, vec2) {
|
|||||||
function logToConsole(tempLogLevel, text) {
|
function logToConsole(tempLogLevel, text) {
|
||||||
text = removeColoursInMessage(text);
|
text = removeColoursInMessage(text);
|
||||||
|
|
||||||
if(hasBitFlag(logLevel, tempLogLevel) || hasBitFlag(logLevel, LOG_ERROR) || hasBitFlag(logLevel, LOG_WARN)) {
|
if(hasBitFlag(logLevel, tempLogLevel)) {
|
||||||
if(tempLogLevel & LOG_ERROR) {
|
if(tempLogLevel & LOG_ERROR) {
|
||||||
consoleError(text);
|
consoleError(text);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user