Lots of changes and fixes
* Add guiReady state * Add mouseCameraEnabled state * Make sure GUI is ready on some things * Fix wrong veh prop funcs being used clientside * Add local player ped parts/props util for IV * Add vehicle.lightStatus sync * Add element interior sync * Dont use interior on IV * Use new class structure * Set default anim offset to 1 * Set biz data to save when changing biz properties * Add mouse cam state util * Prefix item type admin cmds with "itemtype" * Fix server config saving * Fix server time setting hour to minute arg * Add player returnTo data types * Make veh rent/buy price numbers readable * Fix wrong house index being used to create blip/pickup on create * Don't cache player hotbar items if working * Fix cache player hotbar items util * Add lots of anims to GTA SA * Try/catch on all data saving to prevent one from blocking the rest * Fix readable time from showing AM for 12 PM (noon) * Set veh interior on create * Dont set engine for spawnlocked vehicles
This commit is contained in:
@@ -24,6 +24,8 @@ let windowTitleAlpha = 180;
|
||||
let buttonAlpha = 180;
|
||||
let textInputAlpha = 180;
|
||||
|
||||
let guiReady = false;
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
let login = {
|
||||
@@ -851,6 +853,8 @@ function initGUI() {
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.GUI] All GUI created successfully!`);
|
||||
closeAllWindows();
|
||||
|
||||
guiReady = true;
|
||||
};
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1140,40 +1144,42 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
|
||||
}
|
||||
|
||||
let isAnyGUIActive = function() {
|
||||
if(infoDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(!guiReady) {
|
||||
if(infoDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(yesNoDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(yesNoDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(errorDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(errorDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(register.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(register.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(login.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(login.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(newCharacter.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(newCharacter.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(characterSelect.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(characterSelect.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(twoFactorAuth.window.shown) {
|
||||
return true;
|
||||
}
|
||||
if(twoFactorAuth.window.shown) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if(listDialog.window.shown) {
|
||||
return true;
|
||||
if(listDialog.window.shown) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -55,4 +55,6 @@ let calledDeathEvent = false;
|
||||
let interiorLightsEnabled = true;
|
||||
let interiorLightsColour = toColour(0, 0, 0, 150);
|
||||
|
||||
let mouseCameraEnabled = false
|
||||
|
||||
// ===========================================================================
|
||||
@@ -38,7 +38,7 @@ function initScoreBoardListFont() {
|
||||
// ===========================================================================
|
||||
|
||||
function processScoreBoardRendering() {
|
||||
if(isAnyGUIActive()) {
|
||||
if(guiReady && isAnyGUIActive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,8 @@ function addAllNetworkHandlers() {
|
||||
addNetworkHandler("vrr.showItemActionDelay", showItemActionDelay);
|
||||
addNetworkHandler("vrr.set2DRendering", setPlayer2DRendering);
|
||||
addNetworkHandler("vrr.mouseCursor", toggleMouseCursor);
|
||||
addNetworkHandler("vrr.mouseCamera", setMouseCameraState);
|
||||
addNetworkHandler("vrr.mouseCamera", toggleMouseCamera);
|
||||
addNetworkHandler("vrr.mouseCameraForce", setMouseCameraState);
|
||||
addNetworkHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
|
||||
addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
|
||||
addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
|
||||
@@ -74,8 +75,8 @@ function addAllNetworkHandlers() {
|
||||
addNetworkHandler("vrr.stopRadioStream", stopStreamingRadio);
|
||||
addNetworkHandler("vrr.radioVolume", setStreamingRadioVolume);
|
||||
|
||||
addNetworkHandler("vrr.veh.lights", toggleVehicleLights);
|
||||
addNetworkHandler("vrr.veh.engine", toggleVehicleEngine);
|
||||
addNetworkHandler("vrr.veh.lights", setVehicleLights);
|
||||
addNetworkHandler("vrr.veh.engine", setVehicleEngine);
|
||||
addNetworkHandler("vrr.veh.repair", repairVehicle);
|
||||
|
||||
addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
|
||||
@@ -324,4 +325,13 @@ function makePedStopAnimation(pedId) {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setLocalPlayerPedPartsAndProps(parts, props) {
|
||||
for(let i in parts) {
|
||||
localPlayer.changeBodyPart(parts[0], parts[1], parts[2]);
|
||||
localPlayer.changeBodyProp(props[0], props[1]);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -44,14 +44,18 @@ function processSync(event, deltaTime) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function toggleVehicleEngine(vehicle, state) {
|
||||
vehicle.engine = state;
|
||||
function setVehicleEngine(vehicleId, state) {
|
||||
getElementFromId(vehicleId).engine = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function toggleVehicleLights(vehicle, state) {
|
||||
getElementFromId(vehicle).lights = state;
|
||||
function setVehicleLights(vehicleId, state) {
|
||||
if(!state) {
|
||||
getElementFromId(vehicleId).lightStatus = 2;
|
||||
} else {
|
||||
getElementFromId(vehicleId).lightStatus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -65,7 +69,11 @@ function repairVehicle(syncId) {
|
||||
function syncVehicleProperties(vehicle) {
|
||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||
vehicle.lights = lightStatus;
|
||||
if(!lightStatus) {
|
||||
vehicle.lightStatus = 2;
|
||||
} else {
|
||||
vehicle.lightStatus = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||
@@ -339,6 +347,10 @@ function syncObjectProperties(object) {
|
||||
// ===========================================================================
|
||||
|
||||
function syncElementProperties(element) {
|
||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
||||
element.interior = getEntityData(element, "vrr.interior");
|
||||
}
|
||||
|
||||
switch(element.type) {
|
||||
case ELEMENT_VEHICLE:
|
||||
syncVehicleProperties(element);
|
||||
|
||||
@@ -334,8 +334,10 @@ function setLocalPlayerHeading(heading) {
|
||||
function setLocalPlayerInterior(interior) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting interior to ${interior}`);
|
||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
||||
localPlayer.interior = interior;
|
||||
gta.cameraInterior = interior;
|
||||
if(!isGTAIV()) {
|
||||
localPlayer.interior = interior;
|
||||
gta.cameraInterior = interior;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,7 +439,7 @@ function clearSelfOwnedVehicles() {
|
||||
|
||||
function setMouseCameraState(state) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(state)?"Enabled":"Disabled"} mouse camera`);
|
||||
mouseCameraEnabled = !mouseCameraEnabled;
|
||||
mouseCameraEnabled = state;
|
||||
SetStandardControlsEnabled(!mouseCameraEnabled);
|
||||
}
|
||||
|
||||
@@ -450,6 +452,13 @@ function toggleMouseCursor() {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function toggleMouseCursor() {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] ${(!gui.cursorEnabled)?"Enabled":"Disabled"} mouse cursor`);
|
||||
setMouseCameraState(!mouseCameraEnabled);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setPlayerWeaponDamageEvent(clientName, eventType) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Utilities] Set ${clientName} damage event type to ${eventType}`);
|
||||
weaponDamageEvent[clientName] = eventType;
|
||||
@@ -696,4 +705,25 @@ function processInteriorLightsRendering() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerFromParams(params) {
|
||||
let clients = getClients();
|
||||
if(isNaN(params)) {
|
||||
for(let i in clients) {
|
||||
if(!clients[i].console) {
|
||||
if(toLowerCase(clients[i].name).indexOf(toLowerCase(params)) != -1) {
|
||||
return clients[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(typeof clients[toInteger(params)] != "undefined") {
|
||||
return clients[toInteger(params)];
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
Reference in New Issue
Block a user