Tons of fixes, change netevent prefix.
This commit is contained in:
1
meta.xml
1
meta.xml
@@ -9,6 +9,7 @@
|
||||
|
||||
<!-- Server -->
|
||||
<script src="scripts/server/class.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/accent.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/account.js" type="server" language="javascript" />
|
||||
<script src="scripts/server/animation.js" type="server" language="javascript" />
|
||||
<!--<script src="scripts/server/ammunation.js" type="server" language="javascript" />-->
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
// ===========================================================================
|
||||
@@ -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:
|
||||
|
||||
@@ -41,6 +41,8 @@ let drunkEffectDurationTimer = null;
|
||||
let controlsEnabled = true;
|
||||
|
||||
let streamingRadio = null;
|
||||
let streamingRadioVolume = 50;
|
||||
let streamingRadioElement = false;
|
||||
|
||||
let enterPropertyKey = null;
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// ===========================================================================
|
||||
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -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
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,8 @@ function loadCommands() {
|
||||
animation: [
|
||||
commandData("anim", playPlayerAnimationCommand, "<animation name>", getStaffFlagValue("none"), true, true, "Makes your player ped use an animation"),
|
||||
commandData("an", playPlayerAnimationCommand, "<animation name>", 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, "<script name>", getStaffFlagValue("developer"), true, true),
|
||||
|
||||
@@ -1119,7 +1119,7 @@ function setSnowingCommand(command, params, client) {
|
||||
|
||||
updatePlayerSnowState(null);
|
||||
|
||||
messageAdminAction(`${getPlayerName(client)} turned falling snow ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("white")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`);
|
||||
messageAdminAction(`${getPlayerName(client)} ${getInlineChatColourByName("orange")}turned falling snow ${getBoolRedGreenInlineColour(fallingSnow)}${getOnOffFromBool(fallingSnow)} ${getInlineChatColourByName("orange")}and ground snow ${getBoolRedGreenInlineColour(groundSnow)}${getOnOffFromBool(groundSnow)}`);
|
||||
updateServerRules();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -392,10 +392,10 @@ let serverData = {
|
||||
|
||||
function initServerData() {
|
||||
// Pre-allocate translation cache language slots
|
||||
global.getServerData().translation.cache = new Array(global.getServerData().translation.languages.length);
|
||||
let translationCacheFrom = new Array(global.getServerData().translation.languages.length);
|
||||
translationCacheFrom.fill([]);
|
||||
global.getServerData().translation.cache.fill(translationCacheFrom);
|
||||
//getServerData().translation.cache = new Array(getServerData().translation.languages.length);
|
||||
//let translationCacheFrom = new Array(getServerData().translation.languages.length);
|
||||
//translationCacheFrom.fill([]);
|
||||
//getServerData().translation.cache.fill(translationCacheFrom);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -26,6 +26,7 @@ function addAllEventHandlers() {
|
||||
addEventHandler("onPlayerJoined", onPlayerJoined);
|
||||
addEventHandler("onPlayerChat", onPlayerChat);
|
||||
addEventHandler("onPlayerQuit", onPlayerQuit);
|
||||
addEventHandler("onElementStreamIn", onElementStreamIn);
|
||||
|
||||
addEventHandler("onPedSpawn", onPedSpawn);
|
||||
addEventHandler("onPedEnterVehicle", onPedEnteringVehicle);
|
||||
@@ -36,10 +37,10 @@ function addAllEventHandlers() {
|
||||
|
||||
function onPlayerConnect(event, ipAddress, port) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Client connecting (IP: ${ipAddress})`);
|
||||
if(isIpAddressBanned(ipAddress)) {
|
||||
messagePlayerError(client, "You are banned from this server!");
|
||||
return false;
|
||||
}
|
||||
//if(isIpAddressBanned(ipAddress)) {
|
||||
// messagePlayerError(client, "You are banned from this server!");
|
||||
// return false;
|
||||
//}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -56,6 +57,14 @@ function onPlayerJoined(event, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onElementStreamIn(event, element, client) {
|
||||
if(getPlayerDimension(client) != getElementDimension(element)) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function onPlayerQuit(event, client, quitReasonId) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} disconnected (${disconnectReasons[quitReasonId]}[${quitReasonId}])`);
|
||||
updateConnectionLogOnQuit(client, quitReasonId);
|
||||
@@ -220,7 +229,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} entered a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
|
||||
getPlayerData(client).lastVehicle = vehicle;
|
||||
|
||||
@@ -272,7 +281,7 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
||||
|
||||
if(getVehicleData(vehicle).streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != getVehicleData(vehicle).streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, getPlayerData(client).streamingRadioVolume);
|
||||
playRadioStreamForPlayer(client, radioStations[getVehicleData(vehicle).streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
//}, client.ping+500);
|
||||
@@ -289,7 +298,7 @@ function onPlayerExitedVehicle(client, vehicle) {
|
||||
return false;
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("ag.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)} exited a ${getVehicleName(vehicle)} (ID: ${vehicle.getData("vrr.dataSlot")}, Database ID: ${getVehicleData(vehicle).databaseId})`);
|
||||
|
||||
if(isPlayerWorking(client)) {
|
||||
if(isPlayerOnJobRoute(client)) {
|
||||
@@ -387,12 +396,12 @@ function onPlayerSpawn(client) {
|
||||
|
||||
if(getServerGame() == GAME_GTA_IV) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
||||
setEntityData(client.player, "ag.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(client.player, "ag.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
setEntityData(client.player, "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
||||
setEntityData(client.player, "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||
setEntityData(client.player, "ag.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
setEntityData(client.player, "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||
|
||||
if(isPlayerSwitchingCharacter(client) || isPlayerCreatingCharacter(client)) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s ped is being used for character selection/creation. No further spawn processing needed'`);
|
||||
@@ -450,8 +459,8 @@ function onPlayerSpawn(client) {
|
||||
|
||||
if(getServerGame() == GAME_GTA_SA) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting player walk and fightstyle for ${getPlayerDisplayForConsole(client)}`);
|
||||
setEntityData(client.player, "ag.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
setEntityData(client.player, "ag.fightStyle", getPlayerCurrentSubAccount(client).fightStyle, true);
|
||||
setEntityData(client.player, "vrr.walkStyle", getPlayerCurrentSubAccount(client).walkStyle, true);
|
||||
setEntityData(client.player, "vrr.fightStyle", getPlayerCurrentSubAccount(client).fightStyle, true);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Updating logo state for ${getPlayerDisplayForConsole(client)}`);
|
||||
@@ -471,26 +480,26 @@ function onPlayerSpawn(client) {
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s switchchar state to false`);
|
||||
getPlayerData(client).switchingCharacter = false;
|
||||
|
||||
setEntityData(client.player, "ag.inBusiness", (getPlayerCurrentSubAccount(client).inBusiness != 0) ? getBusinessIdFromDatabaseId(getPlayerCurrentSubAccount(client).inBusiness) : -1, true);
|
||||
setEntityData(client.player, "ag.inHouse", (getPlayerCurrentSubAccount(client).inHouse != 0) ? getHouseIdFromDatabaseId(getPlayerCurrentSubAccount(client).inHouse) : -1, true);
|
||||
|
||||
if(doesPlayerHaveKeyBindForCommand(client, "enter")) {
|
||||
let keyId = getPlayerKeyBindForCommand(client, "enter");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId).key)}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Sending custom enter property key ID (${keyId.key}, ${toUpperCase(getKeyNameFromId(keyId.key))}) to ${getPlayerDisplayForConsole(client)}`);
|
||||
sendPlayerEnterPropertyKey(client, keyId.key);
|
||||
}
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped state to ready`);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
|
||||
//setTimeout(function() {
|
||||
// syncPlayerProperties(client);
|
||||
//}, 1000);
|
||||
setTimeout(function() {
|
||||
syncPlayerProperties(client);
|
||||
}, 1000);
|
||||
|
||||
logToConsole(LOG_DEBUG, `[VRR.Event] Syncing ${getPlayerDisplayForConsole(client)}'s cash ${getPlayerCurrentSubAccount(client).cash}`);
|
||||
updatePlayerCash(client);
|
||||
|
||||
getPlayerData(client).payDayTickStart = sdl.ticks;
|
||||
|
||||
setEntityData(client.player, "vrr.inBusiness", (getPlayerCurrentSubAccount(client).inBusiness != 0) ? getBusinessIdFromDatabaseId(getPlayerCurrentSubAccount(client).inBusiness) : -1, true);
|
||||
setEntityData(client.player, "vrr.inHouse", (getPlayerCurrentSubAccount(client).inHouse != 0) ? getHouseIdFromDatabaseId(getPlayerCurrentSubAccount(client).inHouse) : -1, true);
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
@@ -2993,51 +2993,58 @@ let gameData = {
|
||||
["handsup", 0, 167, VRR_ANIMTYPE_ADD, 0.0],
|
||||
],
|
||||
[ // GTA VC
|
||||
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["handcuffs", 0, 7, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["headbutt", 0, 49, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["kick", 0, 50, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["kneekick", 0, 51, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["punch1", 0, 52, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["punch2", 0, 53, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["flipkick", 0, 54, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["headscratch", 0, 152, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["aimdown", 0, 155, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["look2", 0, 153, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["handsup", 0, 161, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["cower", 0, 162, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["fucku", 0, 163, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["phone", 0, 166, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["sit", 0, 169, VRR_ANIMTYPE_BLEND, 1.0],
|
||||
["atm", 0, 171, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["cpr", 24, 214, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["idle1", 26, 215, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["idle2", 26, 216, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["idle3", 26, 217, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["idle4", 26, 218, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance1", 28, 226, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance2", 28, 227, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance3", 28, 228, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance4", 28, 229, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance5", 28, 230, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance6", 28, 231, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["dance7", 28, 232, VRR_ANIMTYPE_ADD, 0.0],
|
||||
["walk", 0, 0, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["jog", 0, 1, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["handcuffs", 0, 7, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["tired", 0, 9, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["raisegun", 0, 10, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["wave", 0, 12, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["talk", 0, 11, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["stomachhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["headhit", 0, 18, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["headbutt", 0, 49, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["kick", 0, 50, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["kneekick", 0, 51, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["throw2", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["punch1", 0, 52, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["punch2", 0, 53, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["flipkick", 0, 54, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["headscratch", 0, 152, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["aimdown", 0, 155, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["look2", 0, 153, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["handsup", 0, 161, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["cower", 0, 162, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["fucku", 0, 163, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["phone", 0, 166, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["sit", 0, 169, VRR_ANIMTYPE_BLEND, 1.0, null, null, null, null],
|
||||
["atm", 0, 171, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["cpr", 24, 214, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["idle1", 26, 215, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["idle2", 26, 216, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["idle3", 26, 217, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["idle4", 26, 218, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance1", 28, 226, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance2", 28, 227, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance3", 28, 228, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance4", 28, 229, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance5", 28, 230, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance6", 28, 231, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
["dance7", 28, 232, VRR_ANIMTYPE_ADD, 0.0, null, null, null, null],
|
||||
],
|
||||
[ // GTA SA
|
||||
|
||||
],
|
||||
null,
|
||||
[
|
||||
|
||||
[ // GTA IV
|
||||
["dance1", "DAN_LOOP_A", "DANCING", 16.0, true, false, true, false],
|
||||
]
|
||||
],
|
||||
meleeWeapons: [
|
||||
[],
|
||||
[1],
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
|
||||
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
|
||||
[],
|
||||
]
|
||||
};
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function initHouseScript() {
|
||||
createAllHousePickups();
|
||||
}
|
||||
|
||||
if(getServerConfig().createHousePickups) {
|
||||
if(getServerConfig().createHouseBlips) {
|
||||
createAllHouseBlips();
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ function lockUnlockHouseCommand(command, params, client) {
|
||||
|
||||
for(let i in getHouseData(houseId).locations) {
|
||||
if(getHouseData(houseId).locations[i].type == VRR_HOUSE_LOC_DOOR) {
|
||||
setEntityData(getHouseData(houseId).locations[i].entrancePickup, "ag.label.locked", getHouseData(houseId).locked, true);
|
||||
setEntityData(getHouseData(houseId).locations[i].entrancePickup, "vrr.label.locked", getHouseData(houseId).locked, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,7 +102,7 @@ function setHouseDescriptionCommand(command, params, client) {
|
||||
|
||||
for(let i in getHouseData(houseId).locations) {
|
||||
if(getHouseData(houseId).locations[i].type == VRR_HOUSE_LOC_DOOR) {
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.name", getHouseData(houseId).description, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.name", getHouseData(houseId).description, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,8 +407,8 @@ function getClosestHouseEntrance(position) {
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerHouse(client) {
|
||||
if(doesEntityDataExist(client, "ag.inHouse")) {
|
||||
return getEntityData(client, "ag.inHouse");
|
||||
if(doesEntityDataExist(client, "vrr.inHouse")) {
|
||||
return getEntityData(client, "vrr.inHouse");
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -510,16 +510,16 @@ function createHouseEntrancePickup(houseId) {
|
||||
pickupModelId = getHouseData(houseId).entrancePickupModel;
|
||||
}
|
||||
|
||||
getHouseData(houseId).entrancePickup = gta.createPickup(pickupModelId, getHouseData(houseId).entrancePosition);
|
||||
getHouseData(houseId).entrancePickup.onAllDimensions = false;
|
||||
getHouseData(houseId).entrancePickup.dimension = getHouseData(houseId).entranceDimension;
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.owner.id", houseId, false);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.type", VRR_LABEL_HOUSE, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.name", getHouseData(houseId).description, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.locked", getHouseData(houseId).locked, true);
|
||||
getHouseData(houseId).entrancePickup = createGamePickup(pickupModelId, getHouseData(houseId).entrancePosition);
|
||||
setElementOnAllDimensions(getHouseData(houseId).entrancePickup, false);
|
||||
setElementDimension(getHouseData(houseId).entrancePickup, getHouseData(houseId).entranceDimension);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.type", VRR_PICKUP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.type", VRR_LABEL_HOUSE, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.name", getHouseData(houseId).description, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.locked", getHouseData(houseId).locked, true);
|
||||
if(getHouseData(houseId).buyPrice > 0) {
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "ag.label.price", getHouseData(houseId).buyPrice, true);
|
||||
setEntityData(getHouseData(houseId).entrancePickup, "vrr.label.price", getHouseData(houseId).buyPrice, true);
|
||||
}
|
||||
addToWorld(getHouseData(houseId).entrancePickup);
|
||||
}
|
||||
@@ -540,10 +540,10 @@ function createHouseEntranceBlip(houseId) {
|
||||
}
|
||||
|
||||
getHouseData(houseId).entranceBlip = gta.createBlip(getHouseData(houseId).entrancePosition, blipModelId, 1, getColourByName("houseGreen"));
|
||||
getHouseData(houseId).entranceBlip.onAllDimensions = false;
|
||||
getHouseData(houseId).entranceBlip.dimension = getHouseData(houseId).entranceDimension;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "ag.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "ag.owner.id", houseId, false);
|
||||
getHouseData(houseId).entranceBlip.onAllDimensions = false;
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.type", VRR_BLIP_HOUSE_ENTRANCE, false);
|
||||
setEntityData(getHouseData(houseId).entranceBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).entranceBlip);
|
||||
}
|
||||
}
|
||||
@@ -564,11 +564,11 @@ function createHouseExitPickup(houseId) {
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitPickup = gta.createPickup(pickupModelId, getHouseData(houseId).exitPosition);
|
||||
getHouseData(houseId).exitPickup.onAllDimensions = false;
|
||||
getHouseData(houseId).exitPickup.dimension = getHouseData(houseId).exitDimension;
|
||||
setEntityData(getHouseData(houseId).exitPickup, "ag.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitPickup, "ag.owner.id", houseId, false);
|
||||
setEntityData(getHouseData(houseId).exitPickup, "ag.label.type", VRR_LABEL_EXIT, true);
|
||||
getHouseData(houseId).exitPickup.onAllDimensions = false;
|
||||
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.type", VRR_PICKUP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitPickup, "vrr.owner.id", houseId, false);
|
||||
setEntityData(getHouseData(houseId).exitPickup, "vrr.label.type", VRR_LABEL_EXIT, true);
|
||||
addToWorld(getHouseData(houseId).exitPickup);
|
||||
}
|
||||
}
|
||||
@@ -590,10 +590,10 @@ function createHouseExitBlip(houseId) {
|
||||
}
|
||||
|
||||
getHouseData(houseId).exitBlip = gta.createBlip(blipModelId, getHouseData(houseId).exitPosition, 1, getColourByName("houseGreen"));
|
||||
getHouseData(houseId).exitBlip.onAllDimensions = false;
|
||||
getHouseData(houseId).exitBlip.dimension = getHouseData(houseId).entranceDimension;
|
||||
setEntityData(getHouseData(houseId).exitBlip, "ag.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "ag.owner.id", houseId, false);
|
||||
getHouseData(houseId).exitBlip.onAllDimensions = false;
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.type", VRR_BLIP_HOUSE_EXIT, false);
|
||||
setEntityData(getHouseData(houseId).exitBlip, "vrr.owner.id", houseId, false);
|
||||
addToWorld(getHouseData(houseId).exitBlip);
|
||||
}
|
||||
}
|
||||
@@ -667,7 +667,7 @@ function getHouseInfoCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerInAnyHouse(client) {
|
||||
return doesEntityDataExist(client, "ag.inHouse");
|
||||
return doesEntityDataExist(client, "vrr.inHouse");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -758,7 +758,7 @@ function exitHouse(client) {
|
||||
setPlayerDimension(client, getServerData().house[houseId].entranceDimension);
|
||||
setPlayerPosition(client, getServerData().house[houseId].entrancePosition);
|
||||
}
|
||||
removeEntityData(client, "ag.inHouse");
|
||||
removeEntityData(client, "vrr.inHouse");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -103,10 +103,11 @@ function createGroundItemObject(itemId) {
|
||||
deleteGroundItemObject(itemId);
|
||||
}
|
||||
|
||||
getItemData(itemId).object = gta.createObject(getItemTypeData(getItemData(itemId).itemTypeIndex).dropModel, applyOffsetToPos(getItemData(itemId).position, getItemTypeData(getItemData(itemId).itemTypeIndex).dropPosition));
|
||||
getItemData(itemId).object.setRotation(getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation);
|
||||
getItemData(itemId).object.dimension = getItemData(itemId).dimension;
|
||||
setEntityData(getItemData(itemId).object, "ag.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||
getItemData(itemId).object = createGameObject(getItemTypeData(getItemData(itemId).itemTypeIndex).dropModel, applyOffsetToPos(getItemData(itemId).position, getItemTypeData(getItemData(itemId).itemTypeIndex).dropPosition));
|
||||
setElementRotation(getItemData(itemId).object, getItemTypeData(getItemData(itemId).itemTypeIndex).dropRotation);
|
||||
setElementOnAllDimensions(getItemData(itemId).object, false);
|
||||
setElementDimension(getItemData(itemId).object, getItemData(itemId).dimension);
|
||||
setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||
addToWorld(getItemData(itemId).object);
|
||||
|
||||
getServerData().groundItemCache.push(itemId);
|
||||
@@ -120,7 +121,7 @@ function deleteGroundItemObject(itemId) {
|
||||
}
|
||||
|
||||
if(getItemData(itemId).object != null) {
|
||||
destroyElement(getItemData(itemId).object);
|
||||
destroyGameElement(getItemData(itemId).object);
|
||||
getItemData(itemId).object = null;
|
||||
}
|
||||
}
|
||||
@@ -820,15 +821,13 @@ function playerSwitchItem(client, newHotBarSlot) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(newHotBarItem != -1) {
|
||||
if(getItemData(newHotBarItem)) {
|
||||
if(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useType == VRR_ITEM_USETYPE_WEAPON) {
|
||||
if(getItemData(newHotBarItem).value > 0) {
|
||||
if(getItemData(newHotBarItem).value > 0 || isMeleeWeapon(toInteger(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId))) {
|
||||
givePlayerWeapon(client, toInteger(getItemTypeData(getItemData(newHotBarItem).itemTypeIndex).useId), toInteger(getItemData(newHotBarItem).value), true, true);
|
||||
setPlayerWeaponDamageEnabled(client, true);
|
||||
setPlayerWeaponDamageEvent(client, VRR_WEAPON_DAMAGE_EVENT_NONE);
|
||||
setPlayerWeaponDamageEvent(client, VRR_WEAPON_DAMAGE_EVENT_NORMAL);
|
||||
} else {
|
||||
messagePlayerError(client, `The ${getItemName(newHotBarItem)} in slot ${newHotBarSlot} has no ammo, and can't be equipped!`);
|
||||
return false;
|
||||
@@ -986,6 +985,7 @@ function deleteItem(itemId) {
|
||||
|
||||
case VRR_ITEM_OWNER_PLAYER:
|
||||
if(getPlayerFromCharacterId(getItemData(itemId).ownerId)) {
|
||||
switchPlayerActiveHotBarSlot(getPlayerFromCharacterId(getItemData(itemId).ownerId), -1);
|
||||
getPlayerData(getPlayerFromCharacterId(getItemData(itemId).ownerId)).hotBarItems[getPlayerData(getPlayerFromCharacterId(getItemData(itemId).ownerId)).hotBarItems.indexOf(itemId)] = -1;
|
||||
updatePlayerHotBar(getPlayerFromCharacterId(getItemData(itemId).ownerId));
|
||||
}
|
||||
|
||||
@@ -222,11 +222,11 @@ function createAllJobPickups() {
|
||||
pickupCount++;
|
||||
getServerData().jobs[i].locations[j].pickup = gta.createPickup(getServerData().jobs[i].pickupModel, getServerData().jobs[i].locations[j].position);
|
||||
getServerData().jobs[i].locations[j].pickup.onAllDimensions = false;
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "ag.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "ag.owner.id", j, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "ag.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "ag.label.name", getServerData().jobs[i].name, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "ag.label.jobType", getServerData().jobs[i].databaseId, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.owner.id", j, false);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.name", getServerData().jobs[i].name, true);
|
||||
setEntityData(getServerData().jobs[i].locations[j].pickup, "vrr.label.jobType", getServerData().jobs[i].databaseId, true);
|
||||
getServerData().jobs[i].locations[j].pickup.dimension = getServerData().jobs[i].locations[j].dimension;
|
||||
addToWorld(getServerData().jobs[i].locations[j].pickup);
|
||||
|
||||
@@ -544,7 +544,7 @@ function stopWorking(client) {
|
||||
deleteJobItems(client);
|
||||
restorePlayerJobLockerItems(client);
|
||||
|
||||
let jobId = getPlayerCurrentSubAccount(client).job;
|
||||
let jobId = getPlayerJob(client);
|
||||
switch(getJobType(jobId)) {
|
||||
case VRR_JOB_POLICE:
|
||||
messagePlayerInfo(client, "Your uniform, equipment, and police car have been returned to the police station");
|
||||
@@ -728,7 +728,7 @@ function getJobData(jobId) {
|
||||
function quitJob(client) {
|
||||
stopWorking(client);
|
||||
getPlayerCurrentSubAccount(client).job = 0;
|
||||
sendPlayerJobType(client, -1);
|
||||
sendPlayerJobType(client, 0);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1502,11 +1502,11 @@ function createJobLocationPickup(jobId, locationId) {
|
||||
|
||||
getJobData(jobId).locations[locationId].pickup = gta.createPickup(pickupModelId, getJobData(jobId).locations[locationId].position, getGameConfig().pickupTypes[getServerGame()].job);
|
||||
getJobData(jobId).locations[locationId].pickup.dimension = getJobData(jobId).locations[locationId].dimension;
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "ag.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "ag.owner.id", locationId, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "ag.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "ag.label.name", getJobData(jobId).name, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "ag.label.jobType", getJobData(jobId).databaseId, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.type", VRR_PICKUP_JOB, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.owner.id", locationId, false);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.type", VRR_LABEL_JOB, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.name", getJobData(jobId).name, true);
|
||||
setEntityData(getServerData().jobs[jobId].locations[locationId].pickup, "vrr.label.jobType", getJobData(jobId).databaseId, true);
|
||||
addToWorld(getJobData(jobId).locations[locationId].pickup);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ function showNextGarbageStop(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function showCurrentGarbageStop(client) {
|
||||
triggerNetworkEvent("ag.showGarbageStop", client, getGarbageRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("garbageDriverGreen"));
|
||||
triggerNetworkEvent("vrr.showGarbageStop", client, getGarbageRouteStopPosition(getPlayerIsland(client), getPlayerData(client).jobRoute, getPlayerData(client).jobRouteStop), getColourByName("garbageDriverGreen"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -148,19 +148,19 @@ function messagePlayerTip(client, messageText) {
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerTalk(client, talkingClient, messageText) {
|
||||
messagePlayerNormal(client, `🗣️ ${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(client)}${getClientSubAccountName(talkingClient)} says: ${messageText}`, getColourByType("talkMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerWhisper(client, whisperingClient, messageText) {
|
||||
messagePlayerNormal(client, `🤫 ${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||
messagePlayerNormal(client, `🤫 ${getPlayerAccentInlineOutput(client)}${getClientSubAccountName(whisperingClient)} whispers: ${messageText}`, getColourByType("whisperMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function messagePlayerShout(client, shoutingClient, messageText) {
|
||||
messagePlayerNormal(client, `🗣️ ${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
messagePlayerNormal(client, `🗣️ ${getPlayerAccentInlineOutput(client)}${getClientSubAccountName(shoutingClient)} shouts: ${messageText}!`, getColourByType("shoutMessage"));
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
@@ -130,7 +130,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_EXITINGPROPERTY;
|
||||
meActionToNearbyPlayers(client, "opens the door and exits the house");
|
||||
fadeCamera(client, false, 1.0);
|
||||
disableCityAmbienceForPlayer(client);
|
||||
disableCityAmbienceForPlayer(client, true);
|
||||
setTimeout(function() {
|
||||
setPlayerPosition(client, inHouse.entrancePosition);
|
||||
setPlayerHeading(client, inHouse.entranceRotation);
|
||||
@@ -145,7 +145,10 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
removeEntityData(client, "ag.inHouse");
|
||||
removeEntityData(client, "vrr.inHouse");
|
||||
playRadioStreamForPlayer(client, "");
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} exited house ${inHouse.description}[${inHouse.index}/${inHouse.databaseId}]`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -161,7 +164,7 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
clearPlayerStateToEnterExitProperty(client)
|
||||
meActionToNearbyPlayers(client, "opens the door and exits the business");
|
||||
fadeCamera(client, false, 1.0);
|
||||
disableCityAmbienceForPlayer(client);
|
||||
disableCityAmbienceForPlayer(client, true);
|
||||
setTimeout(function() {
|
||||
setPlayerPosition(client, inBusiness.entrancePosition);
|
||||
setPlayerHeading(client, inBusiness.entranceRotation);
|
||||
@@ -176,8 +179,10 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
}, 2000);
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
removeEntityData(client, "ag.inBusiness");
|
||||
logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} entered business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||
removeEntityData(client, "vrr.inBusiness");
|
||||
playRadioStreamForPlayer(client, "");
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
logToConsole(LOG_DEBUG, `[VRR.Misc] ${getPlayerDisplayForConsole(client)} exited business ${inBusiness.name}[${inBusiness.index}/${inBusiness.databaseId}]`);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -210,9 +215,16 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
setTimeout(function() {
|
||||
fadeCamera(client, true, 1.0);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setTimeout(function() {
|
||||
if(closestBusiness.streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != closestBusiness.streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[closestBusiness.streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
}, 1250);
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
setEntityData(client, "ag.inBusiness", closestBusinessId, true);
|
||||
setEntityData(client, "vrr.inBusiness", closestBusinessId, true);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -246,9 +258,16 @@ function enterExitPropertyCommand(command, params, client) {
|
||||
setTimeout(function() {
|
||||
fadeCamera(client, true, 1.0);
|
||||
getPlayerData(client).pedState = VRR_PEDSTATE_READY;
|
||||
setTimeout(function() {
|
||||
if(closestHouse.streamingRadioStation != -1) {
|
||||
if(getPlayerData(client).streamingRadioStation != closestHouse.streamingRadioStation) {
|
||||
playRadioStreamForPlayer(client, radioStations[closestHouse.streamingRadioStation].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
}, 1250);
|
||||
}, 1000);
|
||||
}, 1100);
|
||||
setEntityData(client, "ag.inHouse", closestHouseId, true)
|
||||
setEntityData(client, "vrr.inHouse", closestHouseId, true)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -293,9 +312,9 @@ function getPlayerInfoCommand(command, params, client) {
|
||||
|
||||
function playerChangeAFKState(client, afkState) {
|
||||
if(afkState) {
|
||||
setEntityData(client, "ag.afk", true, true);
|
||||
setEntityData(client, "vrr.afk", true, true);
|
||||
} else {
|
||||
client.removeData("ag.afk");
|
||||
client.removeData("vrr.afk");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ function gotoGameLocationCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let gameLocationId = getGameLocationFromParams(params)
|
||||
let gameLocationId = getGameLocationFromParams(params);
|
||||
|
||||
if(!gameLocationId) {
|
||||
messagePlayerError(client, "That game location doesn't exist!");
|
||||
@@ -267,12 +267,12 @@ function gotoGameLocationCommand(command, params, client) {
|
||||
|
||||
setPlayerVelocity(client, toVector3(0.0, 0.0, 0.0));
|
||||
setTimeout(function() {
|
||||
setPlayerPosition(client, getGameData().locations[gameLocationId][1]);
|
||||
setPlayerPosition(client, getGameData().locations[getServerGame()][gameLocationId][1]);
|
||||
setPlayerInterior(client, 0);
|
||||
setPlayerDimension(client, 0);
|
||||
}, 500);
|
||||
|
||||
messagePlayerSuccess(client, `You teleported to game location ${getInlineChatColourByName("lightGrey")}${getGameData().locations[gameLocationId][0]}`);
|
||||
messagePlayerSuccess(client, `You teleported to game location ${getInlineChatColourByName("lightGrey")}${getGameData().locations[getServerGame()][gameLocationId][0]}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -508,11 +508,11 @@ function getPlayerCommand(command, params, client) {
|
||||
setPlayerDimension(targetClient, getPlayerDimension(client));
|
||||
|
||||
if(isPlayerInAnyBusiness(client)) {
|
||||
setEntityData(client, "ag.inBusiness", getPlayerBusiness(client));
|
||||
setEntityData(client, "vrr.inBusiness", getPlayerBusiness(client));
|
||||
}
|
||||
|
||||
if(isPlayerInAnyBusiness(client)) {
|
||||
setEntityData(client, "ag.inHouse", getPlayerBusiness(client));
|
||||
setEntityData(client, "vrr.inHouse", getPlayerBusiness(client));
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You teleported ${getInlineChatColourByName("lightGrey")}${targetgetPlayerName(client)} ${getInlineChatColourByName("white")}to you.`);
|
||||
@@ -753,7 +753,9 @@ function forceCharacterNameChangeCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
messagePlayerSuccess(client, `You forced ${getInlineChatColourByName("lightGrey")}${targetgetPlayerName(targetClient)} (${getCharacterFullName(targetClient)}) ${getInlineChatColourByName("white")}to change their character's name.`);
|
||||
getPlayerData(targetClient).changingCharacterName = true;
|
||||
|
||||
messagePlayerSuccess(client, `You forced ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)} (${getCharacterFullName(targetClient)}) ${getInlineChatColourByName("white")}to change their character's name.`);
|
||||
showPlayerNewCharacterFailedGUI(targetClient, "Non-RP name! Choose a new one:");
|
||||
}
|
||||
|
||||
@@ -788,7 +790,9 @@ function forceCharacterNameCommand(command, params, client) {
|
||||
getPlayerCurrentSubAccount(targetClient).firstName = firstName;
|
||||
getPlayerCurrentSubAccount(targetClient).lastName = lastName;
|
||||
|
||||
messagePlayerSuccess(client, `You forced ${getInlineChatColourByName("lightGrey")}${targetgetPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}current character name from ${getInlineChatColourByName("lightGrey")}${oldName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newName}`);
|
||||
messagePlayerSuccess(client, `You forced ${getInlineChatColourByName("lightGrey")}${getPlayerName(targetClient)}'s ${getInlineChatColourByName("white")}current character name from ${getInlineChatColourByName("lightGrey")}${oldName} ${getInlineChatColourByName("white")}to ${getInlineChatColourByName("lightGrey")}${newName}`);
|
||||
|
||||
updateAllPlayerNameTags();
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -275,6 +275,12 @@ function setElementDimension(element, dimension) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementRotation(element, rotation) {
|
||||
return element.setRotation(rotation);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function givePlayerHealth(client, amount) {
|
||||
if(getPlayerHealth(client)+amount > 100) {
|
||||
logToConsole(LOG_DEBUG, `Setting ${getPlayerDisplayForConsole(client)}'s health to 100`);
|
||||
@@ -321,4 +327,34 @@ function getServerName() {
|
||||
return server.name;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createGamePickup(model, position) {
|
||||
return gta.createPickup(model, position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function createGameObject(model, position) {
|
||||
return gta.createObject(model, position);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function setElementOnAllDimensions(element, state) {
|
||||
element.onAllDimensions = state;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function destroyGameElement(element) {
|
||||
destroyElement(element);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function isMeleeWeapon(weaponId, gameId = getServerGame()) {
|
||||
return (getGameData().meleeWeapons[gameId].indexOf(weaponId) != -1);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -57,37 +57,90 @@ function playStreamingRadioCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!isPlayerInAnyVehicle(client)) {
|
||||
if(isPlayerInAnyVehicle(client)) {
|
||||
if(!getVehicleData(getPlayerVehicle(client))) {
|
||||
messagePlayerError(client, "This is a random traffic vehicle and commands can't be used for it.");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
if(radioStationId == 0) {
|
||||
getVehicleData(getPlayerVehicle(client)).streamingRadioStation = -1;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off their vehicle's radio`);
|
||||
|
||||
if(!getVehicleData(getPlayerVehicle(client))) {
|
||||
messagePlayerError(client, "This is a random traffic vehicle and commands can't be used for it.");
|
||||
return false;
|
||||
}
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if(radioStationId == 0) {
|
||||
getVehicleData(getPlayerVehicle(client)).streamingRadioStation = -1;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off their vehicle's radio`);
|
||||
getVehicleData(getPlayerVehicle(client)).streamingRadioStation = radioStationId-1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, `changes their vehicle's radio station to ${radioStations[radioStationId-1].name} (${radioStations[radioStationId-1].genre})`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
playRadioStreamForPlayer(clients[i], radioStations[radioStationId-1].url, true, getPlayerStreamingRadioVolume(client));
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if(doesEntityDataExist(client, "vrr.inHouse")) {
|
||||
let houseId = getEntityData(client, "vrr.inHouse");
|
||||
if(radioStationId == 0) {
|
||||
getHouseData(houseId).streamingRadioStation = -1;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off the house radio`);
|
||||
|
||||
getVehicleData(getPlayerVehicle(client)).streamingRadioStation = radioStationId-1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, `changes their vehicle's radio station to ${radioStations[radioStationId-1].name} (${radioStations[radioStationId-1].genre})`);
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getHouseData(houseId).streamingRadioStation = radioStationId-1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, `changes their house radio station to ${radioStations[radioStationId-1].name} (${radioStations[radioStationId-1].genre})`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getPlayerVehicle(client) == getPlayerVehicle(clients[i])) {
|
||||
playRadioStreamForPlayer(clients[i], radioStations[radioStationId-1].url, true, getPlayerData(client).streamingRadioVolume);
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inHouse") == houseId) {
|
||||
playRadioStreamForPlayer(clients[i], radioStations[radioStationId-1].url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(doesEntityDataExist(client, "vrr.inBusiness")) {
|
||||
let businessId = getEntityData(client, "vrr.inBusiness");
|
||||
if(radioStationId == 0) {
|
||||
getBusinessData(businessId).streamingRadioStation = -1;
|
||||
getPlayerData(client).streamingRadioStation = -1;
|
||||
meActionToNearbyPlayers(client, `turns off the business radio`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inBusiness") == businessId) {
|
||||
playRadioStreamForPlayer(clients[i], "");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
getBusinessData(businessId).streamingRadioStation = radioStationId-1;
|
||||
getPlayerData(client).streamingRadioStation = radioStationId-1;
|
||||
meActionToNearbyPlayers(client, `changes the business radio station to ${radioStations[radioStationId-1].name} (${radioStations[radioStationId-1].genre})`);
|
||||
|
||||
let clients = getClients();
|
||||
for(let i in clients) {
|
||||
if(getEntityData(clients[i], "vrr.inBusiness") == businessId) {
|
||||
playRadioStreamForPlayer(clients[i], radioStations[radioStationId-1].url, true, getPlayerStreamingRadioVolume(clients[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
messagePlayerError(client, "You need to be in a vehicle, business, or house to set it's radio station!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -108,7 +161,7 @@ function setStreamingRadioVolumeCommand(command, params, client) {
|
||||
}
|
||||
|
||||
setPlayerStreamingRadioVolume(client, toInteger(volumeLevel));
|
||||
getPlayerData(client).streamingRadioVolume = toInteger(volumeLevel);
|
||||
getPlayerData(client).accountData.streamingRadioVolume = toInteger(volumeLevel);
|
||||
let volumeEmoji = '';
|
||||
if(volumeLevel >= 60) {
|
||||
volumeEmoji = '🔊 ';
|
||||
@@ -123,4 +176,13 @@ function setStreamingRadioVolumeCommand(command, params, client) {
|
||||
messagePlayerSuccess(client, `${volumeEmoji}You set your streaming radio volume to ${volumeLevel}%`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPlayerStreamingRadioVolume(client) {
|
||||
if(!getPlayerData(client)) {
|
||||
return 20;
|
||||
}
|
||||
return getPlayerData(client).accountData.streamingRadioVolume;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -258,6 +258,14 @@ function checkNewCharacter(client, firstName, lastName) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(getPlayerData(client).changingCharacterName) {
|
||||
getPlayerCurrentSubAccount(client).firstName = fixCharacterName(firstName);
|
||||
getPlayerCurrentSubAccount(client).lastName = fixCharacterName(lastName);
|
||||
updateAllPlayerNameTags(client);
|
||||
hideAllPlayerGUI(client);
|
||||
return true;
|
||||
}
|
||||
|
||||
let skinId = allowedSkins[getServerGame()][getPlayerData(client).creatingCharacterSkin];
|
||||
|
||||
let subAccountData = createSubAccount(getPlayerData(client).accountData.databaseId, firstName, lastName);
|
||||
|
||||
@@ -72,6 +72,9 @@ function updatePings() {
|
||||
for(let i in clients) {
|
||||
if(!clients[i].console) {
|
||||
updatePlayerPing(clients[i]);
|
||||
if(isPlayerSpawned(clients[i])) {
|
||||
updatePlayerCash(clients[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,8 +168,10 @@ function getClosestVehicle(position) {
|
||||
let vehicles = getServerData().vehicles;
|
||||
let closest = 0;
|
||||
for(let i in vehicles) {
|
||||
if(getDistance(getVehiclePosition(vehicles[i].vehicle), position) < getDistance(getVehiclePosition(vehicles[closest].vehicle), position)) {
|
||||
closest = i;
|
||||
if(vehicles[i] != null) {
|
||||
if(vehicles[closest] == null || getDistance(getVehiclePosition(vehicles[i].vehicle), position) < getDistance(getVehiclePosition(vehicles[closest].vehicle), position)) {
|
||||
closest = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return vehicles[closest].vehicle;
|
||||
@@ -595,13 +597,13 @@ function createAllFuelStationBlips() {
|
||||
// ===========================================================================
|
||||
|
||||
function getPickupOwnerType(pickup) {
|
||||
return pickup.getData("ag.ownerType");
|
||||
return pickup.getData("vrr.ownerType");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getPickupOwnerId(pickup) {
|
||||
return pickup.getData("ag.ownerId");
|
||||
return pickup.getData("vrr.ownerId");
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -702,6 +704,12 @@ function getLockedUnlockedFromBool(boolVal) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getOpenedClosedFromBool(boolVal) {
|
||||
return (boolVal) ? "Opened" : "Closed";
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateServerRules() {
|
||||
server.setRule("Time", makeReadableTime(getServerConfig().hour, getServerConfig().minute));
|
||||
server.setRule("Weather", getGameData().weatherNames[getServerGame()][getServerConfig().weather]);
|
||||
@@ -813,7 +821,7 @@ function getBusinessFromParams(params) {
|
||||
|
||||
function getGameLocationFromParams(params) {
|
||||
if(isNaN(params)) {
|
||||
for(let i in getGameData().locations) {
|
||||
for(let i in getGameData().locations[getServerGame()]) {
|
||||
if(toLowerCase(getGameData().locations[getServerGame()][i][0]).indexOf(toLowerCase(params)) != -1) {
|
||||
return i;
|
||||
}
|
||||
@@ -969,6 +977,9 @@ function getPlayerNameForNameTag(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function isPlayerSpawned(client) {
|
||||
if(!getPlayerData(client)) {
|
||||
return false;
|
||||
}
|
||||
return getPlayerData(client).spawned;
|
||||
}
|
||||
|
||||
@@ -1555,13 +1566,13 @@ function isConsole(client) {
|
||||
// ===========================================================================
|
||||
|
||||
function updateConnectionLogOnQuit(client, quitReasonId) {
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_when_disconnect=UNIX_TIMESTAMP(), conn_how_disconnect=${quitReasonId} WHERE conn_id = ${toInteger(getEntityData(client, "ag.connection"))}`);
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_when_disconnect=UNIX_TIMESTAMP(), conn_how_disconnect=${quitReasonId} WHERE conn_id = ${toInteger(getEntityData(client, "vrr.connection"))}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function updateConnectionLogOnAuth(client, authId) {
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_auth=${authId} WHERE conn_id = ${toInteger(getEntityData(client, "ag.connection"))}`);
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_auth=${authId} WHERE conn_id = ${toInteger(getEntityData(client, "vrr.connection"))}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -1572,7 +1583,7 @@ function updateConnectionLogOnClientInfoReceive(client, clientVersion, screenWid
|
||||
let safeClientVersion = escapeDatabaseString(dbConnection, clientVersion);
|
||||
let safeScreenWidth = escapeDatabaseString(dbConnection, toString(screenWidth));
|
||||
let safeScreenHeight = escapeDatabaseString(dbConnection, toString(screenHeight));
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_client_version='${safeClientVersion}', conn_screen_width='${safeScreenWidth}', conn_screen_height='${safeScreenHeight}' WHERE conn_id = ${toInteger(getEntityData(client, "ag.connection"))}`);
|
||||
quickDatabaseQuery(`UPDATE conn_main SET conn_client_version='${safeClientVersion}', conn_screen_width='${safeScreenWidth}', conn_screen_height='${safeScreenHeight}' WHERE conn_id = ${toInteger(getEntityData(client, "vrr.connection"))}`);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1602,4 +1613,14 @@ function fixCharacterName(name) {
|
||||
return String(name.charAt(0).toUpperCase()) + String(name.slice(1).toLowerCase());
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function splitArrayIntoChunks(originalArray, perChunk) {
|
||||
let tempArray = [];
|
||||
for (let i = 0; i < originalArray.length; i += perChunk) {
|
||||
tempArray.push(originalArray.slice(i, i + perChunk));
|
||||
}
|
||||
return tempArray;
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -101,14 +101,14 @@ function spawnAllVehicles() {
|
||||
for(let i in getServerData().vehicles) {
|
||||
let vehicle = spawnVehicle(getServerData().vehicles[i]);
|
||||
getServerData().vehicles[i].vehicle = vehicle;
|
||||
setEntityData(vehicle, "ag.dataSlot", i, false);
|
||||
setEntityData(vehicle, "vrr.dataSlot", i, false);
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function getVehicleData(vehicle) {
|
||||
let dataIndex = getEntityData(vehicle, "ag.dataSlot");
|
||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||
if(typeof getServerData().vehicles[dataIndex] != "undefined") {
|
||||
return getServerData().vehicles[dataIndex];
|
||||
}
|
||||
@@ -193,6 +193,32 @@ function vehicleLockCommand(command, params, client) {
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleTrunkCommand(command, params, client) {
|
||||
let vehicle = getClosestVehicle(getPlayerPosition(client));
|
||||
|
||||
let behindPosition = getPosBehindPos(getVehiclePosition(vehicle), getVehicleHeading(vehicle), getGlobalConfig().vehicleTrunkDistance);
|
||||
if(!getPlayerVehicle(client) && getDistance(behindPosition, getPlayerPosition(client)) > getGlobalConfig().vehicleTrunkDistance) {
|
||||
messagePlayerError(client, "You need to be in or near a vehicle!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!getVehicleData(vehicle)) {
|
||||
messagePlayerError(client, "This is a random traffic vehicle and commands can't be used for it.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||
messagePlayerError(client, "You don't have keys to this vehicle!");
|
||||
return false;
|
||||
}
|
||||
|
||||
getVehicleData(vehicle).trunk = !getVehicleData(vehicle).trunk;
|
||||
|
||||
meActionToNearbyPlayers(client, `${toLowerCase(getOpenedClosedFromBool(getVehicleData(vehicle).trunk))} the ${getVehicleName(vehicle)}'s trunk.`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
|
||||
function vehicleLightsCommand(command, params, client) {
|
||||
if(!getPlayerVehicle(client)) {
|
||||
messagePlayerError(client, "You need to be in a vehicle!");
|
||||
@@ -212,7 +238,7 @@ function vehicleLightsCommand(command, params, client) {
|
||||
}
|
||||
|
||||
getVehicleData(vehicle).lights = !getVehicleData(vehicle).lights;
|
||||
setEntityData(vehicle, "ag.lights", getVehicleData(vehicle).lights);
|
||||
setEntityData(vehicle, "vrr.lights", getVehicleData(vehicle).lights);
|
||||
setVehicleLightsState(vehicle, getVehicleData(vehicle).lights);
|
||||
|
||||
meActionToNearbyPlayers(client, `turned the ${getVehicleName(vehicle)}'s lights ${toLowerCase(getOnOffFromBool(getVehicleData(vehicle).lights))}`);
|
||||
@@ -233,7 +259,7 @@ function deleteVehicleCommand(command, params, client) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let dataIndex = getEntityData(vehicle, "ag.dataSlot");
|
||||
let dataIndex = getEntityData(vehicle, "vrr.dataSlot");
|
||||
let vehicleName = getVehicleName(vehicle);
|
||||
|
||||
quickDatabaseQuery(`DELETE FROM veh_main WHERE veh_id = ${getVehicleData(vehicle).databaseId}`);
|
||||
@@ -469,7 +495,7 @@ function rentVehicleCommand(command, params, client) {
|
||||
// ===========================================================================
|
||||
|
||||
function enterVehicleAsPassengerCommand(command, params, client) {
|
||||
triggerNetworkEvent("ag.passenger", client);
|
||||
triggerNetworkEvent("vrr.passenger", client);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -729,7 +755,7 @@ function setVehicleBuyPriceCommand(command, params, client) {
|
||||
|
||||
getVehicleData(vehicle).buyPrice = amount;
|
||||
|
||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}'s ${getInlineChatColourByName("white")}buy price to ${getInlineChatColourByName("lightGrey")}$${amount}!`);
|
||||
messageAdmins(`${getInlineChatColourByName("lightGrey")}${getPlayerName(client)} ${getInlineChatColourByName("white")}set their ${getInlineChatColourByType("vehiclePurple")}${getVehicleName(vehicle)}'s ${getInlineChatColourByName("white")}buy price to ${getInlineChatColourByName("lightGrey")}$${amount}`);
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
@@ -874,7 +900,7 @@ function respawnVehicle(vehicle) {
|
||||
destroyElement(vehicle);
|
||||
let newVehicle = spawnVehicle(vehicles[i]);
|
||||
vehicles[i].vehicle = newVehicle;
|
||||
setEntityData(newVehicle, "ag.dataSlot", i, false);
|
||||
setEntityData(newVehicle, "vrr.dataSlot", i, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -905,7 +931,7 @@ function spawnVehicle(vehicleData) {
|
||||
|
||||
vehicleData.vehicle = vehicle;
|
||||
|
||||
setEntityData(vehicle, "ag.livery", vehicleData.livery);
|
||||
setEntityData(vehicle, "vrr.livery", vehicleData.livery);
|
||||
|
||||
return vehicle;
|
||||
}
|
||||
@@ -1014,7 +1040,7 @@ function createNewDealershipVehicle(model, spawnPosition, spawnRotation, price,
|
||||
tempVehicleData.ownerType = VRR_VEHOWNER_BIZ;
|
||||
tempVehicleData.ownerId = dealershipId;
|
||||
|
||||
setEntityData(vehicle, "ag.dataSlot", vehicleDataSlot, true);
|
||||
setEntityData(vehicle, "vrr.dataSlot", vehicleDataSlot, true);
|
||||
|
||||
getServerData().vehicles.push(tempVehicleData);
|
||||
}
|
||||
@@ -1029,7 +1055,7 @@ function createTemporaryVehicle(modelId, position, heading) {
|
||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
||||
tempVehicleData.databaseId = -1;
|
||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||
setEntityData(vehicle, "ag.dataSlot", slot-1, false);
|
||||
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
||||
|
||||
return vehicle;
|
||||
}
|
||||
@@ -1043,7 +1069,7 @@ function createPermanentVehicle(modelId, position, heading) {
|
||||
|
||||
let tempVehicleData = new serverClasses.vehicleData(false, vehicle);
|
||||
let slot = getServerData().vehicles.push(tempVehicleData);
|
||||
setEntityData(vehicle, "ag.dataSlot", slot-1, false);
|
||||
setEntityData(vehicle, "vrr.dataSlot", slot-1, false);
|
||||
|
||||
return vehicle;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ function getEntityData(entity, dataName) {
|
||||
|
||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||
if(entity != null) {
|
||||
if(!isNull(server)) {
|
||||
if(typeof server != "undefined") {
|
||||
return entity.setData(dataName, dataValue, syncToClients);
|
||||
} else {
|
||||
return entity.setData(dataName, dataValue);
|
||||
|
||||
Reference in New Issue
Block a user