diff --git a/meta.xml b/meta.xml
index a155079d..ad39e1d7 100644
--- a/meta.xml
+++ b/meta.xml
@@ -9,6 +9,7 @@
+
diff --git a/scripts/client/event.js b/scripts/client/event.js
index f0e0d0cb..bc5bc75e 100644
--- a/scripts/client/event.js
+++ b/scripts/client/event.js
@@ -151,7 +151,7 @@ function onElementStreamIn(event, element) {
function onLocalPlayerExitedVehicle(event, vehicle, seat) {
logToConsole(LOG_DEBUG, `[VRR.Event] Local player exited vehicle`);
- triggerNetworkEvent("ag.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ triggerNetworkEvent("vrr.onPlayerExitVehicle", getVehicleForNetworkEvent(vehicle), seat);
if(inVehicleSeat) {
parkedVehiclePosition = false;
parkedVehicleHeading = false;
@@ -162,7 +162,7 @@ function onLocalPlayerExitedVehicle(event, vehicle, seat) {
function onLocalPlayerEnteredVehicle(event, vehicle, seat) {
logToConsole(LOG_DEBUG, `[VRR.Event] Local player entered vehicle`);
- triggerNetworkEvent("ag.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
+ triggerNetworkEvent("vrr.onPlayerEnterVehicle", getVehicleForNetworkEvent(vehicle), seat);
if(inVehicleSeat == 0) {
if(inVehicle.owner != -1) {
@@ -187,7 +187,7 @@ function onPedInflictDamage(event, damagedEntity, damagerEntity, weaponId, healt
if(damagedEntity == localPlayer) {
if(!weaponDamageEnabled[damagerEntity.name]) {
event.preventDefault();
- triggerNetworkEvent("ag.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
+ triggerNetworkEvent("vrr.weaponDamage", damagerEntity.name, weaponId, pedPiece, healthLoss);
}
}
}
diff --git a/scripts/client/gui.js b/scripts/client/gui.js
index 1f91c0b6..82ec605f 100644
--- a/scripts/client/gui.js
+++ b/scripts/client/gui.js
@@ -857,7 +857,7 @@ function initGUI() {
let checkLogin = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking login with server ...`);
- triggerNetworkEvent("ag.checkLogin", login.passwordInput.lines[0]);
+ triggerNetworkEvent("vrr.checkLogin", login.passwordInput.lines[0]);
}
// ===========================================================================
@@ -880,7 +880,7 @@ let loginSuccess = function() {
let checkRegistration = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking registration with server ...`);
- triggerNetworkEvent("ag.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
+ triggerNetworkEvent("vrr.checkRegistration", register.passwordInput.lines[0], register.confirmPasswordInput.lines[0], register.emailInput.lines[0]);
}
// ===========================================================================
@@ -897,7 +897,7 @@ let checkNewCharacter = function() {
return false;
}
- triggerNetworkEvent("ag.checkNewCharacter",
+ triggerNetworkEvent("vrr.checkNewCharacter",
newCharacter.firstNameInput.lines[0],
newCharacter.lastNameInput.lines[0],
);
@@ -922,6 +922,14 @@ let newCharacterFailed = function(errorMessage) {
newCharacter.messageLabel.styles.main.textColour = toColour(180, 32, 32, 255);
newCharacter.firstNameInput.text = "";
newCharacter.lastNameInput.text = "";
+
+ if(!newCharacter.window.shown) {
+ closeAllWindows();
+ setChatWindowEnabled(false);
+ mexui.setInput(true);
+ setHUDEnabled(false);
+ newCharacter.window.shown = true;
+ }
}
// ===========================================================================
@@ -951,7 +959,7 @@ let twoFactorAuthSuccess = function() {
let checkTwoFactorAuth = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Checking two-factor authentication with server ...`);
- triggerNetworkEvent("ag.checkTwoFactorAuth", twoFactorAuth.codeInput.lines[0]);
+ triggerNetworkEvent("vrr.checkTwoFactorAuth", twoFactorAuth.codeInput.lines[0]);
}
// ===========================================================================
@@ -997,7 +1005,7 @@ let closeAllWindows = function() {
let yesNoDialogAnswerNo = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer NO to server prompt`);
- triggerNetworkEvent("ag.promptAnswerNo");
+ triggerNetworkEvent("vrr.promptAnswerNo");
closeAllWindows();
}
@@ -1005,7 +1013,7 @@ let yesNoDialogAnswerNo = function() {
let yesNoDialogAnswerYes = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Responding with answer YES to server prompt`);
- triggerNetworkEvent("ag.promptAnswerYes");
+ triggerNetworkEvent("vrr.promptAnswerYes");
closeAllWindows();
}
@@ -1100,21 +1108,21 @@ let showNewCharacter = function() {
let selectNextCharacter = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting next character info from server for character select window`);
- triggerNetworkEvent("ag.nextCharacter");
+ triggerNetworkEvent("vrr.nextCharacter");
}
// ===========================================================================
let selectPreviousCharacter = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Requesting previous character info from server for character select window`);
- triggerNetworkEvent("ag.previousCharacter");
+ triggerNetworkEvent("vrr.previousCharacter");
}
// ===========================================================================
let selectThisCharacter = function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Tell server the current shown character was selected in character select window`);
- triggerNetworkEvent("ag.selectCharacter");
+ triggerNetworkEvent("vrr.selectCharacter");
}
// ===========================================================================
@@ -1133,70 +1141,70 @@ let switchCharacterSelect = function(firstName, lastName, cash, clan, lastPlayed
// ===========================================================================
-addNetworkHandler("ag.showLogin", function() {
+addNetworkHandler("vrr.showLogin", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show login window`);
showLogin();
});
// ===========================================================================
-addNetworkHandler("ag.showRegistration", function() {
+addNetworkHandler("vrr.showRegistration", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show registration window`);
showRegistration();
});
// ===========================================================================
-addNetworkHandler("ag.showNewCharacter", function() {
+addNetworkHandler("vrr.showNewCharacter", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show new character window`);
showNewCharacter();
});
// ===========================================================================
-addNetworkHandler("ag.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
+addNetworkHandler("vrr.showCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show character selection window`);
showCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
});
// ===========================================================================
-addNetworkHandler("ag.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
+addNetworkHandler("vrr.switchCharacterSelect", function(firstName, lastName, cash, clan, lastPlayed, skinId) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to update character selection window with new info`);
switchCharacterSelect(firstName, lastName, cash, clan, lastPlayed, skinId);
});
// ===========================================================================
-addNetworkHandler("ag.showError", function(errorMessage, errorTitle) {
+addNetworkHandler("vrr.showError", function(errorMessage, errorTitle) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show error window`);
showError(errorMessage, errorTitle);
});
// ===========================================================================
-addNetworkHandler("ag.showPrompt", function(promptMessage, promptTitle) {
+addNetworkHandler("vrr.showPrompt", function(promptMessage, promptTitle) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show prompt window`);
showYesNo(promptMessage, promptTitle);
});
// ===========================================================================
-addNetworkHandler("ag.showInfo", function(infoMessage) {
+addNetworkHandler("vrr.showInfo", function(infoMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received request from server to show info dialog`);
showInfo(infoMessage);
});
// ===========================================================================
-addNetworkHandler("ag.loginSuccess", function() {
+addNetworkHandler("vrr.loginSuccess", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful login from server`);
loginSuccess();
});
// ===========================================================================
-addNetworkHandler("ag.characterSelectSuccess", function() {
+addNetworkHandler("vrr.characterSelectSuccess", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful character selection from server`);
characterSelectSuccess();
setChatWindowEnabled(true);
@@ -1204,35 +1212,35 @@ addNetworkHandler("ag.characterSelectSuccess", function() {
// ===========================================================================
-addNetworkHandler("ag.loginFailed", function(remainingAttempts) {
+addNetworkHandler("vrr.loginFailed", function(remainingAttempts) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed login from server`);
loginFailed(remainingAttempts);
});
// ===========================================================================
-addNetworkHandler("ag.registrationSuccess", function() {
+addNetworkHandler("vrr.registrationSuccess", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of successful registration from server`);
registrationSuccess();
});
// ===========================================================================
-addNetworkHandler("ag.registrationFailed", function(errorMessage) {
+addNetworkHandler("vrr.registrationFailed", function(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
registrationFailed(errorMessage);
});
// ===========================================================================
-addNetworkHandler("ag.newCharacterFailed", function(errorMessage) {
+addNetworkHandler("vrr.newCharacterFailed", function(errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received signal of failed registration from server`);
newCharacterFailed(errorMessage);
});
// ===========================================================================
-addNetworkHandler("ag.guiColour", function(red, green, blue) {
+addNetworkHandler("vrr.guiColour", function(red, green, blue) {
logToConsole(LOG_DEBUG, `[VRR.GUI] Received new GUI colours from server`);
primaryColour = [red, green, blue];
focusedColour = [red+focusedColourOffset, green+focusedColourOffset, blue+focusedColourOffset];
@@ -1240,10 +1248,10 @@ addNetworkHandler("ag.guiColour", function(red, green, blue) {
// ===========================================================================
-addNetworkHandler("ag.guiInit", function() {
+addNetworkHandler("vrr.guiInit", function() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Initializing MexUI app`);
initGUI();
- triggerNetworkEvent("ag.guiReady", true);
+ triggerNetworkEvent("vrr.guiReady", true);
});
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/label.js b/scripts/client/label.js
index ce6f408f..6b47843f 100644
--- a/scripts/client/label.js
+++ b/scripts/client/label.js
@@ -103,7 +103,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
let bizInfoText = "";
switch(bizLabelInfoType) {
case VRR_BIZLABEL_INFO_ENTER:
- if(enterPropertyKey != null) {
+ if(enterPropertyKey) {
bizInfoText = `Press ${toUpperCase(getKeyNameFromId(enterPropertyKey))} to enter`;
} else {
bizInfoText = `Use /enter to enter here`;
@@ -224,29 +224,29 @@ function processLabelRendering() {
if(localPlayer != null) {
let pickups = getElementsByType(ELEMENT_PICKUP);
for(let i in pickups) {
- if(pickups[i].getData("ag.label.type") != null) {
+ if(pickups[i].getData("vrr.label.type") != null) {
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
let price = 0;
let bizLabelInfoType = VRR_BIZLABEL_INFO_NONE;
- if(pickups[i].getData("ag.label.price") != null) {
- price = makeLargeNumberReadable(pickups[i].getData("ag.label.price"));
+ if(pickups[i].getData("vrr.label.price") != null) {
+ price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
}
- if(pickups[i].getData("ag.label.help") != null) {
- bizLabelInfoType = pickups[i].getData("ag.label.help");
+ if(pickups[i].getData("vrr.label.help") != null) {
+ bizLabelInfoType = pickups[i].getData("vrr.label.help");
}
- switch(pickups[i].getData("ag.label.type")) {
+ switch(pickups[i].getData("vrr.label.type")) {
case VRR_LABEL_BUSINESS:
- renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), true, price, bizLabelInfoType);
+ renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, bizLabelInfoType);
break;
case VRR_LABEL_HOUSE:
- renderPropertyEntranceLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.locked"), false, price, bizLabelInfoType);
+ renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, bizLabelInfoType);
break;
case VRR_LABEL_JOB:
- renderJobLabel(pickups[i].getData("ag.label.name"), pickups[i].position, pickups[i].getData("ag.label.jobType"));
+ renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
break;
case VRR_LABEL_EXIT:
diff --git a/scripts/client/main.js b/scripts/client/main.js
index b0575b3f..6c929e2d 100644
--- a/scripts/client/main.js
+++ b/scripts/client/main.js
@@ -41,6 +41,8 @@ let drunkEffectDurationTimer = null;
let controlsEnabled = true;
let streamingRadio = null;
+let streamingRadioVolume = 50;
+let streamingRadioElement = false;
let enterPropertyKey = null;
diff --git a/scripts/client/server.js b/scripts/client/server.js
index d8904ada..90a6c627 100644
--- a/scripts/client/server.js
+++ b/scripts/client/server.js
@@ -18,89 +18,93 @@ function initServerScript() {
function addAllNetworkHandlers() {
logToConsole(LOG_DEBUG, "[VRR.Server]: Adding network handlers ...");
- addNetworkHandler("ag.smallGameMessage", showSmallGameMessage);
- addNetworkHandler("ag.working", setLocalPlayerWorkingState);
- addNetworkHandler("ag.jobType", setLocalPlayerJobType);
- addNetworkHandler("ag.passenger", enterVehicleAsPassenger);
+ addNetworkHandler("vrr.smallGameMessage", showSmallGameMessage);
+ addNetworkHandler("vrr.working", setLocalPlayerWorkingState);
+ addNetworkHandler("vrr.jobType", setLocalPlayerJobType);
+ addNetworkHandler("vrr.passenger", enterVehicleAsPassenger);
- addNetworkHandler("ag.freeze", setLocalPlayerFrozenState);
- addNetworkHandler("ag.control", setLocalPlayerControlState);
- addNetworkHandler("ag.fadeCamera", fadeLocalCamera);
- addNetworkHandler("ag.removeFromVehicle", removeLocalPlayerFromVehicle);
- addNetworkHandler("ag.clearPeds", clearLocalPlayerOwnedPeds);
- addNetworkHandler("ag.restoreCamera", restoreLocalCamera);
- addNetworkHandler("ag.cameraLookAt", setLocalCameraLookAt);
- addNetworkHandler("ag.logo", setServerLogoRenderState);
- addNetworkHandler("ag.ambience", setCityAmbienceState);
- addNetworkHandler("ag.runCode", runClientCode);
- addNetworkHandler("ag.clearWeapons", clearLocalPlayerWeapons);
- addNetworkHandler("ag.giveWeapon", giveLocalPlayerWeapon);
- addNetworkHandler("ag.position", setLocalPlayerPosition);
- addNetworkHandler("ag.heading", setLocalPlayerHeading);
- addNetworkHandler("ag.interior", setLocalPlayerInterior);
- addNetworkHandler("ag.minuteDuration", setMinuteDuration);
- addNetworkHandler("ag.showJobRouteStop", showJobRouteStop);
- addNetworkHandler("ag.snow", setSnowState);
- addNetworkHandler("ag.health", setLocalPlayerHealth);
- addNetworkHandler("ag.enterPropertyKey", setEnterPropertyKey);
- addNetworkHandler("ag.skinSelect", toggleSkinSelect);
- addNetworkHandler("ag.hotbar", updatePlayerHotBar);
- addNetworkHandler("ag.pedSpeech", playPedSpeech);
- addNetworkHandler("ag.clearPedState", clearLocalPedState);
- addNetworkHandler("ag.drunkEffect", setLocalPlayerDrunkEffect);
- addNetworkHandler("ag.showItemActionDelay", showItemActionDelay);
- addNetworkHandler("ag.set2DRendering", setPlayer2DRendering);
- addNetworkHandler("ag.mouseCursor", setMouseCursorState);
- addNetworkHandler("ag.mouseCamera", setMouseCameraState);
- addNetworkHandler("ag.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
- addNetworkHandler("ag.weaponDamageEvent", setPlayerWeaponDamageEvent);
- addNetworkHandler("ag.spawned", onServerSpawnedPlayer);
- addNetworkHandler("ag.money", setLocalPlayerCash);
+ addNetworkHandler("vrr.freeze", setLocalPlayerFrozenState);
+ addNetworkHandler("vrr.control", setLocalPlayerControlState);
+ addNetworkHandler("vrr.fadeCamera", fadeLocalCamera);
+ addNetworkHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
+ addNetworkHandler("vrr.clearPeds", clearLocalPlayerOwnedPeds);
+ addNetworkHandler("vrr.restoreCamera", restoreLocalCamera);
+ addNetworkHandler("vrr.cameraLookAt", setLocalCameraLookAt);
+ addNetworkHandler("vrr.logo", setServerLogoRenderState);
+ addNetworkHandler("vrr.ambience", setCityAmbienceState);
+ addNetworkHandler("vrr.runCode", runClientCode);
+ addNetworkHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
+ addNetworkHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
+ addNetworkHandler("vrr.position", setLocalPlayerPosition);
+ addNetworkHandler("vrr.heading", setLocalPlayerHeading);
+ addNetworkHandler("vrr.interior", setLocalPlayerInterior);
+ addNetworkHandler("vrr.minuteDuration", setMinuteDuration);
+ addNetworkHandler("vrr.showJobRouteStop", showJobRouteStop);
+ addNetworkHandler("vrr.snow", setSnowState);
+ addNetworkHandler("vrr.health", setLocalPlayerHealth);
+ addNetworkHandler("vrr.enterPropertyKey", setEnterPropertyKey);
+ addNetworkHandler("vrr.skinSelect", toggleSkinSelect);
+ addNetworkHandler("vrr.hotbar", updatePlayerHotBar);
+ addNetworkHandler("vrr.pedSpeech", playPedSpeech);
+ addNetworkHandler("vrr.clearPedState", clearLocalPedState);
+ addNetworkHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
+ addNetworkHandler("vrr.showItemActionDelay", showItemActionDelay);
+ addNetworkHandler("vrr.set2DRendering", setPlayer2DRendering);
+ addNetworkHandler("vrr.mouseCursor", setMouseCursorState);
+ addNetworkHandler("vrr.mouseCamera", setMouseCameraState);
+ addNetworkHandler("vrr.weaponDamageEnabled", setPlayerWeaponDamageEnabled);
+ addNetworkHandler("vrr.weaponDamageEvent", setPlayerWeaponDamageEvent);
+ addNetworkHandler("vrr.spawned", onServerSpawnedPlayer);
+ addNetworkHandler("vrr.money", setLocalPlayerCash);
- addNetworkHandler("ag.excludeGroundSnow", excludeModelFromGroundSnow);
- addNetworkHandler("ag.removeWorldObject", removeWorldObject);
+ addNetworkHandler("vrr.excludeGroundSnow", excludeModelFromGroundSnow);
+ addNetworkHandler("vrr.removeWorldObject", removeWorldObject);
- addNetworkHandler("ag.delKeyBind", unBindAccountKey);
- addNetworkHandler("ag.addKeyBind", bindAccountKey);
+ addNetworkHandler("vrr.delKeyBind", unBindAccountKey);
+ addNetworkHandler("vrr.addKeyBind", bindAccountKey);
- addNetworkHandler("ag.nametag", updatePlayerNameTag);
- addNetworkHandler("ag.ping", updatePlayerPing);
+ addNetworkHandler("vrr.nametag", updatePlayerNameTag);
+ addNetworkHandler("vrr.ping", updatePlayerPing);
- addNetworkHandler("ag.m", receiveChatBoxMessageFromServer);
- addNetworkHandler("ag.chatScrollLines", setChatScrollLines);
+ addNetworkHandler("vrr.m", receiveChatBoxMessageFromServer);
+ addNetworkHandler("vrr.chatScrollLines", setChatScrollLines);
- addNetworkHandler("ag.radioStream", playStreamingRadio);
- addNetworkHandler("ag.radioVolume", setStreamingRadioVolume);
+ addNetworkHandler("vrr.radioStream", playStreamingRadio);
+ addNetworkHandler("vrr.radioVolume", setStreamingRadioVolume);
- addNetworkHandler("ag.veh.lights", toggleVehicleLights);
- addNetworkHandler("ag.veh.engine", toggleVehicleEngine);
+ addNetworkHandler("vrr.veh.lights", toggleVehicleLights);
+ addNetworkHandler("vrr.veh.engine", toggleVehicleEngine);
- addNetworkHandler("ag.veh.sync", syncVehicleProperties);
- addNetworkHandler("ag.civ.sync", syncCivilianProperties);
- addNetworkHandler("ag.plr.sync", syncPlayerProperties);
- addNetworkHandler("ag.obj.sync", syncObjectProperties);
+ addNetworkHandler("vrr.veh.sync", syncVehicleProperties);
+ addNetworkHandler("vrr.civ.sync", syncCivilianProperties);
+ addNetworkHandler("vrr.plr.sync", syncPlayerProperties);
+ addNetworkHandler("vrr.obj.sync", syncObjectProperties);
- addNetworkHandler("ag.veh.repair", repairVehicle);
+ addNetworkHandler("vrr.veh.repair", repairVehicle);
- addNetworkHandler("ag.pedAnim", makePedPlayAnimation);
+ addNetworkHandler("vrr.pedAnim", makePedPlayAnimation);
+
+ addNetworkHandler("vrr.hideAllGUI", hideAllGUI);
}
// ===========================================================================
function sendResourceReadySignalToServer() {
- triggerNetworkEvent("ag.clientReady");
+ triggerNetworkEvent("vrr.clientReady");
}
// ===========================================================================
function sendResourceStartedSignalToServer() {
- triggerNetworkEvent("ag.clientStarted");
+ triggerNetworkEvent("vrr.clientStarted");
}
// ===========================================================================
function sendResourceStoppedSignalToServer() {
- triggerNetworkEvent("ag.clientStopped");
+ if(isConnected) {
+ triggerNetworkEvent("vrr.clientStopped");
+ }
}
// ===========================================================================
@@ -183,42 +187,55 @@ function onServerSpawnedPlayer(state) {
gta.setGameStat(STAT_UNDERWATER_STAMINA, 9999);
gta.setGameStat(STAT_BODY_MUSCLE, 0);
}
+
+ if(getGame() == VRR_GAME_GTA_IV) {
+ natives.allowEmergencyServices(false);
+ natives.setCreateRandomCops(false);
+ natives.setMaxWantedLevel(0);
+ natives.setWantedMultiplier(0.0);
+ natives.allowPlayerToCarryNonMissionObjects(natives.getPlayerId(), true);
+
+ natives.setPlayerTeam(natives.getPlayerId(), 0);
+ natives.usePlayerColourInsteadOfTeamColour(true);
+ natives.requestAnims("DANCING");
+ natives.loadAllObjectsNow();
+ }
}
}
// ===========================================================================
function tellServerPlayerUsedKeyBind(key) {
- triggerNetworkEvent("ag.useKeyBind", key);
+ triggerNetworkEvent("vrr.useKeyBind", key);
}
// ===========================================================================
function tellServerPlayerArrivedAtJobRouteStop() {
- triggerNetworkEvent("ag.arrivedAtJobRouteStop");
+ triggerNetworkEvent("vrr.arrivedAtJobRouteStop");
}
// ===========================================================================
function tellServerItemActionDelayComplete() {
- triggerNetworkEvent("ag.itemActionDelayComplete");
+ triggerNetworkEvent("vrr.itemActionDelayComplete");
}
// ===========================================================================
function sendServerClientInfo() {
- triggerNetworkEvent("ag.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, gta.width, gta.height);
+ triggerNetworkEvent("vrr.clientInfo", `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`, gta.width, gta.height);
}
// ===========================================================================
function sendServerNewAFKStatus(state) {
- triggerNetworkEvent("ag.afk", state);
+ triggerNetworkEvent("vrr.afk", state);
}
// ===========================================================================
-function playStreamingRadio(url, loop, volume) {
+function playStreamingRadio(url, loop, volume, element = false) {
//gta.forceRadioChannel(-1);
if(url == "") {
if(streamingRadio != null) {
@@ -231,6 +248,12 @@ function playStreamingRadio(url, loop, volume) {
streamingRadio.stop();
}
+ // if(element != -1) {
+ // streamingRadioElement = getElementFromId(element);
+ //}
+
+ streamingRadioVolume = volume;
+
streamingRadio = audio.createSoundFromURL(url, loop);
streamingRadio.volume = volume/100;
streamingRadio.play();
@@ -240,6 +263,7 @@ function playStreamingRadio(url, loop, volume) {
function setStreamingRadioVolume(volume) {
if(streamingRadio != null) {
+ streamingRadioVolume = volume;
streamingRadio.volume = volume/100;
}
}
@@ -258,12 +282,24 @@ function setEnterPropertyKey(key) {
// ===========================================================================
-function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed) {
- if(animType == VRR_ANIMTYPE_ADD) {
- getElementFromId(pedId).addAnimation(animGroup, animId);
- } else if(animType == VRR_ANIMTYPE_BLEND) {
- getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
+function makePedPlayAnimation(pedId, animGroup, animId, animType, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition) {
+ if(getGame() < VRR_GAME_GTA_IV) {
+ if(animType == VRR_ANIMTYPE_ADD) {
+ getElementFromId(pedId).addAnimation(animGroup, animId);
+ } else if(animType == VRR_ANIMTYPE_BLEND) {
+ getElementFromId(pedId).blendAnimation(animGroup, animId, animSpeed);
+ }
+ } else {
+ natives.requestAnims(animGroup);
+ natives.taskPlayAnimNonInterruptable(getElementFromId(pedId), animId, animGroup, animSpeed, loop, loopNoControl, freezeLastFrame, returnToOriginalPosition, -1);
}
}
+// ===========================================================================
+
+function hideAllGUI() {
+ closeAllWindows();
+ setChatWindowEnabled(true);
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/client/skin-select.js b/scripts/client/skin-select.js
index 68820b79..106fb215 100644
--- a/scripts/client/skin-select.js
+++ b/scripts/client/skin-select.js
@@ -79,9 +79,9 @@ function processSkinSelectKeyPress(keyCode) {
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
skinSelectMessageTextTop = allowedSkins[gta.game][skinSelectorIndex][1];
} else if(keyCode == SDLK_RETURN) {
- triggerNetworkEvent("ag.skinSelected", skinSelectorIndex);
+ triggerNetworkEvent("vrr.skinSelected", skinSelectorIndex);
} else if(keyCode == SDLK_BACKSPACE) {
- triggerNetworkEvent("ag.skinSelected", -1);
+ triggerNetworkEvent("vrr.skinSelected", -1);
}
}
}
@@ -109,7 +109,7 @@ function processSkinSelectRendering() {
function toggleSkinSelect(state) {
if(state) {
- skinSelectorIndex = allowedSkins[gta.game][0];
+ skinSelectorIndex = 0;
if(localPlayer.skin != allowedSkins[gta.game][skinSelectorIndex][0]) {
localPlayer.skin = allowedSkins[gta.game][skinSelectorIndex][0];
}
diff --git a/scripts/client/sync.js b/scripts/client/sync.js
index 80313fca..ee8c195c 100644
--- a/scripts/client/sync.js
+++ b/scripts/client/sync.js
@@ -7,19 +7,34 @@
// TYPE: Client (JavaScript)
// ===========================================================================
-// ===========================================================================
-
function processSync(event, deltaTime) {
if(localPlayer != null) {
if(gta.game == GAME_GTA_IV) {
- triggerNetworkEvent("ag.player.position", localPlayer.position);
- triggerNetworkEvent("ag.player.heading", localPlayer.heading);
+ triggerNetworkEvent("vrr.player.position", localPlayer.position);
+ triggerNetworkEvent("vrr.player.heading", localPlayer.heading);
+ }
+
+ if(gta.game == GAME_GTA_SA) {
+ let lookAtPos = getLocalPlayerLookAtPosition();
+ triggerNetworkEvent("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) {
logToConsole(LOG_DEBUG, `Local player died`);
localPlayer.clearWeapons();
- triggerNetworkEvent("ag.playerDeath", localPlayer.position);
+ triggerNetworkEvent("vrr.playerDeath", localPlayer.position);
+ }
+
+ if(streamingRadioElement) {
+ streamingRadio.position = getElementPosition(streamingRadioElement);
+ //streamingRadio.volume = getStreamingRadioVolumeForPosition(streamingRadio.position);
}
}
}
@@ -45,40 +60,40 @@ function repairVehicle(syncId) {
// ===========================================================================
function syncVehicleProperties(vehicle) {
- if(doesEntityDataExist(vehicle, "ag.lights")) {
- let lightStatus = getEntityData(vehicle, "ag.lights");
+ if(doesEntityDataExist(vehicle, "vrr.lights")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lights");
vehicle.lights = lightStatus;
}
- if(doesEntityDataExist(vehicle, "ag.panelStatus")) {
- let panelsStatus = getEntityData(vehicle, "ag.panelStatus");
+ if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
+ let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
for(let i in panelsStatus) {
vehicle.setPanelStatus(i, panelsStatus[i]);
}
}
- if(doesEntityDataExist(vehicle, "ag.wheelStatus")) {
- let wheelsStatus = getEntityData(vehicle, "ag.wheelStatus");
+ if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
+ let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
for(let i in wheelsStatus) {
vehicle.setWheelStatus(i, wheelsStatus[i]);
}
}
- if(doesEntityDataExist(vehicle, "ag.lightStatus")) {
- let lightStatus = getEntityData(vehicle, "ag.lightStatus");
+ if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
+ let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
for(let i in lightStatus) {
vehicle.setLightStatus(i, lightStatus[i]);
}
}
- //if(doesEntityDataExist(vehicle, "ag.suspensionHeight")) {
- // let suspensionHeight = getEntityData(vehicle, "ag.suspensionHeight");
+ //if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
+ // let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
// vehicle.setSuspensionHeight(suspensionHeight);
//}
if(getGame() == GAME_GTA_SA) {
- if(doesEntityDataExist(vehicle, "ag.upgrades")) {
- let upgrades = getEntityData(vehicle, "ag.upgrades");
+ if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
+ let upgrades = getEntityData(vehicle, "vrr.upgrades");
for(let i in upgrades) {
vehicle.addUpgrade(upgrades[i]);
}
@@ -86,8 +101,8 @@ function syncVehicleProperties(vehicle) {
}
if(getGame() == GAME_GTA_SA || getGame() == GAME_GTA_IV) {
- if(doesEntityDataExist(vehicle, "ag.livery")) {
- let livery = getEntityData(vehicle, "ag.livery");
+ if(doesEntityDataExist(vehicle, "vrr.livery")) {
+ let livery = getEntityData(vehicle, "vrr.livery");
if(getGame() == GAME_GTA_SA) {
vehicle.setPaintJob(livery);
} else if(getGame() == GAME_GTA_IV) {
@@ -103,8 +118,8 @@ function syncVehicleProperties(vehicle) {
function syncCivilianProperties(civilian) {
if(getGame() == GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "ag.scale")) {
- let scaleFactor = getEntityData(civilian, "ag.scale");
+ if(doesEntityDataExist(civilian, "vrr.scale")) {
+ let scaleFactor = getEntityData(civilian, "vrr.scale");
let tempMatrix = civilian.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = civilian.position;
@@ -115,78 +130,78 @@ function syncCivilianProperties(civilian) {
}
if(getGame() == GAME_GTA_SA) {
- if(doesEntityDataExist(civilian, "ag.fightStyle")) {
- let fightStyle = getEntityData(civilian, "ag.fightStyle");
+ if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(civilian, "vrr.fightStyle");
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
}
}
if(getGame() == GAME_GTA_III) {
- if(doesEntityDataExist(civilian, "ag.walkStyle")) {
- let walkStyle = getEntityData(civilian, "ag.walkStyle");
+ if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
+ let walkStyle = getEntityData(civilian, "vrr.walkStyle");
civilian.walkStyle = walkStyle;
}
}
if(getGame() == GAME_GTA_IV) {
- if(doesEntityDataExist(civilian, "ag.bodyPropHair")) {
- let bodyPropHair = getEntityData(civilian, "ag.bodyPropHair");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropHead")) {
- let bodyPropHead = getEntityData(civilian, "ag.bodyPropHead");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(civilian, "ag.bodyPropEyes");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(civilian, "ag.bodyPropLeftHand");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(civilian, "ag.bodyPropRightHand");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(civilian, "ag.bodyPropLeftWrist");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(civilian, "ag.bodyPropRightWrist");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropHip")) {
- let bodyPropHip = getEntityData(civilian, "ag.bodyPropHip");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(civilian, "ag.bodyPropLeftFoot");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
- if(doesEntityDataExist(civilian, "ag.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(civilian, "ag.bodyPropRightFoot");
+ if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
}
- if(doesEntityDataExist(civilian, "ag.anim")) {
- let animData = getEntityData(vehicle, "ag.anim");
+ if(doesEntityDataExist(civilian, "vrr.anim")) {
+ let animData = getEntityData(vehicle, "vrr.anim");
civilian.addAnimation(animData[0], animData[1]);
}
}
@@ -195,8 +210,8 @@ function syncCivilianProperties(civilian) {
function syncPlayerProperties(player) {
if(getGame() == GAME_GTA_III) {
- if(doesEntityDataExist(player, "ag.scale")) {
- let scaleFactor = getEntityData(player, "ag.scale");
+ if(doesEntityDataExist(player, "vrr.scale")) {
+ let scaleFactor = getEntityData(player, "vrr.scale");
let tempMatrix = player.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = player.position;
@@ -207,94 +222,94 @@ function syncPlayerProperties(player) {
}
if(getGame() == GAME_GTA_SA) {
- if(doesEntityDataExist(player, "ag.fightStyle")) {
- let fightStyle = getEntityData(player, "ag.fightStyle");
+ if(doesEntityDataExist(player, "vrr.fightStyle")) {
+ let fightStyle = getEntityData(player, "vrr.fightStyle");
player.fightStyle = fightStyle;
}
}
//if(getGame() == GAME_GTA_SA) {
- // if(doesEntityDataExist(player, "ag.walkStyle")) {
- // let walkStyle = getEntityData(player, "ag.walkStyle");
+ // if(doesEntityDataExist(player, "vrr.walkStyle")) {
+ // let walkStyle = getEntityData(player, "vrr.walkStyle");
// player.walkStyle = walkStyle;
// }
//}
if(getGame() == GAME_GTA_IV) {
- if(doesEntityDataExist(player, "ag.bodyPartHair")) {
- let bodyPartHead = getEntityData(player, "ag.bodyPartHair");
+ if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPartHead")) {
- let bodyPartHead = getEntityData(player, "ag.bodyPartHead");
+ if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
+ let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPartUpper")) {
- let bodyPartUpper = getEntityData(player, "ag.bodyPartUpper");
+ if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
+ let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPartLower")) {
- let bodyPartLower = getEntityData(player, "ag.bodyPartLower");
+ if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
+ let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
}
}
if(getGame() == GAME_GTA_IV) {
- if(doesEntityDataExist(player, "ag.bodyPropHair")) {
- let bodyPropHair = getEntityData(player, "ag.bodyPropHair");
+ if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
+ let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropHead")) {
- let bodyPropHead = getEntityData(player, "ag.bodyPropHead");
+ if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
+ let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropEyes")) {
- let bodyPropEyes = getEntityData(player, "ag.bodyPropEyes");
+ if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
+ let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropLeftHand")) {
- let bodyPropLeftHand = getEntityData(player, "ag.bodyPropLeftHand");
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
+ let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropRightHand")) {
- let bodyPropRightHand = getEntityData(player, "ag.bodyPropRightHand");
+ if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
+ let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropLeftWrist")) {
- let bodyPropLeftWrist = getEntityData(player, "ag.bodyPropLeftWrist");
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
+ let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropRightWrist")) {
- let bodyPropRightWrist = getEntityData(player, "ag.bodyPropRightWrist");
+ if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
+ let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropHip")) {
- let bodyPropHip = getEntityData(player, "ag.bodyPropHip");
+ if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
+ let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropLeftFoot")) {
- let bodyPropLeftFoot = getEntityData(player, "ag.bodyPropLeftFoot");
+ if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
+ let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
}
- if(doesEntityDataExist(player, "ag.bodyPropRightFoot")) {
- let bodyPropRightFoot = getEntityData(player, "ag.bodyPropRightFoot");
+ if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
+ let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
}
}
@@ -304,8 +319,8 @@ function syncPlayerProperties(player) {
function syncObjectProperties(object) {
if(getGame() == GAME_GTA_III) {
- if(doesEntityDataExist(object, "ag.scale")) {
- let scaleFactor = getEntityData(object, "ag.scale");
+ if(doesEntityDataExist(object, "vrr.scale")) {
+ let scaleFactor = getEntityData(object, "vrr.scale");
let tempMatrix = object.matrix;
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
let tempPosition = object.position;
diff --git a/scripts/client/utilities.js b/scripts/client/utilities.js
index 84f41a7b..7bf5cc80 100644
--- a/scripts/client/utilities.js
+++ b/scripts/client/utilities.js
@@ -228,14 +228,18 @@ function setLocalCameraLookAt(cameraPosition, cameraLookAt) {
// ===========================================================================
-function setCityAmbienceState(state) {
+function setCityAmbienceState(state, clearElements = false) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Ambient civilians and traffic ${(state) ? "enabled" : "disabled"}`);
gta.setTrafficEnabled(state);
gta.setGenerateCarsAroundCamera(state);
if(gta.game != GAME_GTA_SA) {
gta.setCiviliansEnabled(state);
}
- clearSelfOwnedPeds();
+
+ if(clearElements) {
+ clearSelfOwnedPeds();
+ clearSelfOwnedVehicles();
+ }
}
// ===========================================================================
@@ -245,10 +249,10 @@ function runClientCode(code, returnTo) {
try {
returnValue = eval("(" + code + ")");
} catch(error) {
- triggerNetworkEvent("ag.runCodeFail", returnTo, code);
+ triggerNetworkEvent("vrr.runCodeFail", returnTo, code);
return false;
}
- triggerNetworkEvent("ag.runCodeSuccess", returnTo, code, returnValue);
+ triggerNetworkEvent("vrr.runCodeSuccess", returnTo, code, returnValue);
}
// ===========================================================================
@@ -394,9 +398,20 @@ function getLocalPlayerVehicleSeat() {
function clearSelfOwnedPeds() {
logToConsole(LOG_DEBUG, `Clearing self-owned peds`);
getElementsByType(ELEMENT_PED).forEach(function(ped) {
- if(ped.isOwner) {
+ //if(ped.isOwner) {
destroyElement(ped);
- }
+ //}
+ });
+}
+
+// ===========================================================================
+
+function clearSelfOwnedVehicles() {
+ logToConsole(LOG_DEBUG, `Clearing self-owned vehicles`);
+ getElementsByType(ELEMENT_VEHICLE).forEach(function(vehicle) {
+ //if(vehicle.isOwner) {
+ destroyElement(vehicle);
+ //}
});
}
@@ -433,7 +448,7 @@ function setPlayerWeaponDamageEnabled(clientName, state) {
function setLocalPlayerCash(amount) {
logToConsole(LOG_DEBUG, `[VRR.Utilities] Setting local player money`);
- localPlayer.money = amount;
+ localPlayer.money = toInteger(amount);
}
// ===========================================================================
@@ -634,4 +649,17 @@ function setMinuteDuration(minuteDuration) {
gta.time.minuteDuration = minuteDuration;
}
-// ===========================================================================
\ No newline at end of file
+// ===========================================================================
+
+function getStreamingRadioVolumeForPosition(position) {
+ return streamingRadioVolume;
+}
+
+// ===========================================================================
+
+function getLocalPlayerLookAtPosition() {
+ if(localPlayer != null) {
+ let centerCameraPos = getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, 0));
+ return getWorldFromScreenPosition(toVector3(gta.width/2, gta.height/2, getDistance(centerCameraPos, localPlayer.position)+20));
+ }
+}
\ No newline at end of file
diff --git a/scripts/server/accent.js b/scripts/server/accent.js
index 5d039a2d..a7501c2b 100644
--- a/scripts/server/accent.js
+++ b/scripts/server/accent.js
@@ -19,8 +19,19 @@ function setPlayerAccentText(client, text) {
// ===========================================================================
-function doesPlayerHaveAccent(client, text) {
+function doesPlayerHaveAccent(client) {
return (getPlayerCurrentSubAccount(client).accent != "");
}
+// ===========================================================================
+
+function getPlayerAccentInlineOutput(client) {
+ let outputText = "";
+ //if(doesPlayerHaveAccent(client)) {
+ // outputText = `[${getPlayerAccentText(client)}]`;
+ //}
+
+ return outputText;
+}
+
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/account.js b/scripts/server/account.js
index de9f0cb6..0c1ce4c6 100644
--- a/scripts/server/account.js
+++ b/scripts/server/account.js
@@ -536,7 +536,8 @@ function saveAccountToDatabase(accountData) {
acct_pass='${safePassword}',
acct_discord=${accountData.discordAccount},
acct_ip=INET_ATON('${accountData.ipAddress}'),
- acct_code_verifyemail='${accountData.emailVerificationCode}'
+ acct_code_verifyemail='${accountData.emailVerificationCode}',
+ acct_streaming_radio_volume=${accountData.streamingRadioVolume},
WHERE acct_id=${accountData.databaseId}`;
/*
@@ -933,7 +934,7 @@ function initClient(client) {
}
}
- playRadioStreamForPlayer(client, getServerConfig().introMusicURL, true, getPlayerData(client).streamingRadioVolume);
+ playRadioStreamForPlayer(client, getServerConfig().introMusicURL, true, getPlayerStreamingRadioVolume(client));
}, 2500);
}
@@ -945,7 +946,7 @@ function saveConnectionToDatabase(client) {
let safeName = escapeDatabaseString(dbConnection, getPlayerName(client));
let dbQueryString = `INSERT INTO conn_main (conn_when_connect, conn_server, conn_script_version, conn_game_version, conn_client_version, conn_name, conn_ip) VALUES (UNIX_TIMESTAMP(), ${getServerConfig().databaseId}, '${scriptVersion}', '${client.gameVersion}', '0.0.0', '${safeName}', INET_ATON('${client.ip}'))`;
let query = queryDatabase(dbConnection, dbQueryString);
- setEntityData(client, "ag.connection", getDatabaseInsertId(dbConnection));
+ setEntityData(client, "vrr.connection", getDatabaseInsertId(dbConnection));
}
}
diff --git a/scripts/server/animation.js b/scripts/server/animation.js
index 09956dea..b05051a2 100644
--- a/scripts/server/animation.js
+++ b/scripts/server/animation.js
@@ -29,12 +29,26 @@ function playPlayerAnimationCommand(command, params, client) {
getPlayerData(client).currentAnimation = animationSlot;
getPlayerData(client).animationStart = getCurrentUnixTimestamp();
- //setEntityData(getPlayerData(client).ped, "ag.animation", animationSlot, true);
+ //setEntityData(getPlayerData(client).ped, "vrr.animation", animationSlot, true);
makePedPlayAnimation(getPlayerData(client).ped, animationSlot);
}
// ===========================================================================
+function showAnimationListCommand(command, params, client) {
+ let animList = getGameData().animations[getServerGame()].map(function(x) { return x[0]; });
+
+ let chunkedList = splitArrayIntoChunks(animList, 10);
+
+ messagePlayerInfo(client, `${getInlineChatColourByType("clanOrange")}== ${getInlineChatColourByType("jobYellow")}Animation List ${getInlineChatColourByType("clanOrange")}===========================`);
+
+ for(let i in chunkedList) {
+ messagePlayerInfo(client, chunkedList[i].join(", "));
+ }
+}
+
+// ===========================================================================
+
function getAnimationData(animationSlot, gameId = getServerGame()) {
return getGameData().animations[gameId][animationSlot];
}
diff --git a/scripts/server/business.js b/scripts/server/business.js
index ab99239b..aa435a48 100644
--- a/scripts/server/business.js
+++ b/scripts/server/business.js
@@ -17,7 +17,7 @@ function initBusinessScript() {
createAllBusinessPickups();
}
- if(getServerConfig().createBusinessPickups) {
+ if(getServerConfig().createBusinessBlips) {
createAllBusinessBlips();
}
@@ -211,7 +211,7 @@ function setBusinessNameCommand(command, params, client) {
let oldBusinessName = getBusinessData(businessId).name;
getBusinessData(businessId).name = newBusinessName;
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.name", getBusinessData(businessId).name, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}renamed business ${getInlineChatColourByType("businessBlue")}${oldBusinessName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByType("businessBlue")}${newBusinessName}`);
}
@@ -322,7 +322,7 @@ function lockBusinessCommand(command, params, client) {
}
getBusinessData(businessId).locked = !getBusinessData(businessId).locked;
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.locked", getBusinessData(businessId).locked, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
messagePlayerSuccess(client, `${getLockedUnlockedEmojiFromBool((getBusinessData(businessId).locked))} Business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name} ${getInlineChatColourByName("white")}${getLockedUnlockedTextFromBool((getBusinessData(businessId).locked))}!`);
}
@@ -630,7 +630,7 @@ function setBusinessBuyPriceCommand(command, params, client) {
}
getBusinessData(businessId).buyPrice = amount;
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.price", getBusinessData(businessId).buyPrice, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
messagePlayerSuccess(client, `${getInlineChatColourByName("white")}You set business ${getInlineChatColourByType("businessBlue")}${getBusinessData(businessId).name}'s ${getInlineChatColourByName("white")}for-sale price to ${getInlineChatColourByName("lightGrey")}$${makeLargeNumberReadable(amount)}`);
}
@@ -848,7 +848,7 @@ function getClosestBusinessEntrance(position) {
// ===========================================================================
function isPlayerInAnyBusiness(client) {
- if(doesEntityDataExist(client, "ag.inBusiness")) {
+ if(doesEntityDataExist(client, "vrr.inBusiness")) {
return true;
}
@@ -858,8 +858,8 @@ function isPlayerInAnyBusiness(client) {
// ===========================================================================
function getPlayerBusiness(client) {
- if(doesEntityDataExist(client, "ag.inBusiness")) {
- return getEntityData(client, "ag.inBusiness");
+ if(doesEntityDataExist(client, "vrr.inBusiness")) {
+ return getEntityData(client, "vrr.inBusiness");
}
return -1;
@@ -1014,8 +1014,8 @@ function createBusinessEntrancePickup(businessId) {
}
getBusinessData(businessId).entrancePickup = gta.createPickup(pickupModelId, getBusinessData(businessId).entrancePosition);
- getBusinessData(businessId).entrancePickup.onAllDimensions = false;
getBusinessData(businessId).entrancePickup.dimension = getBusinessData(businessId).entranceDimension;
+ getBusinessData(businessId).entrancePickup.onAllDimensions = false;
updateBusinessPickupLabelData(businessId);
addToWorld(getBusinessData(businessId).entrancePickup);
}
@@ -1039,8 +1039,8 @@ function createBusinessEntranceBlip(businessId) {
getBusinessData(businessId).entranceBlip.onAllDimensions = false;
getBusinessData(businessId).entranceBlip.dimension = getBusinessData(businessId).entranceDimension;
//getBusinessData(businessId).entranceBlip.interior = getBusinessData(businessId).entranceInterior;
- setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
- setEntityData(getBusinessData(businessId).entranceBlip, "ag.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.type", VRR_BLIP_BUSINESS_ENTRANCE, false);
+ setEntityData(getBusinessData(businessId).entranceBlip, "vrr.owner.id", businessId, false);
addToWorld(getBusinessData(businessId).entranceBlip);
}
}
@@ -1061,8 +1061,8 @@ function createBusinessExitPickup(businessId) {
}
getBusinessData(businessId).exitPickup = gta.createPickup(pickupModelId, getBusinessData(businessId).exitPosition);
- getBusinessData(businessId).exitPickup.onAllDimensions = false;
getBusinessData(businessId).exitPickup.dimension = getBusinessData(businessId).exitDimension;
+ getBusinessData(businessId).exitPickup.onAllDimensions = false;
//getBusinessData(businessId).exitPickup.interior = getBusinessData(businessId).exitInterior;
addToWorld(getBusinessData(businessId).exitPickup);
}
@@ -1088,8 +1088,8 @@ function createBusinessExitBlip(businessId) {
getBusinessData(businessId).exitBlip.onAllDimensions = false;
getBusinessData(businessId).exitBlip.dimension = getBusinessData(businessId).entranceDimension;
//getBusinessData(businessId).exitBlip.interior = getBusinessData(businessId).exitInterior;
- setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.type", VRR_BLIP_BUSINESS_EXIT, false);
- setEntityData(getBusinessData(businessId).exitBlip, "ag.owner.id", businessId, false);
+ 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);
}
}
@@ -1147,13 +1147,13 @@ function removePlayerFromBusinesses(client) {
// ===========================================================================
function exitBusiness(client) {
- let businessId = getEntityData(client, "ag.inBusiness");
+ let businessId = getEntityData(client, "vrr.inBusiness");
if(isPlayerSpawned(client)) {
setPlayerInterior(client, getServerData().businesses[businessId].entranceInterior);
setPlayerDimension(client, client, getServerData().businesses[businessId].entranceDimension);
setPlayerPosition(client, client, getServerData().businesses[businessId].entrancePosition);
}
- removeEntityData(client, "ag.inBusiness");
+ removeEntityData(client, "vrr.inBusiness");
}
// ===========================================================================
@@ -1547,27 +1547,27 @@ function getHouseIdFromDatabaseId(databaseId) {
// ===========================================================================
function updateBusinessPickupLabelData(businessId) {
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.owner.type", VRR_PICKUP_BUSINESS_ENTRANCE, false);
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.owner.id", businessId, false);
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.type", VRR_LABEL_BUSINESS, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.name", getBusinessData(businessId).name, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.locked", getBusinessData(businessId).locked, true);
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.help", VRR_BIZLABEL_INFO_NONE, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_ENTRANCE, false);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.type", VRR_LABEL_BUSINESS, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.name", getBusinessData(businessId).name, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.locked", getBusinessData(businessId).locked, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_NONE, true);
if(getBusinessData(businessId).hasInterior) {
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.help", VRR_BIZLABEL_INFO_ENTER, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_ENTER, true);
} else {
if(getBusinessData(businessId).floorItemCache.length > 0) {
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.help", VRR_BIZLABEL_INFO_BUY, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.help", VRR_BIZLABEL_INFO_BUY, true);
}
}
if(getBusinessData(businessId).buyPrice > 0) {
- setEntityData(getBusinessData(businessId).entrancePickup, "ag.label.price", getBusinessData(businessId).buyPrice, true);
+ setEntityData(getBusinessData(businessId).entrancePickup, "vrr.label.price", getBusinessData(businessId).buyPrice, true);
}
- setEntityData(getBusinessData(businessId).exitPickup, "ag.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
- setEntityData(getBusinessData(businessId).exitPickup, "ag.owner.id", businessId, false);
- setEntityData(getBusinessData(businessId).exitPickup, "ag.label.type", VRR_LABEL_EXIT, true);
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.type", VRR_PICKUP_BUSINESS_EXIT, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.owner.id", businessId, false);
+ setEntityData(getBusinessData(businessId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
}
// ===========================================================================
diff --git a/scripts/server/class.js b/scripts/server/class.js
index f8ce40ea..fee3595d 100644
--- a/scripts/server/class.js
+++ b/scripts/server/class.js
@@ -202,12 +202,14 @@ function initClassTable() {
this.creatingCharacterSkin = -1;
this.streamingRadioStation = -1;
- this.streamingRadioVolume = 50;
+ this.streamingRadioElement = false;
this.returnToPosition = null;
this.returnToHeading = null;
this.returnToInterior = null;
this.returnToDimension = null;
+
+ this.changingCharacterName = false;
}
},
@@ -241,6 +243,8 @@ function initClassTable() {
this.chatScrollLines = 1;
+ this.streamingRadioVolume = 20;
+
if(dbAssoc) {
this.databaseId = dbAssoc["acct_id"];
this.name = dbAssoc["acct_name"];
@@ -267,7 +271,8 @@ function initClassTable() {
this.emailVerificationCode = dbAssoc["acct_code_verifyemail"];
this.twoFactorAuthVerificationCode = dbAssoc["acct_code_2fa"];
- this.chatScrollLines = dbAssoc["acct_svr_chat_scroll_lines"];
+ this.chatScrollLines = toInteger(dbAssoc["acct_svr_chat_scroll_lines"]);
+ this.streamingRadioVolume = toInteger(dbAssoc["acct_streaming_radio_volume"]);
}
}
},
@@ -479,7 +484,9 @@ function initClassTable() {
this.exitBlip = null;
this.entranceFee = 0;
- this.till = 0
+ this.till = 0;
+
+ this.streamingRadioStation = -1;
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["biz_id"]);
@@ -572,6 +579,8 @@ function initClassTable() {
this.exitPickup = null;
this.exitBlip = null;
+ this.streamingRadioStation = -1;
+
if(dbAssoc) {
this.databaseId = toInteger(dbAssoc["house_id"]);
this.description = toString(dbAssoc["house_description"]);
@@ -774,6 +783,8 @@ function initClassTable() {
this.trunkItemCache = [];
this.dashItemCache = [];
+ this.streamingRadioStation = -1;
+
if(dbAssoc) {
// General Info
this.databaseId = toInteger(dbAssoc["veh_id"]);
@@ -840,8 +851,6 @@ function initClassTable() {
this.whoAdded = toInteger(dbAssoc["veh_who_added"]);
this.whenAdded = toInteger(dbAssoc["veh_when_added"]);
}
-
- this.streamingRadioStation = -1;
}
},
/** @class commandData Representing a command's data. Loaded and saved in the database */
diff --git a/scripts/server/client.js b/scripts/server/client.js
index 868cc70f..952b293a 100644
--- a/scripts/server/client.js
+++ b/scripts/server/client.js
@@ -19,63 +19,64 @@ function addAllNetworkHandlers() {
logToConsole(LOG_DEBUG, "[VRR.Client]: Adding network handlers ...");
// KeyBind
- addNetworkHandler("ag.useKeyBind", playerUsedKeyBind);
+ addNetworkHandler("vrr.useKeyBind", playerUsedKeyBind);
// GUI
- addNetworkHandler("ag.promptAnswerNo", playerPromptAnswerNo);
- addNetworkHandler("ag.promptAnswerYes", playerPromptAnswerYes);
+ addNetworkHandler("vrr.promptAnswerNo", playerPromptAnswerNo);
+ addNetworkHandler("vrr.promptAnswerYes", playerPromptAnswerYes);
// AFK
- addNetworkHandler("ag.afk", playerChangeAFKState);
+ addNetworkHandler("vrr.afk", playerChangeAFKState);
// Event
- addNetworkHandler("ag.enteredSphere", onPlayerEnteredSphere);
- addNetworkHandler("ag.exitedSphere", onPlayerExitedSphere);
- addNetworkHandler("ag.playerDeath", onPlayerDeath);
- addNetworkHandler("ag.onPlayerEnterVehicle", onPlayerEnteredVehicle);
- addNetworkHandler("ag.onPlayerExitVehicle", onPlayerExitedVehicle);
+ addNetworkHandler("vrr.enteredSphere", onPlayerEnteredSphere);
+ addNetworkHandler("vrr.exitedSphere", onPlayerExitedSphere);
+ addNetworkHandler("vrr.playerDeath", onPlayerDeath);
+ addNetworkHandler("vrr.onPlayerEnterVehicle", onPlayerEnteredVehicle);
+ addNetworkHandler("vrr.onPlayerExitVehicle", onPlayerExitedVehicle);
// Job
- addNetworkHandler("ag.arrivedAtJobRouteStop", playerArrivedAtJobRouteStop);
+ addNetworkHandler("vrr.arrivedAtJobRouteStop", playerArrivedAtJobRouteStop);
// Client
- addNetworkHandler("ag.clientReady", playerClientReady);
- addNetworkHandler("ag.guiReady", playerGUIReady);
- addNetworkHandler("ag.clientStarted", playerClientStarted);
- addNetworkHandler("ag.clientStopped", playerClientStopped);
+ addNetworkHandler("vrr.clientReady", playerClientReady);
+ addNetworkHandler("vrr.guiReady", playerGUIReady);
+ addNetworkHandler("vrr.clientStarted", playerClientStarted);
+ addNetworkHandler("vrr.clientStopped", playerClientStopped);
// Account
- addNetworkHandler("ag.checkLogin", checkLogin);
- addNetworkHandler("ag.checkRegistration", checkRegistration);
+ addNetworkHandler("vrr.checkLogin", checkLogin);
+ addNetworkHandler("vrr.checkRegistration", checkRegistration);
// Developer
- addNetworkHandler("ag.runCodeSuccess", clientRunCodeSuccess);
- addNetworkHandler("ag.runCodeFail", clientRunCodeFail);
+ addNetworkHandler("vrr.runCodeSuccess", clientRunCodeSuccess);
+ addNetworkHandler("vrr.runCodeFail", clientRunCodeFail);
// SubAccount
- addNetworkHandler("ag.checkNewCharacter", checkNewCharacter);
- addNetworkHandler("ag.nextCharacter", checkNextCharacter);
- addNetworkHandler("ag.previousCharacter", checkPreviousCharacter);
- addNetworkHandler("ag.selectCharacter", selectCharacter);
+ addNetworkHandler("vrr.checkNewCharacter", checkNewCharacter);
+ addNetworkHandler("vrr.nextCharacter", checkNextCharacter);
+ addNetworkHandler("vrr.previousCharacter", checkPreviousCharacter);
+ addNetworkHandler("vrr.selectCharacter", selectCharacter);
// Item
- addNetworkHandler("ag.itemActionDelayComplete", playerItemActionDelayComplete);
+ addNetworkHandler("vrr.itemActionDelayComplete", playerItemActionDelayComplete);
- addNetworkHandler("ag.weaponDamage", playerDamagedByPlayer);
+ addNetworkHandler("vrr.weaponDamage", playerDamagedByPlayer);
- addNetworkHandler("ag.player.position", updatePositionInPlayerData);
- addNetworkHandler("ag.player.heading", updateHeadingInPlayerData);
+ addNetworkHandler("vrr.player.position", updatePositionInPlayerData);
+ addNetworkHandler("vrr.player.heading", updateHeadingInPlayerData);
+ addNetworkHandler("vrr.player.lookat", setPlayerHeadLookPosition);
- addNetworkHandler("ag.skinSelected", playerFinishedSkinSelection);
+ addNetworkHandler("vrr.skinSelected", playerFinishedSkinSelection);
- addNetworkHandler("ag.clientInfo", updateConnectionLogOnClientInfoReceive);
+ addNetworkHandler("vrr.clientInfo", updateConnectionLogOnClientInfoReceive);
}
// ===========================================================================
function updatePlayerNameTag(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s updated nametag to all players`);
- triggerNetworkEvent("ag.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), false, client.ping);
+ triggerNetworkEvent("vrr.nametag", null, getPlayerName(client), getPlayerNameForNameTag(client), getPlayerColour(client), false, client.ping);
}
// ===========================================================================
@@ -92,15 +93,15 @@ function updateAllPlayerNameTags() {
function updatePlayerPing(client) {
//logToConsole(LOG_DEBUG, `[VRR.Client] Sending ${getPlayerDisplayForConsole(client)}'s ping to all players`);
- triggerNetworkEvent("ag.ping", null, getPlayerName(client), client.ping);
+ triggerNetworkEvent("vrr.ping", null, getPlayerName(client), client.ping);
}
// ===========================================================================
function playerClientReady(client) {
- setEntityData(client, "ag.isReady", true, false);
+ setEntityData(client, "vrr.isReady", true, false);
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources are downloaded and ready!`);
- if(client.getData("ag.isStarted") == true) {
+ if(client.getData("vrr.isStarted") == true) {
initClient(client);
}
}
@@ -108,16 +109,16 @@ function playerClientReady(client) {
// ===========================================================================
function playerGUIReady(client) {
- setEntityData(client, "ag.guiReady", true, false);
+ setEntityData(client, "vrr.guiReady", true, false);
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client GUI is initialized and ready!`);
}
// ===========================================================================
function playerClientStarted(client) {
- setEntityData(client, "ag.isStarted", true, false);
+ setEntityData(client, "vrr.isStarted", true, false);
logToConsole(LOG_DEBUG, `${getPlayerDisplayForConsole(client)}'s client resources are started and running!`);
- if(client.getData("ag.isReady") == true) {
+ if(client.getData("vrr.isReady") == true) {
initClient(client);
}
}
@@ -133,28 +134,28 @@ function playerClientStopped(client) {
function showGameMessage(client, text, colour, duration) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing game message to ${getPlayerDisplayForConsole(client)} (${text}) for ${duration} milliseconds`);
- triggerNetworkEvent("ag.smallGameMessage", client, text, colour, duration);
+ triggerNetworkEvent("vrr.smallGameMessage", client, text, colour, duration);
}
// ===========================================================================
-function enableCityAmbienceForPlayer(client) {
+function enableCityAmbienceForPlayer(client, clearElements = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
- triggerNetworkEvent("ag.ambience", client, true);
+ triggerNetworkEvent("vrr.ambience", client, true);
}
// ===========================================================================
-function disableCityAmbienceForPlayer(client) {
+function disableCityAmbienceForPlayer(client, clearElements = false) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s city ambience to ${toUpperCase(getOnOffFromBool(false))}`);
- triggerNetworkEvent("ag.ambience", client, false);
+ triggerNetworkEvent("vrr.ambience", client, false, clearElements);
}
// ===========================================================================
function clearPlayerOwnedPeds(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing peds owned by ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.clearPeds", client);
+ triggerNetworkEvent("vrr.clearPeds", client);
}
// ===========================================================================
@@ -162,41 +163,41 @@ function clearPlayerOwnedPeds(client) {
function updatePlayerSpawnedState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s spawned state ${toUpperCase(getOnOffFromBool(state))}`);
getPlayerData(client).spawned = true;
- triggerNetworkEvent("ag.spawned", client, state);
+ triggerNetworkEvent("vrr.spawned", client, state);
}
// ===========================================================================
function setPlayerControlState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s control state ${toUpperCase(getOnOffFromBool(state))}`);
- triggerNetworkEvent("ag.control", client, state, !state);
+ triggerNetworkEvent("vrr.control", client, state, !state);
}
// ===========================================================================
function updatePlayerShowLogoState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s logo state ${toUpperCase(getOnOffFromBool(state))}`);
- triggerNetworkEvent("ag.logo", client, state);
+ triggerNetworkEvent("vrr.logo", client, state);
}
// ===========================================================================
function restorePlayerCamera(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Restoring ${getPlayerDisplayForConsole(client)}'s camera`);
- triggerNetworkEvent("ag.restoreCamera", client);
+ triggerNetworkEvent("vrr.restoreCamera", client);
}
// ===========================================================================
function setPlayer2DRendering(client, hudState = false, labelState = false, smallGameMessageState = false, scoreboardState = false, hotBarState = false, itemActionDelayState = false) {
- triggerNetworkEvent("ag.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState);
+ triggerNetworkEvent("vrr.set2DRendering", client, hudState, labelState, smallGameMessageState, scoreboardState, hotBarState, itemActionDelayState);
}
// ===========================================================================
function syncPlayerProperties(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to sync ${getPlayerDisplayForConsole(client)}'s player ped properties`);
- triggerNetworkEvent("ag.player.sync", null, client.player);
+ triggerNetworkEvent("vrr.player.sync", null, client.player);
}
// ===========================================================================
@@ -204,7 +205,7 @@ function syncPlayerProperties(client) {
function updatePlayerSnowState(client) {
if(doesGameHaveSnow(getServerGame())) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting ${getPlayerDisplayForConsole(client)}'s snow state (Falling: ${toUpperCase(getOnOffFromBool(getServerConfig().fallingSnow))}, Ground: ${toUpperCase(getOnOffFromBool(getServerConfig().groundSnow))})`);
- triggerNetworkEvent("ag.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
+ triggerNetworkEvent("vrr.snow", client, getServerConfig().fallingSnow, getServerConfig().groundSnow);
}
}
@@ -214,7 +215,7 @@ 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)}`);
- triggerNetworkEvent("ag.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
+ triggerNetworkEvent("vrr.excludeGroundSnow", client, getGameConfig().excludedGroundSnowModels[getServerGame()][i]);
}
}
}
@@ -225,7 +226,7 @@ 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].model}) to ${getPlayerName(client)}`);
- triggerNetworkEvent("ag.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i].model, getGameConfig().removedWorldObjects[getServerGame()][i].position, getGameConfig().removedWorldObjects[getServerGame()][i].range);
+ triggerNetworkEvent("vrr.removeWorldObject", client, getGameConfig().removedWorldObjects[getServerGame()][i].model, getGameConfig().removedWorldObjects[getServerGame()][i].position, getGameConfig().removedWorldObjects[getServerGame()][i].range);
}
}
return true;
@@ -251,21 +252,21 @@ function updatePlayerHotBar(client) {
}
tempHotBarItems.push([i, itemExists, itemImage, itemValue]);
}
- triggerNetworkEvent("ag.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
+ triggerNetworkEvent("vrr.hotbar", client, getPlayerData(client).activeHotBarSlot, tempHotBarItems);
}
// ===========================================================================
function setPlayerWeaponDamageEnabled(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage state for ${getPlayerDisplayForConsole(client)} to all players`);
- triggerNetworkEvent("ag.weaponDamageEnabled", null, getPlayerName(client), state);
+ triggerNetworkEvent("vrr.weaponDamageEnabled", null, getPlayerName(client), state);
}
// ===========================================================================
function setPlayerWeaponDamageEvent(client, eventType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending weapon damage event (${eventType}) for ${getPlayerDisplayForConsole(client)} to all players`);
- triggerNetworkEvent("ag.weaponDamageEvent", null, getPlayerName(client), eventType);
+ triggerNetworkEvent("vrr.weaponDamageEvent", null, getPlayerName(client), eventType);
getPlayerData(client).weaponDamageEvent = eventType;
}
@@ -273,237 +274,237 @@ function setPlayerWeaponDamageEvent(client, eventType) {
function sendJobRouteStopToPlayer(client, position, colour) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job route stop data to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.showJobRouteStop", client, position, colour);
+ triggerNetworkEvent("vrr.showJobRouteStop", client, position, colour);
}
// ===========================================================================
function showPlayerLoginSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.loginSuccess", client);
+ triggerNetworkEvent("vrr.loginSuccess", client);
}
// ===========================================================================
function showPlayerLoginFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending login failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.loginFailed", client, errorMessage);
+ triggerNetworkEvent("vrr.loginFailed", client, errorMessage);
}
// ===========================================================================
function showPlayerRegistrationSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.registrationSuccess", client);
+ triggerNetworkEvent("vrr.registrationSuccess", client);
}
// ===========================================================================
function showPlayerRegistrationFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending registration failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.registrationFailed", client, errorMessage);
+ triggerNetworkEvent("vrr.registrationFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerGUIColours(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI colours to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.guiColour", client, getServerConfig().guiColour[0], getServerConfig().guiColour[1], getServerConfig().guiColour[2]);
+ triggerNetworkEvent("vrr.guiColour", client, getServerConfig().guiColour[0], getServerConfig().guiColour[1], getServerConfig().guiColour[2]);
}
// ===========================================================================
function sendPlayerGUIInit(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending GUI init signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.guiInit", client);
+ triggerNetworkEvent("vrr.guiInit", client);
}
// ===========================================================================
function showPlayerLoginGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show login GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.showLogin", client);
+ triggerNetworkEvent("vrr.showLogin", client);
}
// ===========================================================================
function showPlayerRegistrationGUI(client, errorMessage = "") {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show registration GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.showRegistration", client);
+ triggerNetworkEvent("vrr.showRegistration", client);
}
// ===========================================================================
function showPlayerNewCharacterGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show new character GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.showNewCharacter", client);
+ triggerNetworkEvent("vrr.showNewCharacter", client);
}
// ===========================================================================
function showPlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
+ triggerNetworkEvent("vrr.showCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function updatePlayerCharacterSelectGUI(client, firstName, lastName, cash, clan, lastPlayed, skin) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending update character select GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
+ triggerNetworkEvent("vrr.switchCharacterSelect", client, firstName, lastName, cash, clan, lastPlayed, skin);
}
// ===========================================================================
function showPlayerCharacterSelectSuccessGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select success GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.characterSelectSuccess", client);
+ triggerNetworkEvent("vrr.characterSelectSuccess", client);
}
// ===========================================================================
function showPlayerCharacterSelectFailedGUI(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending character select failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.characterSelectFailed", client);
+ triggerNetworkEvent("vrr.characterSelectFailed", client);
}
// ===========================================================================
function showPlayerPromptGUI(client, promptMessage, promptTitle) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show prompt GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${promptTitle}, Message: ${promptMessage})`);
- triggerNetworkEvent("ag.showPrompt", client, promptMessage, promptTitle);
+ triggerNetworkEvent("vrr.showPrompt", client, promptMessage, promptTitle);
}
// ===========================================================================
function showPlayerInfoGUI(client, infoMessage, infoTitle) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show info GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${infoTitle}, Message: ${infoMessage})`);
- triggerNetworkEvent("ag.showInfo", client, infoMessage, infoTitle);
+ triggerNetworkEvent("vrr.showInfo", client, infoMessage, infoTitle);
}
// ===========================================================================
function showPlayerErrorGUI(client, errorMessage, errorTitle) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending show error GUI signal to ${getPlayerDisplayForConsole(client)} (Title: ${errorTitle}, Message: ${errorMessage})`);
- triggerNetworkEvent("ag.showInfo", client, errorMessage, errorTitle);
+ triggerNetworkEvent("vrr.showInfo", client, errorMessage, errorTitle);
}
// ===========================================================================
function sendRunCodeToClient(client, code, returnTo) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending runcode to ${getPlayerDisplayForConsole(client)} (returnTo: ${getPlayerDisplayForConsole(getClientFromIndex(returnTo))}, Code: ${code})`);
- triggerNetworkEvent("ag.runCode", client, code, returnTo);
+ triggerNetworkEvent("vrr.runCode", client, code, returnTo);
}
// ===========================================================================
function sendPlayerWorkingState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending working state (${toUpperCase(getYesNoFromBool(state))}) to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.working", client, state);
+ triggerNetworkEvent("vrr.working", client, state);
}
// ===========================================================================
function sendPlayerJobType(client, jobType) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending job type (${jobType}) to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.jobType", client, jobType);
+ triggerNetworkEvent("vrr.jobType", client, jobType);
}
// ===========================================================================
function sendPlayerStopJobRoute(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to abort job route to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.stopJobRoute", client);
+ triggerNetworkEvent("vrr.stopJobRoute", client);
}
// ===========================================================================
function sendPlayerMouseCameraToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse camera ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.mouseCamera", client);
+ triggerNetworkEvent("vrr.mouseCamera", client);
}
// ===========================================================================
function sendPlayerMouseCursorToggle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to toggle mouse cursor ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.mouseCursor", client);
+ triggerNetworkEvent("vrr.mouseCursor", client);
}
// ===========================================================================
function sendAddAccountKeyBindToClient(client, key, keyState) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending added keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))}, State: ${(keyState) ? "down" : "up"})`);
- triggerNetworkEvent("ag.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
+ triggerNetworkEvent("vrr.addKeyBind", client, toInteger(key), (keyState) ? KEYSTATE_DOWN : KEYSTATE_UP);
}
// ===========================================================================
function sendRemoveAccountKeyBindToClient(client, key) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending deleted keybind to ${getPlayerDisplayForConsole(client)} (Key: ${toUpperCase(getKeyNameFromId(key))})`);
- triggerNetworkEvent("ag.delKeyBind", client, toInteger(key));
+ triggerNetworkEvent("vrr.delKeyBind", client, toInteger(key));
}
// ===========================================================================
function sendPlayerSetPosition(client, position) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set position signal to ${getPlayerDisplayForConsole(client)} (Position: ${position.x}, ${position.y}, ${position.z})`);
- triggerNetworkEvent("ag.position", client, position);
+ triggerNetworkEvent("vrr.position", client, position);
}
// ===========================================================================
function sendPlayerSetHeading(client, heading) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set heading signal to ${getPlayerDisplayForConsole(client)} (Heading: ${heading})`);
- triggerNetworkEvent("ag.heading", client, heading);
+ triggerNetworkEvent("vrr.heading", client, heading);
}
// ===========================================================================
function sendPlayerSetInterior(client, interior) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set interior signal to ${getPlayerDisplayForConsole(client)} (Interior: ${interior})`);
- triggerNetworkEvent("ag.interior", client, interior);
+ triggerNetworkEvent("vrr.interior", client, interior);
}
// ===========================================================================
function sendPlayerFrozenState(client, state) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending set frozen signal to ${getPlayerDisplayForConsole(client)} (State: ${toUpperCase(getYesNoFromBool(state))})`);
- triggerNetworkEvent("ag.frozen", client, state);
+ triggerNetworkEvent("vrr.frozen", client, state);
}
// ===========================================================================
function givePlayerWeapon(client, weaponId, ammo, active) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to give weapon (Weapon: ${weaponId}, Ammo: ${ammo})`);
- triggerNetworkEvent("ag.giveWeapon", client, weaponId, ammo, active);
+ triggerNetworkEvent("vrr.giveWeapon", client, weaponId, ammo, active);
}
// ===========================================================================
function clearPlayerWeapons(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending signal to ${getPlayerDisplayForConsole(client)} to clear weapons`);
- triggerNetworkEvent("ag.clearWeapons", client);
+ triggerNetworkEvent("vrr.clearWeapons", client);
}
// ===========================================================================
function showPlayerNewCharacterFailedGUI(client, errorMessage) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending new character failed GUI signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.newCharacterFailed", client, errorMessage);
+ triggerNetworkEvent("vrr.newCharacterFailed", client, errorMessage);
}
// ===========================================================================
function sendPlayerRemoveFromVehicle(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Sending remove from vehicle signal to ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.removeFromVehicle", client);
+ triggerNetworkEvent("vrr.removeFromVehicle", client);
}
// ===========================================================================
function sendChatBoxMessageToPlayer(client, message, colour) {
- triggerNetworkEvent("ag.m", client, message, colour)
+ triggerNetworkEvent("vrr.m", client, message, colour)
}
// ===========================================================================
@@ -513,7 +514,7 @@ function showPlayerItemTakeDelay(client, itemId) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if(delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, delay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item TAKE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerTakeItem(client, itemId);
@@ -528,7 +529,7 @@ function showPlayerItemUseDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).useDelay;
if(delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, delay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item USE delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerUseItem(client, itemSlot);
@@ -543,7 +544,7 @@ function showPlayerItemDropDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).dropDelay;
if(delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, delay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item DROP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerDropItem(client, itemSlot);
@@ -558,7 +559,7 @@ function showPlayerItemPickupDelay(client, itemId) {
let delay = getItemTypeData(getItemData(itemId).itemTypeIndex).pickupDelay;
if(delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, delay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PICKUP delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerPickupItem(client, itemId);
@@ -573,7 +574,7 @@ function showPlayerItemPutDelay(client, itemSlot) {
let delay = getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).putDelay;
if(delay > 0) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (${delay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, delay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, delay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item PUT delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerPutItem(client, itemSlot);
@@ -587,7 +588,7 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
if(itemSlot != -1) {
if(getPlayerData(client).hotBarItems[itemSlot] != -1) {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (${getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay} milliseconds)`);
- triggerNetworkEvent("ag.showItemActionDelay", client, getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay);
+ triggerNetworkEvent("vrr.showItemActionDelay", client, getItemTypeData(getItemData(getPlayerData(client).hotBarItems[itemSlot]).itemTypeIndex).switchDelay);
} else {
logToConsole(LOG_DEBUG, `[VRR.Client] Showing item switch delay to ${getPlayerDisplayForConsole(client)} (instant)`);
playerSwitchItem(client, itemSlot);
@@ -602,14 +603,14 @@ function showPlayerItemSwitchDelay(client, itemSlot) {
function sendPlayerDrunkEffect(client, amount, duration) {
logToConsole(LOG_DEBUG, `[VRR.Client] Setting drunk effect for ${getPlayerDisplayForConsole(client)} to ${amount} for ${duration} milliseconds`);
- triggerNetworkEvent("ag.drunkEffect", client, amount, duration);
+ triggerNetworkEvent("vrr.drunkEffect", client, amount, duration);
}
// ===========================================================================
function sendPlayerClearPedState(client) {
logToConsole(LOG_DEBUG, `[VRR.Client] Clearing ped state for ${getPlayerDisplayForConsole(client)}`);
- triggerNetworkEvent("ag.clearPedState", client);
+ triggerNetworkEvent("vrr.clearPedState", client);
}
// ===========================================================================
@@ -654,13 +655,13 @@ function playerDamagedByPlayer(client, damagerEntityName, weaponId, pedPiece, he
// ===========================================================================
function setPlayerCameraLookAt(client, cameraPosition, lookAtPosition) {
- triggerNetworkEvent("ag.cameraLookAt", client, cameraPosition, lookAtPosition);
+ triggerNetworkEvent("vrr.cameraLookAt", client, cameraPosition, lookAtPosition);
}
// ===========================================================================
function sendTimeMinuteDurationToPlayer(client, minuteDuration) {
- triggerNetworkEvent("ag.minuteDuration", client, minuteDuration);
+ triggerNetworkEvent("vrr.minuteDuration", client, minuteDuration);
}
// ===========================================================================
@@ -678,7 +679,7 @@ function updateHeadingInPlayerData(client, heading) {
// ===========================================================================
function forcePlayerIntoSkinSelect(client) {
- if(getGameConfig().skinChangePosition[getServerGame()].length != 0) {
+ if(getGameConfig().skinChangePosition[getServerGame()].length > 0) {
getPlayerData(client).returnToPosition = getPlayerPosition(client);
getPlayerData(client).returnToHeading = getPlayerHeading(client);
getPlayerData(client).returnToInterior = getPlayerInterior(client);
@@ -687,22 +688,16 @@ function forcePlayerIntoSkinSelect(client) {
setPlayerPosition(client, getGameConfig().skinChangePosition[getServerGame()][0]);
setPlayerHeading(client, getGameConfig().skinChangePosition[getServerGame()][1]);
setPlayerInterior(client, getGameConfig().skinChangePosition[getServerGame()][2]);
- setPlayerDimension(client, client.index+100);
+ setPlayerDimension(client, client.index+500);
}
- triggerNetworkEvent("ag.skinSelect", client, true);
-}
-
-// ===========================================================================
-
-function playerSkinItemSelectComplete(client, skinId) {
- getPlayerCurrentSubAccount(client).skin = skinId;
+ triggerNetworkEvent("vrr.skinSelect", client, true);
}
// ===========================================================================
function updatePlayerCash(client) {
- triggerNetworkEvent("ag.money", client, getPlayerCurrentSubAccount(client).cash);
+ triggerNetworkEvent("vrr.money", client, getPlayerCurrentSubAccount(client).cash);
}
// ===========================================================================
@@ -720,7 +715,7 @@ function sendAllPoliceStationBlips(client) {
getColourByName("policeBlue"),
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
@@ -739,7 +734,7 @@ function sendAllFireStationBlips(client) {
getColourByName("firefighterRed"),
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
@@ -758,7 +753,7 @@ function sendAllHospitalBlips(client) {
getColourByName("medicPink"),
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
@@ -777,7 +772,7 @@ function sendAllAmmunationBlips(client) {
0
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
@@ -796,7 +791,7 @@ function sendAllPayAndSprayBlips(client) {
0
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
@@ -815,39 +810,31 @@ function sendAllFuelStationBlips(client) {
getColourByName("burntOrange"),
]);
}
- triggerNetworkEvent("ag.blips", client, tempBlips);
+ triggerNetworkEvent("vrr.blips", client, tempBlips);
}
}
// ===========================================================================
function sendPlayerSetHealth(client, health) {
- triggerNetworkEvent("ag.health", client, health);
+ triggerNetworkEvent("vrr.health", client, health);
}
// ===========================================================================
function sendPlayerSetArmour(client, armour) {
- triggerNetworkEvent("ag.armour", client, armour);
+ triggerNetworkEvent("vrr.armour", client, armour);
}
// ===========================================================================
function playerFinishedSkinSelection(client, allowedSkinIndex) {
if(allowedSkinIndex == -1) {
+ restorePlayerCamera(client);
return false;
} else {
getPlayerCurrentSubAccount(client).skin = allowedSkins[getServerGame()][allowedSkinIndex][0];
- if(isPlayerWorking(client)) {
- messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working.");
- setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId);
- }
- deleteItem(getPlayerData(client).itemActionItem);
- switchPlayerActiveHotBarSlot(client, -1);
- restorePlayerCamera(client);
- cachePlayerHotBarItems(client);
-
if(isPlayerWorking(client)) {
messagePlayerAlert(client, "Your new skin has been saved but won't be shown until you stop working.");
setPlayerSkin(client, getJobData(getPlayerCurrentSubAccount(client).job).uniforms[getPlayerData(client).jobUniform].skinId);
@@ -855,50 +842,60 @@ function playerFinishedSkinSelection(client, allowedSkinIndex) {
setPlayerSkin(client, allowedSkins[getServerGame()][allowedSkinIndex][0]);
}
- setPlayerPosition(client, getPlayerData(client).returnToPosition);
- setPlayerHeading(client, getPlayerData(client).returnToHeading);
- setPlayerInterior(client, getPlayerData(client).returnToInterior);
- setPlayerDimension(client, getPlayerData(client).returnToDimension);
+ if(getPlayerData(client).returnToPosition != null) {
+ setPlayerPosition(client, getPlayerData(client).returnToPosition);
+ setPlayerHeading(client, getPlayerData(client).returnToHeading);
+ setPlayerInterior(client, getPlayerData(client).returnToInterior);
+ setPlayerDimension(client, getPlayerData(client).returnToDimension);
- getPlayerData(client).returnToPosition = null;
- getPlayerData(client).returnToHeading = null;
- getPlayerData(client).returnToInterior = null;
- getPlayerData(client).returnToDimension = null;
+ getPlayerData(client).returnToPosition = null;
+ getPlayerData(client).returnToHeading = null;
+ getPlayerData(client).returnToInterior = null;
+ getPlayerData(client).returnToDimension = null;
+ }
+
+ restorePlayerCamera(client);
+
+ deleteItem(getPlayerData(client).itemActionItem);
+ switchPlayerActiveHotBarSlot(client, -1);
+ cachePlayerHotBarItems(client);
meActionToNearbyPlayers(client, `changes their skin to ${allowedSkins[getServerGame()][allowedSkinIndex][1]}`);
}
- triggerNetworkEvent("ag.skinSelect", client, false);
+ triggerNetworkEvent("vrr.skinSelect", client, false);
}
// ===========================================================================
function sendPlayerChatScrollLines(client, amount) {
- triggerNetworkEvent("ag.chatScrollLines", client, amount);
+ triggerNetworkEvent("vrr.chatScrollLines", client, amount);
}
// ===========================================================================
-function playRadioStreamForPlayer(client, streamURL, loop = false, volume = 0) {
- triggerNetworkEvent("ag.radioStream", client, streamURL, loop, volume);
+function playRadioStreamForPlayer(client, streamURL, loop = true, volume = 0, element = false) {
+ logToConsole(LOG_DEBUG, `[VRR.Client] Forcing ${getPlayerDisplayForConsole(client)} to stream ${streamURL}`);
+ triggerNetworkEvent("vrr.radioStream", client, streamURL, loop, volume, element);
}
// ===========================================================================
-function setPlayerStreamingRadioVolume(client, volumeLevel) {
- getPlayerData(client).streamingRadioVolume = volumeLevel;
- triggerNetworkEvent("ag.radioVolume", client, volumeLevel);
+function setPlayerStreamingRadioVolume(client, volumeLevel, elementId = false) {
+ getPlayerData(client).accountData.streamingRadioVolume = volumeLevel;
+ getPlayerData(client).streamingRadioElement = elementId;
+ triggerNetworkEvent("vrr.radioVolume", client, volumeLevel, elementId);
}
// ===========================================================================
function setVehicleLightsState(vehicle, state) {
- triggerNetworkEvent("ag.veh.lights", null, vehicle.id, state);
+ triggerNetworkEvent("vrr.veh.lights", null, vehicle.id, state);
}
// ===========================================================================
function sendPlayerEnterPropertyKey(client, key) {
- triggerNetworkEvent("ag.enterPropertyKey", client, key);
+ triggerNetworkEvent("vrr.enterPropertyKey", client, key);
}
// ===========================================================================
@@ -906,7 +903,21 @@ function sendPlayerEnterPropertyKey(client, key) {
function makePedPlayAnimation(ped, animationSlot) {
let animationData = getAnimationData(animationSlot);
- triggerNetworkEvent("ag.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
+ triggerNetworkEvent("vrr.pedAnim", null, ped.id, animationData[1], animationData[2], animationData[3], animationData[4]);
+}
+
+// ===========================================================================
+
+function hideAllPlayerGUI(client) {
+ triggerNetworkEvent("vrr.hideAllGUI", client);
+}
+
+// ===========================================================================
+
+function setPlayerHeadLookPosition(client, position) {
+ if(client.player != null) {
+ setEntityData(client.player, "vrr.headLook", position, true);
+ }
}
// ===========================================================================
\ No newline at end of file
diff --git a/scripts/server/colour.js b/scripts/server/colour.js
index f72d2c45..5acd8bb6 100644
--- a/scripts/server/colour.js
+++ b/scripts/server/colour.js
@@ -218,11 +218,17 @@ function getInlineChatColourByType(colourName) {
// ===========================================================================
function rgbaArrayFromToColour(colour) {
+ //return [
+ // (colour >> 24) & 0xFF, // red
+ // (colour >> 16) & 0xFF,
+ // (colour >> 8) & 0xFF,
+ // colour & 0xFF // alpha
+ //];
return [
- (colour >> 24) & 0xFF, // red
- (colour >> 16) & 0xFF,
+ (colour >> 16) & 0xFF, // red
(colour >> 8) & 0xFF,
- colour & 0xFF // alpha
+ colour & 0xFF,
+ (colour >> 24) & 0xFF// alpha
];
}
diff --git a/scripts/server/command.js b/scripts/server/command.js
index f3bed7fa..71a24d81 100644
--- a/scripts/server/command.js
+++ b/scripts/server/command.js
@@ -53,6 +53,8 @@ function loadCommands() {
animation: [
commandData("anim", playPlayerAnimationCommand, "", getStaffFlagValue("none"), true, true, "Makes your player ped use an animation"),
commandData("an", playPlayerAnimationCommand, "", getStaffFlagValue("none"), true, true, "Makes your player ped use an animation"),
+ commandData("anims", showAnimationListCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of animations"),
+ commandData("animlist", showAnimationListCommand, "", getStaffFlagValue("none"), true, true, "Shows a list of animations"),
],
antiCheat: [
//commandData("addacscriptwl", addAntiCheatWhiteListedScriptCommand, "