Merge branch 'nightly' into organizing
This commit is contained in:
@@ -66,25 +66,25 @@ function initLabelJobHelpFont() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
||||||
if(localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
if (propertyLabelNameFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
if (propertyLabelLockedFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
if (!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
if (!natives.isViewportActive(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -93,45 +93,45 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
||||||
} else {
|
} else {
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
if(price > "0") {
|
if (price > "0") {
|
||||||
text = getLocaleString("PropertyForSaleLabel", price);
|
text = getLocaleString("PropertyForSaleLabel", price);
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
screenPosition.y -= propertyLabelPriceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
text = "";
|
text = "";
|
||||||
if(rentPrice != "0") {
|
if (rentPrice != "0") {
|
||||||
text = getLocaleString("PropertyForRentLabel", rentPrice);
|
text = getLocaleString("PropertyForRentLabel", rentPrice);
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(200, 200, 200, 255), false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
screenPosition.y -= propertyLabelPriceOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isBusiness) {
|
if (isBusiness) {
|
||||||
text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
|
text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
|
||||||
} else {
|
} else {
|
||||||
text = (locked) ? toUpperCase(getLocaleString("Locked")) : toUpperCase(getLocaleString("Unlocked"));
|
text = (locked) ? toUpperCase(getLocaleString("Locked")) : toUpperCase(getLocaleString("Unlocked"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
if (!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
||||||
let infoText = "";
|
let infoText = "";
|
||||||
switch(labelInfoType) {
|
switch (labelInfoType) {
|
||||||
case VRR_PROPLABEL_INFO_ENTER: {
|
case VRR_PROPLABEL_INFO_ENTER: {
|
||||||
if(enterPropertyKey) {
|
if (enterPropertyKey) {
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||||
} else {
|
} else {
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||||
@@ -165,7 +165,7 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
}
|
}
|
||||||
|
|
||||||
default: {
|
default: {
|
||||||
if(enterPropertyKey) {
|
if (enterPropertyKey) {
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
||||||
} else {
|
} else {
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
||||||
@@ -173,45 +173,45 @@ function renderPropertyEntranceLabel(name, position, locked, isBusiness, price,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
if (getDistance(localPlayer.position, position) <= renderLabelDistance - 2) {
|
||||||
let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(infoText, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(infoText, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
|
propertyLabelLockedFont.render(infoText, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, toColour(234, 198, 126, 255), false, true, false, true);
|
||||||
screenPosition.y -= propertyLabelLockedOffset;
|
screenPosition.y -= propertyLabelLockedOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
let size = propertyLabelLockedFont.measure(text, game.width, 0.0, 0.0, propertyLabelLockedFont.size, true, true);
|
||||||
propertyLabelLockedFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
propertyLabelLockedFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelLockedFont.size, (locked) ? lockedColour : unlockedColour, false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelNameOffset;
|
screenPosition.y -= propertyLabelNameOffset;
|
||||||
|
|
||||||
text = name || " ";
|
text = name || " ";
|
||||||
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
propertyLabelNameFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelNameFont.size, (isBusiness) ? toColour(0, 153, 255, 255) : toColour(17, 204, 17, 255), false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function renderPropertyExitLabel(position) {
|
function renderPropertyExitLabel(position) {
|
||||||
if(localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
if (propertyLabelNameFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
if (propertyLabelLockedFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
if (!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
if (!natives.isViewportActive(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -220,43 +220,43 @@ function renderPropertyExitLabel(position) {
|
|||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
||||||
} else {
|
} else {
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "EXIT";
|
let text = "EXIT";
|
||||||
let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
let size = propertyLabelNameFont.measure(text, game.width, 0.0, 0.0, propertyLabelNameFont.size, true, true);
|
||||||
propertyLabelNameFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
propertyLabelNameFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, propertyLabelNameFont.size, COLOUR_WHITE, false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function renderJobLabel(name, position, jobType) {
|
function renderJobLabel(name, position, jobType) {
|
||||||
if(localPlayer == null) {
|
if (localPlayer == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobNameLabelFont == null) {
|
if (jobNameLabelFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(jobHelpLabelFont == null) {
|
if (jobHelpLabelFont == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
if (!natives.doesViewportExist(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
if (!natives.isViewportActive(natives.getGameViewportId())) {
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -265,25 +265,25 @@ function renderJobLabel(name, position, jobType) {
|
|||||||
let tempPosition = position;
|
let tempPosition = position;
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
||||||
} else {
|
} else {
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
screenPosition = getScreenFromWorldPosition(tempPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
if (screenPosition.x < 0 || screenPosition.x > game.width) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let text = "";
|
let text = "";
|
||||||
if(jobType == localPlayerJobType) {
|
if (jobType == localPlayerJobType) {
|
||||||
if(localPlayerWorking) {
|
if (localPlayerWorking) {
|
||||||
text = getLocaleString("JobEquipAndUniformLabel", "/equip", "/uniform", "/stopwork");
|
text = getLocaleString("JobEquipAndUniformLabel", "/equip", "/uniform", "/stopwork");
|
||||||
} else {
|
} else {
|
||||||
text = getLocaleString("StartWorkLabel", "/startwork");
|
text = getLocaleString("StartWorkLabel", "/startwork");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(localPlayerJobType == 0) {
|
if (localPlayerJobType == 0) {
|
||||||
text = getLocaleString("TakeJobLabel", "/takejob");
|
text = getLocaleString("TakeJobLabel", "/takejob");
|
||||||
} else {
|
} else {
|
||||||
text = getLocaleString("NotYourJobLabel", "/quitjob");
|
text = getLocaleString("NotYourJobLabel", "/quitjob");
|
||||||
@@ -291,37 +291,37 @@ function renderJobLabel(name, position, jobType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
|
let size = jobHelpLabelFont.measure(text, game.width, 0.0, 0.0, jobHelpLabelFont.size, true, true);
|
||||||
jobHelpLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
jobHelpLabelFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, jobHelpLabelFont.size, COLOUR_YELLOW, false, true, false, true);
|
||||||
|
|
||||||
screenPosition.y -= 18;
|
screenPosition.y -= 18;
|
||||||
|
|
||||||
text = getLocaleString("JobLabel", name);
|
text = getLocaleString("JobLabel", name);
|
||||||
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
|
size = jobNameLabelFont.measure(text, game.width, 0.0, 0.0, jobNameLabelFont.size, true, true);
|
||||||
jobNameLabelFont.render(text, [screenPosition.x-size[0]/2, screenPosition.y-size[1]/2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
jobNameLabelFont.render(text, [screenPosition.x - size[0] / 2, screenPosition.y - size[1] / 2], game.width, 0.0, 0.0, jobNameLabelFont.size, COLOUR_WHITE, false, true, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
|
||||||
function processLabelRendering() {
|
function processLabelRendering() {
|
||||||
if(renderLabels) {
|
if (renderLabels) {
|
||||||
if(!areServerElementsSupported()) {
|
if (!areServerElementsSupported()) {
|
||||||
if(localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
getServerData().businesses.forEach((business) => {
|
getServerData().businesses.forEach((business) => {
|
||||||
if(getDistance(localPlayer.position, business.entrancePosition) <= 75.0) {
|
if (getDistance(localPlayer.position, business.entrancePosition) <= 75.0) {
|
||||||
natives.drawColouredCylinder(getPosBelowPos(business.entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
|
natives.drawColouredCylinder(getPosBelowPos(business.entrancePosition, 1.0), 0.0, 0.0, 0, 153, 255, 255);
|
||||||
//renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, makeLargeNumberReadable(business.price), makeLargeNumberReadable(business.rentPrice), business.labelInfoType);
|
//renderPropertyEntranceLabel(business.name, business.entrancePosition, business.locked, true, makeLargeNumberReadable(business.price), makeLargeNumberReadable(business.rentPrice), business.labelInfoType);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getServerData().houses.forEach((house) => {
|
getServerData().houses.forEach((house) => {
|
||||||
if(getDistance(localPlayer.position, house.entrancePosition) <= 75.0) {
|
if (getDistance(localPlayer.position, house.entrancePosition) <= 75.0) {
|
||||||
natives.drawColouredCylinder(getPosBelowPos(house.entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
|
natives.drawColouredCylinder(getPosBelowPos(house.entrancePosition, 1.0), 0.0, 0.0, 0, 200, 0, 255);
|
||||||
//renderPropertyEntranceLabel("House", house.entrancePosition, house.locked, true, makeLargeNumberReadable(house.price), makeLargeNumberReadable(house.rentPrice), 0);
|
//renderPropertyEntranceLabel("House", house.entrancePosition, house.locked, true, makeLargeNumberReadable(house.price), makeLargeNumberReadable(house.rentPrice), 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
getServerData().jobs.forEach((job) => {
|
getServerData().jobs.forEach((job) => {
|
||||||
if(getDistance(localPlayer.position, job.position) <= 75.0) {
|
if (getDistance(localPlayer.position, job.position) <= 75.0) {
|
||||||
natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
||||||
//renderJobLabel(job.name, job.position, job.jobType);
|
//renderJobLabel(job.name, job.position, job.jobType);
|
||||||
}
|
}
|
||||||
@@ -329,29 +329,29 @@ function processLabelRendering() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areWorldLabelsSupported()) {
|
if (areWorldLabelsSupported()) {
|
||||||
if(localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
let pickups = getElementsByType(ELEMENT_PICKUP);
|
||||||
for(let i in pickups) {
|
for (let i in pickups) {
|
||||||
if(pickups[i].getData("vrr.label.type") != null) {
|
if (pickups[i].getData("vrr.label.type") != null) {
|
||||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
if (getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
||||||
if(!pickups[i].isOnScreen) {
|
if (!pickups[i].isOnScreen) {
|
||||||
let price = "0";
|
let price = "0";
|
||||||
let rentPrice = "0";
|
let rentPrice = "0";
|
||||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
||||||
if(pickups[i].getData("vrr.label.price") != null) {
|
if (pickups[i].getData("vrr.label.price") != null) {
|
||||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
if (pickups[i].getData("vrr.label.rentprice") != null) {
|
||||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.help") != null) {
|
if (pickups[i].getData("vrr.label.help") != null) {
|
||||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
labelInfoType = pickups[i].getData("vrr.label.help");
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(pickups[i].getData("vrr.label.type")) {
|
switch (pickups[i].getData("vrr.label.type")) {
|
||||||
case VRR_LABEL_BUSINESS: {
|
case VRR_LABEL_BUSINESS: {
|
||||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function getPlayerPosition() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPlayerPosition(position) {
|
function setPlayerPosition(position) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.setCharCoordinates(localPlayer, position);
|
natives.setCharCoordinates(localPlayer, position);
|
||||||
} else {
|
} else {
|
||||||
localPlayer.position = position;
|
localPlayer.position = position;
|
||||||
@@ -59,11 +59,11 @@ function getElementHeading(elementId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementPosition(elementId, position) {
|
function setElementPosition(elementId, position) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if (getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!getElementFromId(elementId).isSyncer) {
|
if (!getElementFromId(elementId).isSyncer) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -73,7 +73,7 @@ function setElementPosition(elementId, position) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function deleteGameElement(elementId, position) {
|
function deleteGameElement(elementId, position) {
|
||||||
if(!getElementFromId(elementId).isOwner) {
|
if (!getElementFromId(elementId).isOwner) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,8 +110,8 @@ function getElementId(element) {
|
|||||||
|
|
||||||
function getClientFromIndex(index) {
|
function getClientFromIndex(index) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(clients[i].index == index) {
|
if (clients[i].index == index) {
|
||||||
return clients[i];
|
return clients[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -170,8 +170,8 @@ function is2dPositionOnScreen(pos2d) {
|
|||||||
function getVehiclesInRange(position, range) {
|
function getVehiclesInRange(position, range) {
|
||||||
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
let vehicles = getElementsByType(ELEMENT_VEHICLE);
|
||||||
let inRangeVehicles = [];
|
let inRangeVehicles = [];
|
||||||
for(let i in vehicles) {
|
for (let i in vehicles) {
|
||||||
if(getDistance(position, vehicles[i].position) <= range) {
|
if (getDistance(position, vehicles[i].position) <= range) {
|
||||||
inRangeVehicles.push(vehicles[i]);
|
inRangeVehicles.push(vehicles[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -181,13 +181,13 @@ function getVehiclesInRange(position, range) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function createGameBlip(blipModel, position, name = "") {
|
function createGameBlip(blipModel, position, name = "") {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
let blipId = natives.addBlipForCoord(position);
|
let blipId = natives.addBlipForCoord(position);
|
||||||
if(blipId) {
|
if (blipId) {
|
||||||
natives.changeBlipSprite(blipId, blipModel);
|
natives.changeBlipSprite(blipId, blipModel);
|
||||||
natives.setBlipMarkerLongDistance(blipId, false);
|
natives.setBlipMarkerLongDistance(blipId, false);
|
||||||
natives.setBlipAsShortRange(blipId, true);
|
natives.setBlipAsShortRange(blipId, true);
|
||||||
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ...": ""}`);
|
natives.changeBlipNameFromAscii(blipId, `${name.substr(0, 24)}${(name.length > 24) ? " ..." : ""}`);
|
||||||
return blipId;
|
return blipId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -198,7 +198,7 @@ function createGameBlip(blipModel, position, name = "") {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
function setEntityData(entity, dataName, dataValue, syncToClients = true) {
|
||||||
if(entity != null) {
|
if (entity != null) {
|
||||||
return entity.setData(dataName, dataValue);
|
return entity.setData(dataName, dataValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,64 +224,64 @@ function repairVehicle(syncId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncVehicleProperties(vehicle) {
|
function syncVehicleProperties(vehicle) {
|
||||||
if(doesEntityDataExist(vehicle, "vrr.lights")) {
|
if (doesEntityDataExist(vehicle, "vrr.lights")) {
|
||||||
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
let lightStatus = getEntityData(vehicle, "vrr.lights");
|
||||||
vehicle.lights = lightStatus;
|
vehicle.lights = lightStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.invincible")) {
|
if (doesEntityDataExist(vehicle, "vrr.invincible")) {
|
||||||
let invincible = getEntityData(vehicle, "vrr.invincible");
|
let invincible = getEntityData(vehicle, "vrr.invincible");
|
||||||
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
element.setProofs(invincible, invincible, invincible, invincible, invincible);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
if (doesEntityDataExist(vehicle, "vrr.panelStatus")) {
|
||||||
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
let panelsStatus = getEntityData(vehicle, "vrr.panelStatus");
|
||||||
for(let i in panelsStatus) {
|
for (let i in panelsStatus) {
|
||||||
vehicle.setPanelStatus(i, panelsStatus[i]);
|
vehicle.setPanelStatus(i, panelsStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
if (doesEntityDataExist(vehicle, "vrr.wheelStatus")) {
|
||||||
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
let wheelsStatus = getEntityData(vehicle, "vrr.wheelStatus");
|
||||||
for(let i in wheelsStatus) {
|
for (let i in wheelsStatus) {
|
||||||
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
vehicle.setWheelStatus(i, wheelsStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
if (doesEntityDataExist(vehicle, "vrr.lightStatus")) {
|
||||||
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
let lightStatus = getEntityData(vehicle, "vrr.lightStatus");
|
||||||
for(let i in lightStatus) {
|
for (let i in lightStatus) {
|
||||||
vehicle.setLightStatus(i, lightStatus[i]);
|
vehicle.setLightStatus(i, lightStatus[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
if (doesEntityDataExist(vehicle, "vrr.suspensionHeight")) {
|
||||||
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
let suspensionHeight = getEntityData(vehicle, "vrr.suspensionHeight");
|
||||||
vehicle.setSuspensionHeight(suspensionHeight);
|
vehicle.setSuspensionHeight(suspensionHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
let allUpgrades = getGameConfig().vehicleUpgrades[getGame()];
|
||||||
for(let i in allUpgrades) {
|
for (let i in allUpgrades) {
|
||||||
vehicle.removeUpgrade(i);
|
vehicle.removeUpgrade(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
if (doesEntityDataExist(vehicle, "vrr.upgrades")) {
|
||||||
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
let upgrades = getEntityData(vehicle, "vrr.upgrades");
|
||||||
for(let i in upgrades) {
|
for (let i in upgrades) {
|
||||||
if(upgrades[i] != 0) {
|
if (upgrades[i] != 0) {
|
||||||
vehicle.addUpgrade(upgrades[i]);
|
vehicle.addUpgrade(upgrades[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_SA || getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(vehicle, "vrr.livery")) {
|
if (doesEntityDataExist(vehicle, "vrr.livery")) {
|
||||||
let livery = getEntityData(vehicle, "vrr.livery");
|
let livery = getEntityData(vehicle, "vrr.livery");
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
vehicle.setPaintJob(livery);
|
vehicle.setPaintJob(livery);
|
||||||
} else if(getGame() == VRR_GAME_GTA_IV) {
|
} else if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
vehicle.livery = livery;
|
vehicle.livery = livery;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -291,7 +291,7 @@ function syncVehicleProperties(vehicle) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function removeEntityData(entity, dataName) {
|
function removeEntityData(entity, dataName) {
|
||||||
if(entity != null) {
|
if (entity != null) {
|
||||||
return entity.removeData(dataName);
|
return entity.removeData(dataName);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -300,7 +300,7 @@ function removeEntityData(entity, dataName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doesEntityDataExist(entity, dataName) {
|
function doesEntityDataExist(entity, dataName) {
|
||||||
if(entity != null) {
|
if (entity != null) {
|
||||||
return (entity.getData(dataName) != null);
|
return (entity.getData(dataName) != null);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@@ -309,8 +309,8 @@ function doesEntityDataExist(entity, dataName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncCivilianProperties(civilian) {
|
function syncCivilianProperties(civilian) {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if (getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.scale")) {
|
if (doesEntityDataExist(civilian, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
let scaleFactor = getEntityData(civilian, "vrr.scale");
|
||||||
let tempMatrix = civilian.matrix;
|
let tempMatrix = civilian.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
@@ -321,78 +321,78 @@ function syncCivilianProperties(civilian) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
if (doesEntityDataExist(civilian, "vrr.fightStyle")) {
|
||||||
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
let fightStyle = getEntityData(civilian, "vrr.fightStyle");
|
||||||
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
civilian.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if (getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
if (doesEntityDataExist(civilian, "vrr.walkStyle")) {
|
||||||
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
let walkStyle = getEntityData(civilian, "vrr.walkStyle");
|
||||||
civilian.walkStyle = walkStyle;
|
civilian.walkStyle = walkStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropHair")) {
|
||||||
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
let bodyPropHair = getEntityData(civilian, "vrr.bodyPropHair");
|
||||||
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
civilian.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropHead")) {
|
||||||
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
let bodyPropHead = getEntityData(civilian, "vrr.bodyPropHead");
|
||||||
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
civilian.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropEyes")) {
|
||||||
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
let bodyPropEyes = getEntityData(civilian, "vrr.bodyPropEyes");
|
||||||
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
civilian.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftHand")) {
|
||||||
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
let bodyPropLeftHand = getEntityData(civilian, "vrr.bodyPropLeftHand");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
civilian.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropRightHand")) {
|
||||||
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
let bodyPropRightHand = getEntityData(civilian, "vrr.bodyPropRightHand");
|
||||||
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
civilian.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftWrist")) {
|
||||||
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
let bodyPropLeftWrist = getEntityData(civilian, "vrr.bodyPropLeftWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
civilian.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(civilian, "vrr.bodyPropRightWrist");
|
||||||
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
civilian.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropHip")) {
|
||||||
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
let bodyPropHip = getEntityData(civilian, "vrr.bodyPropHip");
|
||||||
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
civilian.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropLeftFoot")) {
|
||||||
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
let bodyPropLeftFoot = getEntityData(civilian, "vrr.bodyPropLeftFoot");
|
||||||
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
civilian.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
if (doesEntityDataExist(civilian, "vrr.bodyPropRightFoot")) {
|
||||||
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
let bodyPropRightFoot = getEntityData(civilian, "vrr.bodyPropRightFoot");
|
||||||
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
civilian.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(civilian, "vrr.anim")) {
|
if (doesEntityDataExist(civilian, "vrr.anim")) {
|
||||||
let animData = getEntityData(vehicle, "vrr.anim");
|
let animData = getEntityData(vehicle, "vrr.anim");
|
||||||
civilian.addAnimation(animData[0], animData[1]);
|
civilian.addAnimation(animData[0], animData[1]);
|
||||||
}
|
}
|
||||||
@@ -407,8 +407,8 @@ function preventDefaultEventAction(event) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncPlayerProperties(player) {
|
function syncPlayerProperties(player) {
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
if (getGame() == VRR_GAME_GTA_III) {
|
||||||
if(doesEntityDataExist(player, "vrr.scale")) {
|
if (doesEntityDataExist(player, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(player, "vrr.scale");
|
let scaleFactor = getEntityData(player, "vrr.scale");
|
||||||
let tempMatrix = player.matrix;
|
let tempMatrix = player.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
@@ -419,8 +419,8 @@ function syncPlayerProperties(player) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
if(doesEntityDataExist(player, "vrr.fightStyle")) {
|
if (doesEntityDataExist(player, "vrr.fightStyle")) {
|
||||||
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
let fightStyle = getEntityData(player, "vrr.fightStyle");
|
||||||
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
player.setFightStyle(fightStyle[0], fightStyle[1]);
|
||||||
}
|
}
|
||||||
@@ -433,80 +433,80 @@ function syncPlayerProperties(player) {
|
|||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
if (doesEntityDataExist(player, "vrr.bodyPartHair")) {
|
||||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
let bodyPartHead = getEntityData(player, "vrr.bodyPartHair");
|
||||||
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
player.changeBodyPart(0, bodyPartHead[0], bodyPartHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
if (doesEntityDataExist(player, "vrr.bodyPartHead")) {
|
||||||
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
let bodyPartHead = getEntityData(player, "vrr.bodyPartHead");
|
||||||
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
player.changeBodyPart(1, bodyPartHead[0], bodyPartHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
if (doesEntityDataExist(player, "vrr.bodyPartUpper")) {
|
||||||
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
let bodyPartUpper = getEntityData(player, "vrr.bodyPartUpper");
|
||||||
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
player.changeBodyPart(1, bodyPartUpper[0], bodyPartUpper[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
if (doesEntityDataExist(player, "vrr.bodyPartLower")) {
|
||||||
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
let bodyPartLower = getEntityData(player, "vrr.bodyPartLower");
|
||||||
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
player.changeBodyPart(1, bodyPartLower[0], bodyPartLower[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropHair")) {
|
||||||
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
let bodyPropHair = getEntityData(player, "vrr.bodyPropHair");
|
||||||
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
player.changeBodyProp(0, bodyPropHair[0], bodyPropHair[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropHead")) {
|
||||||
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
let bodyPropHead = getEntityData(player, "vrr.bodyPropHead");
|
||||||
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
player.changeBodyProp(1, bodyPropHead[0], bodyPropHead[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropEyes")) {
|
||||||
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
let bodyPropEyes = getEntityData(player, "vrr.bodyPropEyes");
|
||||||
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
player.changeBodyProp(1, bodyPropEyes[0], bodyPropEyes[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropLeftHand")) {
|
||||||
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
let bodyPropLeftHand = getEntityData(player, "vrr.bodyPropLeftHand");
|
||||||
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
player.changeBodyProp(1, bodyPropLeftHand[0], bodyPropLeftHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropRightHand")) {
|
||||||
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
let bodyPropRightHand = getEntityData(player, "vrr.bodyPropRightHand");
|
||||||
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
player.changeBodyProp(1, bodyPropRightHand[0], bodyPropRightHand[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropLeftWrist")) {
|
||||||
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
let bodyPropLeftWrist = getEntityData(player, "vrr.bodyPropLeftWrist");
|
||||||
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
player.changeBodyProp(1, bodyPropLeftWrist[0], bodyPropLeftWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropRightWrist")) {
|
||||||
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
let bodyPropRightWrist = getEntityData(player, "vrr.bodyPropRightWrist");
|
||||||
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
player.changeBodyProp(1, bodyPropRightWrist[0], bodyPropRightWrist[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropHip")) {
|
||||||
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
let bodyPropHip = getEntityData(player, "vrr.bodyPropHip");
|
||||||
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
player.changeBodyProp(1, bodyPropHip[0], bodyPropHip[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropLeftFoot")) {
|
||||||
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
let bodyPropLeftFoot = getEntityData(player, "vrr.bodyPropLeftFoot");
|
||||||
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
player.changeBodyProp(1, bodyPropLeftFoot[0], bodyPropLeftFoot[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
if (doesEntityDataExist(player, "vrr.bodyPropRightFoot")) {
|
||||||
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
let bodyPropRightFoot = getEntityData(player, "vrr.bodyPropRightFoot");
|
||||||
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
player.changeBodyProp(1, bodyPropRightFoot[0], bodyPropRightFoot[1]);
|
||||||
}
|
}
|
||||||
@@ -516,8 +516,8 @@ function syncPlayerProperties(player) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncObjectProperties(object) {
|
function syncObjectProperties(object) {
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
if(doesEntityDataExist(object, "vrr.scale")) {
|
if (doesEntityDataExist(object, "vrr.scale")) {
|
||||||
let scaleFactor = getEntityData(object, "vrr.scale");
|
let scaleFactor = getEntityData(object, "vrr.scale");
|
||||||
let tempMatrix = object.matrix;
|
let tempMatrix = object.matrix;
|
||||||
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
tempMatrix.setScale(toVector3(scaleFactor.x, scaleFactor.y, scaleFactor.z));
|
||||||
@@ -568,13 +568,13 @@ function getPlayerId(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function syncElementProperties(element) {
|
function syncElementProperties(element) {
|
||||||
if(doesEntityDataExist(element, "vrr.interior")) {
|
if (doesEntityDataExist(element, "vrr.interior")) {
|
||||||
if(typeof element.interior != "undefined") {
|
if (typeof element.interior != "undefined") {
|
||||||
element.interior = getEntityData(element, "vrr.interior");
|
element.interior = getEntityData(element, "vrr.interior");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(element.type) {
|
switch (element.type) {
|
||||||
case ELEMENT_VEHICLE:
|
case ELEMENT_VEHICLE:
|
||||||
syncVehicleProperties(element);
|
syncVehicleProperties(element);
|
||||||
break;
|
break;
|
||||||
@@ -619,23 +619,23 @@ function getScreenHeight() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function openAllGarages() {
|
function openAllGarages() {
|
||||||
switch(getGame()) {
|
switch (getGame()) {
|
||||||
case VRR_GAME_GTA_III:
|
case VRR_GAME_GTA_III:
|
||||||
for(let i=0;i<=26;i++) {
|
for (let i = 0; i <= 26; i++) {
|
||||||
openGarage(i);
|
openGarage(i);
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_GAME_GTA_VC:
|
case VRR_GAME_GTA_VC:
|
||||||
for(let i=0;i<=32;i++) {
|
for (let i = 0; i <= 32; i++) {
|
||||||
openGarage(i);
|
openGarage(i);
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_GAME_GTA_SA:
|
case VRR_GAME_GTA_SA:
|
||||||
for(let i=0;i<=44;i++) {
|
for (let i = 0; i <= 44; i++) {
|
||||||
openGarage(i);
|
openGarage(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -648,23 +648,23 @@ function openAllGarages() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function closeAllGarages() {
|
function closeAllGarages() {
|
||||||
switch(getGame()) {
|
switch (getGame()) {
|
||||||
case VRR_GAME_GTA_III:
|
case VRR_GAME_GTA_III:
|
||||||
for(let i=0;i<=26;i++) {
|
for (let i = 0; i <= 26; i++) {
|
||||||
closeGarage(i);
|
closeGarage(i);
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_GAME_GTA_VC:
|
case VRR_GAME_GTA_VC:
|
||||||
for(let i=0;i<=32;i++) {
|
for (let i = 0; i <= 32; i++) {
|
||||||
closeGarage(i);
|
closeGarage(i);
|
||||||
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
game.NO_SPECIAL_CAMERA_FOR_THIS_GARAGE(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_GAME_GTA_SA:
|
case VRR_GAME_GTA_SA:
|
||||||
for(let i=0;i<=44;i++) {
|
for (let i = 0; i <= 44; i++) {
|
||||||
closeGarage(i);
|
closeGarage(i);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -683,7 +683,7 @@ function setPedInvincible(ped, state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setPedLookAt(ped, position) {
|
function setPedLookAt(ped, position) {
|
||||||
if(getGame() == VRR_GAME_GTA_SA) {
|
if (getGame() == VRR_GAME_GTA_SA) {
|
||||||
ped.lookAt(position, 10000);
|
ped.lookAt(position, 10000);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
@@ -697,4 +697,10 @@ function setElementHeading(elementId, heading) {
|
|||||||
getElementFromId(elementId).heading = heading;
|
getElementFromId(elementId).heading = heading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function deleteLocalPlayerPed() {
|
||||||
|
destroyElement(localPlayer);
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -41,7 +41,7 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
addNetworkEventHandler("vrr.fadeCamera", fadeLocalCamera);
|
||||||
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
addNetworkEventHandler("vrr.removeFromVehicle", removeLocalPlayerFromVehicle);
|
||||||
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
addNetworkEventHandler("vrr.clearWeapons", clearLocalPlayerWeapons);
|
||||||
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
addNetworkEventHandler("vrr.giveWeapon", giveLocalPlayerWeapon);
|
||||||
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
addNetworkEventHandler("vrr.position", setLocalPlayerPosition);
|
||||||
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
addNetworkEventHandler("vrr.heading", setLocalPlayerHeading);
|
||||||
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
addNetworkEventHandler("vrr.interior", setLocalPlayerInterior);
|
||||||
@@ -59,6 +59,7 @@ function addAllNetworkHandlers() {
|
|||||||
addNetworkEventHandler("vrr.spawn", serverRequestedLocalPlayerSpawn);
|
addNetworkEventHandler("vrr.spawn", serverRequestedLocalPlayerSpawn);
|
||||||
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
addNetworkEventHandler("vrr.clearPedState", clearLocalPedState);
|
||||||
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
addNetworkEventHandler("vrr.drunkEffect", setLocalPlayerDrunkEffect);
|
||||||
|
addNetworkEventHandler("vrr.deleteLocalPlayerPed", deleteLocalPlayerPed);
|
||||||
|
|
||||||
// Vehicle
|
// Vehicle
|
||||||
addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
|
addNetworkEventHandler("vrr.vehicle", receiveVehicleFromServer);
|
||||||
@@ -166,7 +167,7 @@ function sendResourceStartedSignalToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function sendResourceStoppedSignalToServer() {
|
function sendResourceStoppedSignalToServer() {
|
||||||
if(isConnected) {
|
if (isConnected) {
|
||||||
sendNetworkEventToServer("vrr.clientStopped");
|
sendNetworkEventToServer("vrr.clientStopped");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -177,14 +178,14 @@ function set2DRendering(hudState, labelState, smallGameMessageState, scoreboardS
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Updating render states (HUD: ${hudState}, Labels: ${labelState}, Bottom Text: ${smallGameMessageState}, Scoreboard: ${scoreboardState}, HotBar: ${hotBarState}, Item Action Delay: ${itemActionDelayState})`);
|
||||||
renderHUD = hudState;
|
renderHUD = hudState;
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.displayCash(hudState);
|
natives.displayCash(hudState);
|
||||||
natives.displayAmmo(hudState);
|
natives.displayAmmo(hudState);
|
||||||
natives.displayHud(hudState);
|
natives.displayHud(hudState);
|
||||||
natives.displayRadar(hudState);
|
natives.displayRadar(hudState);
|
||||||
natives.displayAreaName(hudState);
|
natives.displayAreaName(hudState);
|
||||||
} else {
|
} else {
|
||||||
if(typeof setHUDEnabled != "undefined") {
|
if (typeof setHUDEnabled != "undefined") {
|
||||||
setHUDEnabled(hudState);
|
setHUDEnabled(hudState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -202,8 +203,8 @@ function onServerSpawnedLocalPlayer(state) {
|
|||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
logToConsole(LOG_DEBUG, `[VRR.Main] Setting spawned state to ${state}`);
|
||||||
isSpawned = state;
|
isSpawned = state;
|
||||||
setUpInitialGame();
|
setUpInitialGame();
|
||||||
if(state) {
|
if (state) {
|
||||||
setTimeout(function() {
|
setTimeout(function () {
|
||||||
calledDeathEvent = false;
|
calledDeathEvent = false;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
@@ -243,7 +244,7 @@ function tellServerItemActionDelayComplete() {
|
|||||||
|
|
||||||
function sendServerClientInfo() {
|
function sendServerClientInfo() {
|
||||||
let clientVersion = "0.0.0.0";
|
let clientVersion = "0.0.0.0";
|
||||||
if(typeof CLIENT_VERSION_MAJOR != "undefined") {
|
if (typeof CLIENT_VERSION_MAJOR != "undefined") {
|
||||||
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
clientVersion = `${CLIENT_VERSION_MAJOR}.${CLIENT_VERSION_MINOR}.${CLIENT_VERSION_PATCH}.${CLIENT_VERSION_BUILD}`;
|
||||||
}
|
}
|
||||||
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
sendNetworkEventToServer("vrr.clientInfo", clientVersion, game.width, game.height);
|
||||||
@@ -282,7 +283,7 @@ function updateInteriorLightsState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function forceSyncElementProperties(elementId) {
|
function forceSyncElementProperties(elementId) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if (getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,7 +293,7 @@ function forceSyncElementProperties(elementId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setElementCollisionsEnabled(elementId, state) {
|
function setElementCollisionsEnabled(elementId, state) {
|
||||||
if(getElementFromId(elementId) == null) {
|
if (getElementFromId(elementId) == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,7 +303,7 @@ function setElementCollisionsEnabled(elementId, state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerArmour(armour) {
|
function setLocalPlayerArmour(armour) {
|
||||||
if(typeof localPlayer.armour != "undefined") {
|
if (typeof localPlayer.armour != "undefined") {
|
||||||
localPlayer.armour = armour;
|
localPlayer.armour = armour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -322,8 +323,8 @@ function setLogLevel(level) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerInfiniteRun(state) {
|
function setLocalPlayerInfiniteRun(state) {
|
||||||
if(localPlayer != null) {
|
if (localPlayer != null) {
|
||||||
if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
game.SET_PLAYER_NEVER_GETS_TIRED(game.GET_PLAYER_ID(), boolToInt(state));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -333,7 +334,7 @@ function setLocalPlayerInfiniteRun(state) {
|
|||||||
|
|
||||||
function setLocalPlayerSkin(skinId) {
|
function setLocalPlayerSkin(skinId) {
|
||||||
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
logToConsole(LOG_INFO, `[VRR.Server] Setting locale player skin to ${skinId}`);
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
natives.changePlayerModel(natives.getPlayerId(), skinId);
|
||||||
} else {
|
} else {
|
||||||
localPlayer.skin = skinId;
|
localPlayer.skin = skinId;
|
||||||
@@ -343,7 +344,7 @@ function setLocalPlayerSkin(skinId) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makePedHoldObject(pedId, modelIndex) {
|
function makePedHoldObject(pedId, modelIndex) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
natives.givePedAmbientObject(natives.getPedFromNetworkId(pedId), getGameConfig().objects[getGame()][modelIndex][1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -357,11 +358,11 @@ function sendLocalPlayerNetworkIdToServer() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setCutsceneInterior(cutsceneName) {
|
function setCutsceneInterior(cutsceneName) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
if(cutsceneName == "") {
|
if (cutsceneName == "") {
|
||||||
natives.clearCutscene();
|
natives.clearCutscene();
|
||||||
} else {
|
} else {
|
||||||
if(natives.isInteriorScene()) {
|
if (natives.isInteriorScene()) {
|
||||||
natives.clearCutscene();
|
natives.clearCutscene();
|
||||||
}
|
}
|
||||||
natives.initCutscene(cutsceneName);
|
natives.initCutscene(cutsceneName);
|
||||||
@@ -372,16 +373,16 @@ function setCutsceneInterior(cutsceneName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function makeLocalPlayerPedSpeak(speechName) {
|
function makeLocalPlayerPedSpeak(speechName) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
// if player is in vehicle, allow megaphone (if last arg is "1", it will cancel megaphone echo)
|
||||||
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
// Only speeches with _MEGAPHONE will have the bullhorn effect
|
||||||
// Afaik it only works on police voices anyway
|
// Afaik it only works on police voices anyway
|
||||||
if(localPlayer.vehicle != null) {
|
if (localPlayer.vehicle != null) {
|
||||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 0);
|
||||||
} else {
|
} else {
|
||||||
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
natives.sayAmbientSpeech(localPlayer, speechName, true, false, 1);
|
||||||
}
|
}
|
||||||
} else if(getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
} else if (getGame() == VRR_GAME_GTA_III || getGame() == VRR_GAME_GTA_VC) {
|
||||||
// Don't have a way to get the ped ref ID and can't use ped in arg
|
// Don't have a way to get the ped ref ID and can't use ped in arg
|
||||||
//game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int);
|
//game.SET_CHAR_SAY(game.GET_PLAYER_ID(), int);
|
||||||
}
|
}
|
||||||
@@ -390,7 +391,7 @@ function makeLocalPlayerPedSpeak(speechName) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocalPlayerAsCopState(state) {
|
function setLocalPlayerAsCopState(state) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.setPlayerAsCop(natives.getPlayerId(), state);
|
natives.setPlayerAsCop(natives.getPlayerId(), state);
|
||||||
natives.setPoliceIgnorePlayer(natives.getPlayerId(), state);
|
natives.setPoliceIgnorePlayer(natives.getPlayerId(), state);
|
||||||
}
|
}
|
||||||
@@ -399,7 +400,7 @@ function setLocalPlayerAsCopState(state) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function serverRequestedLocalPlayerSpawn(skinId, position) {
|
function serverRequestedLocalPlayerSpawn(skinId, position) {
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
if (getGame() == VRR_GAME_GTA_IV) {
|
||||||
natives.createPlayer(skinId, position);
|
natives.createPlayer(skinId, position);
|
||||||
//if(isCustomCameraSupported()) {
|
//if(isCustomCameraSupported()) {
|
||||||
// game.restoreCamera(true);
|
// game.restoreCamera(true);
|
||||||
|
|||||||
@@ -16,23 +16,23 @@ function initChatScript() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function processPlayerChat(client, messageText) {
|
function processPlayerChat(client, messageText) {
|
||||||
if(!isConsole(client)) {
|
if (!isConsole(client)) {
|
||||||
if(!getPlayerData(client)) {
|
if (!getPlayerData(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerLoggedIn(client)) {
|
if (!isPlayerLoggedIn(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isPlayerSpawned(client)) {
|
if (!isPlayerSpawned(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
messagePlayerError(client, getLocaleString(client, "MustBeLoggedInAndSpawnedToChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -61,7 +61,7 @@ function processPlayerChat(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function meActionCommand(command, params, client) {
|
function meActionCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -73,12 +73,12 @@ function meActionCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function doActionCommand(command, params, client) {
|
function doActionCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -90,12 +90,12 @@ function doActionCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function shoutCommand(command, params, client) {
|
function shoutCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -107,17 +107,17 @@ function shoutCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function megaphoneChatCommand(command, params, client) {
|
function megaphoneChatCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!canPlayerUseMegaphone(client)) {
|
if (!canPlayerUseMegaphone(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "CantUseMegaphone"));
|
messagePlayerError(client, getLocaleString(client, "CantUseMegaphone"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -129,12 +129,12 @@ function megaphoneChatCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function talkCommand(command, params, client) {
|
function talkCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -146,12 +146,12 @@ function talkCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function whisperCommand(command, params, client) {
|
function whisperCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -163,12 +163,12 @@ function whisperCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function adminChatCommand(command, params, client) {
|
function adminChatCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -179,12 +179,12 @@ function adminChatCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clanChatCommand(command, params, client) {
|
function clanChatCommand(command, params, client) {
|
||||||
if(isPlayerMuted(client)) {
|
if (isPlayerMuted(client)) {
|
||||||
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
messagePlayerError(client, getLocaleString(client, "MutedCantChat"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -196,9 +196,9 @@ function clanChatCommand(command, params, client) {
|
|||||||
|
|
||||||
function talkToNearbyPlayers(client, messageText) {
|
function talkToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerTalk(clients[i], client, messageText);
|
messagePlayerTalk(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -209,9 +209,9 @@ function talkToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function phoneOutgoingToNearbyPlayers(client, messageText) {
|
function phoneOutgoingToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().talkDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to phone): {MAINCOLOUR}${messageText}`);
|
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(to phone): {MAINCOLOUR}${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,9 +222,9 @@ function phoneOutgoingToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function phoneIncomingToNearbyPlayers(client, messageText) {
|
function phoneIncomingToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().phoneSpeakerDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().phoneSpeakerDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(from phone): {MAINCOLOUR}${messageText}`);
|
messagePlayerNormal(`[#CCCCCC]${getCharacterFullName(client)} {ALTCOLOUR}(from phone): {MAINCOLOUR}${messageText}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -235,9 +235,9 @@ function phoneIncomingToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function whisperToNearbyPlayers(client, messageText) {
|
function whisperToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().whisperDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().whisperDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerWhisper(clients[i], client, messageText);
|
messagePlayerWhisper(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -248,9 +248,9 @@ function whisperToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function shoutToNearbyPlayers(client, messageText) {
|
function shoutToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().shoutDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().shoutDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerShout(clients[i], client, messageText);
|
messagePlayerShout(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -261,9 +261,9 @@ function shoutToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function megaPhoneToNearbyPlayers(client, messageText) {
|
function megaPhoneToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().megaphoneDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().megaphoneDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerMegaPhone(clients[i], client, messageText);
|
messagePlayerMegaPhone(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -274,35 +274,37 @@ function megaPhoneToNearbyPlayers(client, messageText) {
|
|||||||
|
|
||||||
function doActionToNearbyPlayers(client, messageText) {
|
function doActionToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().doActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().doActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerDoAction(clients[i], client, messageText);
|
messagePlayerDoAction(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
messageDiscordChatChannel(`🙋 *${messageText} (${getCharacterFullName(client)})*`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function meActionToNearbyPlayers(client, messageText) {
|
function meActionToNearbyPlayers(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().meActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || (getDistance(getPlayerPosition(client), getPlayerPosition(clients[i])) <= getGlobalConfig().meActionDistance && getPlayerDimension(client) == getPlayerDimension(clients[i]))) {
|
||||||
messagePlayerMeAction(clients[i], client, messageText);
|
messagePlayerMeAction(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
messageDiscordChatChannel(`🙋 *${getCharacterFullName(client)} ${messageText}*`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function clanChat(client, messageText) {
|
function clanChat(client, messageText) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(isPlayerSpawned(clients[i])) {
|
if (isPlayerSpawned(clients[i])) {
|
||||||
if(hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || arePlayersInSameClan(client, clients[i])) {
|
if (hasBitFlag(getPlayerData(clients[i]).accountData.flags.moderation, getModerationFlagValue("CanHearEverything")) || arePlayersInSameClan(client, clients[i])) {
|
||||||
messagePlayerClanChat(clients[i], client, messageText);
|
messagePlayerClanChat(clients[i], client, messageText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -312,14 +314,14 @@ function clanChat(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function canPlayerUseMegaphone(client) {
|
function canPlayerUseMegaphone(client) {
|
||||||
if(getPlayerFirstItemSlotByUseType(client, VRR_ITEM_USETYPE_MEGAPHONE) != -1) {
|
if (getPlayerFirstItemSlotByUseType(client, VRR_ITEM_USETYPE_MEGAPHONE) != -1) {
|
||||||
if(isPlayerActiveItemEnabled(client)) {
|
if (isPlayerActiveItemEnabled(client)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getPlayerVehicle(client)) {
|
if (getPlayerVehicle(client)) {
|
||||||
if(doesVehicleHaveMegaphone(getPlayerVehicle(client))) {
|
if (doesVehicleHaveMegaphone(getPlayerVehicle(client))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,6 +216,7 @@ let globalConfig = {
|
|||||||
passwordRequiredSymbols: 0,
|
passwordRequiredSymbols: 0,
|
||||||
minChatLines: 1,
|
minChatLines: 1,
|
||||||
maxChatLines: 6,
|
maxChatLines: 6,
|
||||||
|
vehicleTrunkDistance: 2.0,
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|||||||
@@ -172,12 +172,12 @@ function onPedEnteringVehicle(event, ped, vehicle, seat) {
|
|||||||
if (getVehicleData(vehicle).locked) {
|
if (getVehicleData(vehicle).locked) {
|
||||||
if (doesPlayerHaveVehicleKeys(client, vehicle)) {
|
if (doesPlayerHaveVehicleKeys(client, vehicle)) {
|
||||||
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
if (!doesPlayerHaveKeyBindsDisabled(client) && doesPlayerHaveKeyBindForCommand(client, "lock")) {
|
||||||
messagePlayerTip(client, `🔒 This ${getVehicleName(vehicle)} is locked. Press {ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))} {MAINCOLOUR}to unlock it.`);
|
messagePlayerTip(client, getLocaleString(client, "VehicleLockedCommandTip", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${toUpperCase(getKeyNameFromId(getPlayerKeyBindForCommand(client, "lock").key))}{MAINCOLOUR}`));
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked. Use /lock to unlock it`);
|
messagePlayerTip(client, getLocaleString(client, "VehicleLockedCommandTip", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}/lock{MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `🔒 This ${getVehicleName(vehicle)} is locked and you don't have the keys to unlock it`);
|
messagePlayerNormal(client, messagePlayerTip(client, getLocaleString(client, "VehicleLockedCantUnlock", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`)));
|
||||||
}
|
}
|
||||||
|
|
||||||
//getPlayerData(client).enteringVehicle = null;
|
//getPlayerData(client).enteringVehicle = null;
|
||||||
@@ -287,38 +287,38 @@ async function onPlayerEnteredVehicle(client, clientVehicle, seat) {
|
|||||||
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "VehicleForRent", getVehicleName(vehicle), `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}{MAINCOLOUR}`, `{ALTCOLOUR}/vehrent{MAINCOLOUR}`));
|
||||||
resetVehiclePosition(vehicle);
|
resetVehiclePosition(vehicle);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerAlert(client, `You are renting this ${getVehicleName(vehicle)} for {ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)} per minute. {MAINCOLOUR}Use {ALTCOLOUR}/stoprent {MAINCOLOUR}if you want to stop renting it.`);
|
messagePlayerAlert(client, getLocaleString(client, "CurrentlyRentingThisVehicle", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}$${makeLargeNumberReadable(getVehicleData(vehicle).rentPrice)}`, `{ALTCOLOUR}/stoprent{MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let ownerName = "Nobody";
|
let ownerName = "Nobody";
|
||||||
let ownerType = "None";
|
let ownerType = getLocaleString(client, "NotOwned");
|
||||||
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
ownerType = toLowerCase(getVehicleOwnerTypeText(getVehicleData(vehicle).ownerType));
|
||||||
switch (getVehicleData(vehicle).ownerType) {
|
switch (getVehicleData(vehicle).ownerType) {
|
||||||
case VRR_VEHOWNER_CLAN:
|
case VRR_VEHOWNER_CLAN:
|
||||||
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
ownerName = getClanData(getClanIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||||
ownerType = "clan";
|
ownerType = getLocaleString(client, "Clan");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_JOB:
|
case VRR_VEHOWNER_JOB:
|
||||||
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
ownerName = getJobData(getJobIdFromDatabaseId(getVehicleData(vehicle).ownerId)).name;
|
||||||
ownerType = "job";
|
ownerType = getLocaleString(client, "Job");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_PLAYER:
|
case VRR_VEHOWNER_PLAYER:
|
||||||
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
let subAccountData = loadSubAccountFromId(getVehicleData(vehicle).ownerId);
|
||||||
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
ownerName = `${subAccountData.firstName} ${subAccountData.lastName}`;
|
||||||
ownerType = "player";
|
ownerType = getLocaleString(client, "Player");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_VEHOWNER_BIZ:
|
case VRR_VEHOWNER_BIZ:
|
||||||
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
ownerName = getBusinessData(getVehicleData(vehicle).ownerId).name;
|
||||||
ownerType = "business";
|
ownerType = getLocaleString(client, "Business");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
messagePlayerAlert(client, `This ${getVehicleName(vehicle)} belongs to {ALTCOLOUR}${ownerName} (${ownerType})`);
|
messagePlayerAlert(client, getLocaleString(client, "VehicleBelongsTo", `{vehiclePurple}${getVehicleName(vehicle)}{MAINCOLOUR}`, `{ALTCOLOUR}${ownerName}{MAINCOLOUR}`, `{ALTCOLOUR}${ownerType}{MAINCOLOUR}`));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getVehicleData(vehicle).engine) {
|
if (!getVehicleData(vehicle).engine) {
|
||||||
@@ -513,12 +513,6 @@ async function onPlayerSpawn(client) {
|
|||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] ${getPlayerDisplayForConsole(client)}'s player data is valid. Continuing spawn processing ...`);
|
||||||
|
|
||||||
if (getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped body parts and props`);
|
|
||||||
setEntityData(getPlayerPed(client), "vrr.bodyParts", getPlayerCurrentSubAccount(client).bodyParts, true);
|
|
||||||
setEntityData(getPlayerPed(client), "vrr.bodyProps", getPlayerCurrentSubAccount(client).bodyProps, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
logToConsole(LOG_DEBUG, `[VRR.Event] Setting ${getPlayerDisplayForConsole(client)}'s ped scale (${getPlayerCurrentSubAccount(client).pedScale})`);
|
||||||
setEntityData(getPlayerPed(client), "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
setEntityData(getPlayerPed(client), "vrr.scale", getPlayerCurrentSubAccount(client).pedScale, true);
|
||||||
|
|
||||||
@@ -527,7 +521,7 @@ async function onPlayerSpawn(client) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isCustomCameraSupported()) {
|
if (isCustomCameraSupported() && getGame() != VRR_GAME_GTA_IV && getGame() != VRR_GAME_GTA_IV_EFLC) {
|
||||||
restorePlayerCamera(client);
|
restorePlayerCamera(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -48,14 +48,12 @@ let randomTips = [
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function helpCommand(command, params, client) {
|
function helpCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
showMainHelpMessage(client);
|
showMainHelpMessage(client);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let splitParams = params.split(" ");
|
switch (toLowerCase(getParam(params, " ", 1))) {
|
||||||
|
|
||||||
switch(toLowerCase(getParam(params, " ", 1))) {
|
|
||||||
case "account":
|
case "account":
|
||||||
showAccountHelpMessage(client);
|
showAccountHelpMessage(client);
|
||||||
break;
|
break;
|
||||||
@@ -328,7 +326,7 @@ function showRadioHelpMessage(client) {
|
|||||||
|
|
||||||
function showWealthAndTaxHelpMessage(client) {
|
function showWealthAndTaxHelpMessage(client) {
|
||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderWealthandTaxHelp")));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 0, `{ALTCOLOUR}${100*getGlobalConfig().economy.incomeTaxRate}%{MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 0, `{ALTCOLOUR}${100 * getGlobalConfig().economy.incomeTaxRate}%{MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 1));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 1));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 2, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}{MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 2, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerVehicle}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerHouse}{MAINCOLOUR}`, `{ALTCOLOUR}${getGlobalConfig().economy.upKeepCosts.upKeepPerBusiness}{MAINCOLOUR}`));
|
||||||
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 3, `{ALTCOLOUR}/wealth{MAINCOLOUR}`, `{ALTCOLOUR}/tax{MAINCOLOUR}`));
|
messagePlayerHelpContent(client, getGroupedLocaleString(client, "WealthAndTaxHelp", 3, `{ALTCOLOUR}/wealth{MAINCOLOUR}`, `{ALTCOLOUR}/tax{MAINCOLOUR}`));
|
||||||
@@ -337,7 +335,7 @@ function showWealthAndTaxHelpMessage(client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showCommandHelpMessage(client, commandName) {
|
function showCommandHelpMessage(client, commandName) {
|
||||||
if(!commandName) {
|
if (!commandName) {
|
||||||
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
messagePlayerSyntax(client, `${getCommandSyntaxText("help")}command <command name>`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -345,7 +343,7 @@ function showCommandHelpMessage(client, commandName) {
|
|||||||
commandName = toLowerCase(commandName);
|
commandName = toLowerCase(commandName);
|
||||||
commandName = commandName.trim();
|
commandName = commandName.trim();
|
||||||
|
|
||||||
if(commandName.slice(0, 1) == "/") {
|
if (commandName.slice(0, 1) == "/") {
|
||||||
commandName = commandName.slice(1);
|
commandName = commandName.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,7 +353,7 @@ function showCommandHelpMessage(client, commandName) {
|
|||||||
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
messagePlayerInfo(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderCommandInfo", commandName)));
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.helpDescription}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Description: ${command.helpDescription}`);
|
||||||
|
|
||||||
if(aliases.length > 0) {
|
if (aliases.length > 0) {
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: ${aliases.join(", ")}`);
|
||||||
} else {
|
} else {
|
||||||
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
messagePlayerNormal(client, `{clanOrange}• {MAINCOLOUR}Aliases: (None)`);
|
||||||
@@ -394,7 +392,7 @@ function helpGetCarCommand(command, params, client) {
|
|||||||
* @return {bool} Whether or not the command was successful
|
* @return {bool} Whether or not the command was successful
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function helpGetSkinCommand(command, params, client) {
|
function helpGetSkinCommand(command, params, client) {
|
||||||
messagePlayerAlert(client, getLocaleString(client, "SkinCommandHelp", `{ALTCOLOUR}/info skin{MAINCOLOUR}`));
|
messagePlayerAlert(client, getLocaleString(client, "SkinCommandHelp", `{ALTCOLOUR}/info skin{MAINCOLOUR}`));
|
||||||
messagePlayerAlert(client, ``);
|
messagePlayerAlert(client, ``);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -328,8 +328,6 @@ function createGroundItemObject(itemId) {
|
|||||||
//setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
//setEntityData(getItemData(itemId).object, "vrr.scale", getItemTypeData(getItemData(itemId).itemTypeIndex).dropScale, true);
|
||||||
addToWorld(getItemData(itemId).object);
|
addToWorld(getItemData(itemId).object);
|
||||||
}
|
}
|
||||||
|
|
||||||
getServerData().groundItemCache.push(itemId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -519,26 +517,26 @@ function pickupItemCommand(command, params, client) {
|
|||||||
|
|
||||||
if (!getItemData(itemId)) {
|
if (!getItemData(itemId)) {
|
||||||
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
||||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item data for item ${itemId} on ground returned false.`);
|
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item data for item ${itemId} on ground returned false.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) {
|
if (!getItemTypeData(getItemData(itemId).itemTypeIndex)) {
|
||||||
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
//messagePlayerError(client, `The item you're trying to pick up is bugged. A bug report has been sent to the server developers.`);
|
||||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} on ground returned false.`);
|
submitBugReport(client, `(AUTOMATED REPORT) Pickup Item: Getting item type ${getItemData(itemId).itemType} data for item ${itemId}/${getItemData(itemId).databaseId} on ground returned false.`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getDistance(getPlayerPosition(client), getItemData(itemId).position) > getGlobalConfig().droppedItemPickupRange) {
|
if (getDistance(getPlayerPosition(client), getItemData(itemId).position) > getGlobalConfig().droppedItemPickupRange) {
|
||||||
messagePlayerError(client, getPlayerLocale(client, "NoItemCloseEnough"));
|
messagePlayerError(client, getLocaleString(client, "NoItemCloseEnough"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
let firstSlot = getPlayerFirstEmptyHotBarSlot(client);
|
||||||
if (firstSlot == -1) {
|
if (firstSlot == -1) {
|
||||||
messagePlayerError(client, getPlayerLocale(client, "NoSpaceSelfInventory"));
|
messagePlayerError(client, getLocaleString(client, "NoSpaceSelfInventory"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -682,8 +680,8 @@ function putItemCommand(command, params, client) {
|
|||||||
forcePlayerPlayAnimation(client, getItemTypeData(getItemData(itemId).itemTypeIndex).putAnimationIndex, 0.0);
|
forcePlayerPlayAnimation(client, getItemTypeData(getItemData(itemId).itemTypeIndex).putAnimationIndex, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
getPlayerData(client).itemActionItem = hotBarSlot;
|
|
||||||
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PUT;
|
getPlayerData(client).itemActionState = VRR_ITEM_ACTION_PUT;
|
||||||
|
getPlayerData(client).itemActionItem = hotBarSlot;
|
||||||
showPlayerItemPutDelay(client, hotBarSlot);
|
showPlayerItemPutDelay(client, hotBarSlot);
|
||||||
|
|
||||||
//clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
//clearPlayerItemActionStateAfterDelay(client, getGlobalConfig().itemActionStateReset);
|
||||||
@@ -1013,7 +1011,7 @@ function playerUseItem(client, hotBarSlot) {
|
|||||||
case VRR_ITEM_USETYPE_FOOD: {
|
case VRR_ITEM_USETYPE_FOOD: {
|
||||||
meActionToNearbyPlayers(client, `eats some of their ${itemTypeData.name}`);
|
meActionToNearbyPlayers(client, `eats some of their ${itemTypeData.name}`);
|
||||||
givePlayerHealth(client, itemTypeData.useValue);
|
givePlayerHealth(client, itemTypeData.useValue);
|
||||||
itemData.value = itemData.value - tempItemTypeData.useValue;
|
itemData.value = itemData.value - itemTypeData.useValue;
|
||||||
if (getItemData(itemIndex).value <= 0) {
|
if (getItemData(itemIndex).value <= 0) {
|
||||||
deleteItem(itemIndex);
|
deleteItem(itemIndex);
|
||||||
switchPlayerActiveHotBarSlot(client, -1);
|
switchPlayerActiveHotBarSlot(client, -1);
|
||||||
@@ -1338,10 +1336,12 @@ function playerDropItem(client, hotBarSlot) {
|
|||||||
|
|
||||||
getItemData(itemId).ownerType = VRR_ITEM_OWNER_GROUND;
|
getItemData(itemId).ownerType = VRR_ITEM_OWNER_GROUND;
|
||||||
getItemData(itemId).ownerId = 0;
|
getItemData(itemId).ownerId = 0;
|
||||||
getItemData(itemId).position = getPlayerPosition(client);
|
getItemData(itemId).position = getPosInFrontOfPos(getPlayerPosition(client), getPlayerHeading(client), getItemTypeData(getItemData(itemId).itemTypeIndex).dropFrontDistance);
|
||||||
getItemData(itemId).dimension = getPlayerDimension(client);
|
getItemData(itemId).dimension = getPlayerDimension(client);
|
||||||
|
//getItemData(itemId).interior = getPlayerInterior(client);
|
||||||
createGroundItemObject(itemId);
|
createGroundItemObject(itemId);
|
||||||
getItemData(itemId).needsSaved = true;
|
getItemData(itemId).needsSaved = true;
|
||||||
|
getServerData().groundItemCache.push(itemId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1352,9 +1352,12 @@ function playerPutItem(client, hotBarSlot) {
|
|||||||
|
|
||||||
let bestNewOwner = getBestNewOwnerToPutItem(client);
|
let bestNewOwner = getBestNewOwnerToPutItem(client);
|
||||||
|
|
||||||
|
if (bestNewOwner[0] == VRR_ITEM_OWNER_NONE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
getItemData(itemId).ownerType = bestNewOwner[0];
|
getItemData(itemId).ownerType = bestNewOwner[0];
|
||||||
getItemData(itemId).ownerId = bestNewOwner[1];
|
getItemData(itemId).position = toVector3(0.0, 0.0, 0.0);
|
||||||
getItemData(itemId).position = toVector(0.0, 0.0, 0.0);
|
|
||||||
getItemData(itemId).dimension = 0;
|
getItemData(itemId).dimension = 0;
|
||||||
getItemData(itemId).needsSaved = true;
|
getItemData(itemId).needsSaved = true;
|
||||||
|
|
||||||
@@ -1366,19 +1369,33 @@ function playerPutItem(client, hotBarSlot) {
|
|||||||
|
|
||||||
switch (bestNewOwner[0]) {
|
switch (bestNewOwner[0]) {
|
||||||
case VRR_ITEM_OWNER_HOUSE:
|
case VRR_ITEM_OWNER_HOUSE:
|
||||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the house`);
|
getItemData(itemId).ownerId = getHouseData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the house`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_BIZFLOOR:
|
case VRR_ITEM_OWNER_BIZFLOOR:
|
||||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} for sale in the business`);
|
getItemData(itemId).ownerId = getBusinessData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} for sale in the business`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_BIZSTORAGE:
|
case VRR_ITEM_OWNER_BIZSTORAGE:
|
||||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the business storage room`);
|
getItemData(itemId).ownerId = getBusinessData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the business storage room`);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VRR_ITEM_OWNER_VEHTRUNK:
|
case VRR_ITEM_OWNER_VEHTRUNK:
|
||||||
meActionToNearbyPlayers(client, `places ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s trunk`);
|
getItemData(itemId).ownerId = getVehicleData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s trunk`);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_ITEM_OWNER_VEHDASH:
|
||||||
|
getItemData(itemId).ownerId = getVehicleData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getVehicleName(getVehicleFromDatabaseId(bestNewOwner[1]))}'s dash compartment`);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case VRR_ITEM_OWNER_ITEM:
|
||||||
|
getItemData(itemId).ownerId = getItemData(bestNewOwner[1]).databaseId;
|
||||||
|
meActionToNearbyPlayers(client, `puts ${getProperDeterminerForName(getItemName(itemId))} ${getItemName(itemId)} in the ${getItemName(bestNewOwner[1])}`);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1587,15 +1604,19 @@ function playerSwitchHotBarSlotCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getClosestItemOnGround(position) {
|
function getClosestItemOnGround(position) {
|
||||||
let items = getServerData().groundItemCache;
|
let groundItems = getServerData().groundItemCache;
|
||||||
let closest = 0;
|
if (groundItems.length != 0) {
|
||||||
for (let i in items) {
|
let closest = 0;
|
||||||
if (getDistance(getItemData(items[i]).position, position) <= getDistance(getItemData(items[closest]).position, position)) {
|
for (let i in groundItems) {
|
||||||
closest = i;
|
if (getDistance(getItemData(groundItems[i]).position, position) <= getDistance(getItemData(groundItems[closest]).position, position)) {
|
||||||
|
closest = i;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return groundItems[closest];
|
||||||
}
|
}
|
||||||
|
|
||||||
return items[closest];
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -1768,22 +1789,34 @@ function deleteItem(itemId, whoDeleted = -1) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getBestNewOwnerToPutItem(client) {
|
function getBestNewOwnerToPutItem(client) {
|
||||||
let closestDistance = 100.0;
|
|
||||||
let position = getPlayerPosition(client);
|
let position = getPlayerPosition(client);
|
||||||
|
|
||||||
let possibleHouse = getPlayerHouse(client);
|
let possibleHouse = getPlayerHouse(client);
|
||||||
if (getHouseData(possibleHouse)) {
|
if (possibleHouse != -1) {
|
||||||
return [VRR_ITEM_OWNER_HOUSE, possibleHouse];
|
if (getHouseData(possibleHouse) != false) {
|
||||||
|
return [VRR_ITEM_OWNER_HOUSE, possibleHouse];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let possibleBusiness = getPlayerBusiness(client);
|
let possibleBusiness = getPlayerBusiness(client);
|
||||||
if (getBusinessData(possibleBusiness)) {
|
if (possibleBusiness != -1) {
|
||||||
return [VRR_ITEM_OWNER_BIZSTORAGE, possibleBusiness];
|
if (getBusinessData(possibleBusiness) != false) {
|
||||||
|
return [VRR_ITEM_OWNER_BIZSTORAGE, possibleBusiness];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let possibleVehicle = getClosestVehicle(position);
|
let possibleVehicle = getClosestVehicle(position);
|
||||||
if (getDistance(getVehicleTrunkPosition(possibleVehicle), position) <= closestDistance) {
|
if (possibleVehicle != false) {
|
||||||
return [VRR_ITEM_OWNER_VEHTRUNK, possibleVehicle];
|
if (getVehicleData(possibleVehicle) != false && getDistance(getVehicleTrunkPosition(possibleVehicle), position) <= getGlobalConfig().vehicleTrunkDistance) {
|
||||||
|
return [VRR_ITEM_OWNER_VEHTRUNK, possibleVehicle];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let possibleItem = getClosestItemOnGround(position);
|
||||||
|
if (possibleItem != -1) {
|
||||||
|
if (getDistance(getItemPosition(possibleItem), position) <= getGlobalConfig().itemContainerDistance) {
|
||||||
|
return [VRR_ITEM_OWNER_ITEM, possibleItem];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return [VRR_ITEM_OWNER_NONE, 0];
|
return [VRR_ITEM_OWNER_NONE, 0];
|
||||||
@@ -2036,6 +2069,8 @@ function saveItemToDatabase(itemId) {
|
|||||||
|
|
||||||
logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item '${itemData.index}' to database ...`);
|
logToConsole(LOG_VERBOSE, `[VRR.Item]: Saving item '${itemData.index}' to database ...`);
|
||||||
|
|
||||||
|
let position = getItemPosition(itemId);
|
||||||
|
|
||||||
let dbConnection = connectToDatabase();
|
let dbConnection = connectToDatabase();
|
||||||
if (dbConnection) {
|
if (dbConnection) {
|
||||||
let data = [
|
let data = [
|
||||||
@@ -2044,9 +2079,9 @@ function saveItemToDatabase(itemId) {
|
|||||||
["item_owner_type", itemData.ownerType],
|
["item_owner_type", itemData.ownerType],
|
||||||
["item_owner_id", itemData.ownerId],
|
["item_owner_id", itemData.ownerId],
|
||||||
["item_amount", itemData.amount],
|
["item_amount", itemData.amount],
|
||||||
["item_pos_x", itemData.position.x],
|
["item_pos_x", position.x],
|
||||||
["item_pos_y", itemData.position.y],
|
["item_pos_y", position.y],
|
||||||
["item_pos_z", itemData.position.z],
|
["item_pos_z", position.z],
|
||||||
["item_int", itemData.interior],
|
["item_int", itemData.interior],
|
||||||
["item_vw", itemData.dimension],
|
["item_vw", itemData.dimension],
|
||||||
["item_buy_price", itemData.buyPrice],
|
["item_buy_price", itemData.buyPrice],
|
||||||
@@ -2115,6 +2150,7 @@ function saveItemTypeToDatabase(itemTypeId) {
|
|||||||
["item_type_drop_rot_x", itemTypeData.dropRotation.x],
|
["item_type_drop_rot_x", itemTypeData.dropRotation.x],
|
||||||
["item_type_drop_rot_y", itemTypeData.dropRotation.y],
|
["item_type_drop_rot_y", itemTypeData.dropRotation.y],
|
||||||
["item_type_drop_rot_z", itemTypeData.dropRotation.z],
|
["item_type_drop_rot_z", itemTypeData.dropRotation.z],
|
||||||
|
["item_type_drop_front_distance", itemTypeData.dropFrontDistance],
|
||||||
["item_type_drop_scale_x", itemTypeData.dropScale.x],
|
["item_type_drop_scale_x", itemTypeData.dropScale.x],
|
||||||
["item_type_drop_scale_y", itemTypeData.dropScale.y],
|
["item_type_drop_scale_y", itemTypeData.dropScale.y],
|
||||||
["item_type_drop_scale_z", itemTypeData.dropScale.z],
|
["item_type_drop_scale_z", itemTypeData.dropScale.z],
|
||||||
@@ -2577,7 +2613,7 @@ function showItemInventoryToPlayer(client, itemId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderItemItemsList")));
|
messagePlayerNormal(client, makeChatBoxSectionHeader(getLocaleString(client, "HeaderItemItemList", getItemName(itemId))));
|
||||||
|
|
||||||
let chunkedList = splitArrayIntoChunks(itemDisplay, 5);
|
let chunkedList = splitArrayIntoChunks(itemDisplay, 5);
|
||||||
for (let i in chunkedList) {
|
for (let i in chunkedList) {
|
||||||
@@ -2724,4 +2760,15 @@ function getPlayerFirstAmmoItemForWeapon(client, weaponId) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function getItemPosition(itemId) {
|
||||||
|
if (getItemData(itemId).ownerType == VRR_ITEM_OWNER_GROUND) {
|
||||||
|
if (getItemData(itemId).object != null) {
|
||||||
|
return getElementPosition(getItemData(itemId).object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getItemData(itemId).position;
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -16,14 +16,14 @@ function initLocaleScript() {
|
|||||||
|
|
||||||
function getLocaleString(client, stringName, ...args) {
|
function getLocaleString(client, stringName, ...args) {
|
||||||
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
let tempString = getRawLocaleString(stringName, getPlayerData(client).locale);
|
||||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 1; i <= args.length; i++) {
|
for (let i = 1; i <= args.length; i++) {
|
||||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
@@ -33,13 +33,13 @@ function getLocaleString(client, stringName, ...args) {
|
|||||||
|
|
||||||
function getLanguageLocaleString(localeId, stringName, ...args) {
|
function getLanguageLocaleString(localeId, stringName, ...args) {
|
||||||
let tempString = getRawLocaleString(stringName, localeId);
|
let tempString = getRawLocaleString(stringName, localeId);
|
||||||
if(tempString == "" || tempString == null || typeof tempString == "undefined") {
|
if (tempString == "" || tempString == null || typeof tempString == "undefined") {
|
||||||
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
logToConsole(LOG_WARN, `[VRR.Locale] Locale string missing for ${stringName} on language ${getLocaleData(getPlayerData(client).locale).englishName}`);
|
||||||
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
submitBugReport(client, `(AUTOMATED REPORT) Locale string "${stringName}" is missing for "${getPlayerLocaleName(client)}"`);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i = 1; i <= args.length; i++) {
|
for (let i = 1; i <= args.length; i++) {
|
||||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
@@ -50,8 +50,8 @@ function getLanguageLocaleString(localeId, stringName, ...args) {
|
|||||||
function getGroupedLocaleString(client, stringName, index, ...args) {
|
function getGroupedLocaleString(client, stringName, index, ...args) {
|
||||||
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
let tempString = getRawGroupedLocaleString(stringName, getPlayerData(client).locale, index);
|
||||||
|
|
||||||
for(let i = 1; i <= args.length; i++) {
|
for (let i = 1; i <= args.length; i++) {
|
||||||
tempString = tempString.replace(`{${i}}`, args[i-1]);
|
tempString = tempString.replace(`{${i}}`, args[i - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempString;
|
return tempString;
|
||||||
@@ -100,7 +100,7 @@ function loadAllLocaleStrings() {
|
|||||||
let tempLocaleStrings = {};
|
let tempLocaleStrings = {};
|
||||||
|
|
||||||
let locales = getGlobalConfig().locale.locales;
|
let locales = getGlobalConfig().locale.locales;
|
||||||
for(let i in locales) {
|
for (let i in locales) {
|
||||||
let localeData = locales[i];
|
let localeData = locales[i];
|
||||||
let localeFile = JSON.parse(loadTextFile(`locale/${localeData.stringsFile}`));
|
let localeFile = JSON.parse(loadTextFile(`locale/${localeData.stringsFile}`));
|
||||||
tempLocaleStrings[i] = localeFile;
|
tempLocaleStrings[i] = localeFile;
|
||||||
@@ -119,13 +119,13 @@ function getLocaleStrings() {
|
|||||||
|
|
||||||
function getLocaleFromParams(params) {
|
function getLocaleFromParams(params) {
|
||||||
let locales = getLocales();
|
let locales = getLocales();
|
||||||
if(isNaN(params)) {
|
if (isNaN(params)) {
|
||||||
for(let i in locales) {
|
for (let i in locales) {
|
||||||
if(toLowerCase(locales[i].isoCode).indexOf(toLowerCase(params)) != -1) {
|
if (toLowerCase(locales[i].isoCode).indexOf(toLowerCase(params)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(toLowerCase(locales[i].englishName).indexOf(toLowerCase(params)) != -1) {
|
if (toLowerCase(locales[i].englishName).indexOf(toLowerCase(params)) != -1) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,11 +143,11 @@ function getLocales() {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function showLocaleListCommand(command, params, client) {
|
function showLocaleListCommand(command, params, client) {
|
||||||
let localeList = getLocales().map(function(x) { return x[0]; });
|
let localeList = getLocales().map(function (x) { return x[0]; });
|
||||||
let chunkedList = splitArrayIntoChunks(localeList, 10);
|
let chunkedList = splitArrayIntoChunks(localeList, 10);
|
||||||
|
|
||||||
messagePlayerInfo(client, getLocaleString(client, "HeaderLocaleList"));
|
messagePlayerInfo(client, getLocaleString(client, "HeaderLocaleList"));
|
||||||
for(let i in chunkedList) {
|
for (let i in chunkedList) {
|
||||||
messagePlayerInfo(client, chunkedList[i].join(", "));
|
messagePlayerInfo(client, chunkedList[i].join(", "));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,14 +155,14 @@ function showLocaleListCommand(command, params, client) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function setLocaleCommand(command, params, client) {
|
function setLocaleCommand(command, params, client) {
|
||||||
if(areParamsEmpty(params)) {
|
if (areParamsEmpty(params)) {
|
||||||
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
messagePlayerSyntax(client, getCommandSyntaxText(command));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let localeId = getLocaleFromParams(params);
|
let localeId = getLocaleFromParams(params);
|
||||||
|
|
||||||
if(!getLocaleData(localeId)) {
|
if (!getLocaleData(localeId)) {
|
||||||
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
messagePlayerInfo(client, getLocaleString(client, "InvalidLocale"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -170,13 +170,14 @@ function setLocaleCommand(command, params, client) {
|
|||||||
getPlayerData(client).accountData.locale = localeId;
|
getPlayerData(client).accountData.locale = localeId;
|
||||||
getPlayerData(client).locale = localeId;
|
getPlayerData(client).locale = localeId;
|
||||||
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1", getLocaleString(client, "LocaleNativeName")));
|
messagePlayerSuccess(client, getLocaleString(client, "LocaleChanged1", getLocaleString(client, "LocaleNativeName")));
|
||||||
sendPlayerLocaleStrings(client);
|
//sendPlayerLocaleStrings(client);
|
||||||
|
sendPlayerLocaleId(client, localeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function getLocaleData(localeId) {
|
function getLocaleData(localeId) {
|
||||||
if(typeof getLocales()[localeId] != "undefined") {
|
if (typeof getLocales()[localeId] != "undefined") {
|
||||||
return getLocales()[localeId];
|
return getLocales()[localeId];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,12 +205,12 @@ function reloadLocaleConfigurationCommand(command, params, client) {
|
|||||||
|
|
||||||
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
async function translateMessage(messageText, translateFrom = getGlobalConfig().locale.defaultLanguageId, translateTo = getGlobalConfig().locale.defaultLanguageId) {
|
||||||
return new Promise(resolve => {
|
return new Promise(resolve => {
|
||||||
if(translateFrom == translateTo) {
|
if (translateFrom == translateTo) {
|
||||||
resolve(messageText);
|
resolve(messageText);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i in cachedTranslations[translateFrom][translateTo]) {
|
for (let i in cachedTranslations[translateFrom][translateTo]) {
|
||||||
if(cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
if (cachedTranslations[translateFrom][translateTo][i][0] == messageText) {
|
||||||
logToConsole(LOG_DEBUG, `[Translate]: Using existing translation for ${getGlobalConfig().locale.locales[translateFrom].englishName} to ${getGlobalConfig().locale.locales[translateTo].englishName} - (${messageText}), (${cachedTranslations[translateFrom][translateTo][i][1]})`);
|
logToConsole(LOG_DEBUG, `[Translate]: Using existing translation for ${getGlobalConfig().locale.locales[translateFrom].englishName} to ${getGlobalConfig().locale.locales[translateTo].englishName} - (${messageText}), (${cachedTranslations[translateFrom][translateTo][i][1]})`);
|
||||||
resolve(cachedTranslations[translateFrom][translateTo][i][1]);
|
resolve(cachedTranslations[translateFrom][translateTo][i][1]);
|
||||||
return true;
|
return true;
|
||||||
@@ -220,13 +221,13 @@ async function translateMessage(messageText, translateFrom = getGlobalConfig().l
|
|||||||
httpGet(
|
httpGet(
|
||||||
thisTranslationURL,
|
thisTranslationURL,
|
||||||
"",
|
"",
|
||||||
function(data) {
|
function (data) {
|
||||||
data = ArrayBufferToString(data);
|
data = ArrayBufferToString(data);
|
||||||
let translationData = JSON.parse(data);
|
let translationData = JSON.parse(data);
|
||||||
cachedTranslations[translateFrom][translateTo].push([messageText, translationData.responseData.translatedText]);
|
cachedTranslations[translateFrom][translateTo].push([messageText, translationData.responseData.translatedText]);
|
||||||
resolve(translationData.responseData.translatedText);
|
resolve(translationData.responseData.translatedText);
|
||||||
},
|
},
|
||||||
function(data) {
|
function (data) {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ function initMessagingScript() {
|
|||||||
|
|
||||||
function announceAdminAction(localeString, ...args) {
|
function announceAdminAction(localeString, ...args) {
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
let argsArray = [clients[i], localeString];
|
let argsArray = [clients[i], localeString];
|
||||||
argsArray = argsArray.concat(args);
|
argsArray = argsArray.concat(args);
|
||||||
let messageText = getLocaleString.apply(null, argsArray);
|
let messageText = getLocaleString.apply(null, argsArray);
|
||||||
@@ -61,8 +61,8 @@ function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
|||||||
//logToConsole(LOG_WARN, `🛡️ ${plainMessage}`);
|
//logToConsole(LOG_WARN, `🛡️ ${plainMessage}`);
|
||||||
|
|
||||||
let clients = getClients();
|
let clients = getClients();
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
if (doesPlayerHaveStaffPermission(clients[i], getStaffFlagValue("BasicModeration"))) {
|
||||||
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
messagePlayerNormal(clients[i], `🛡️ ${messageText}`, colour);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -74,12 +74,12 @@ function messageAdmins(messageText, colour = getColourByName("softRed")) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerError(client, messageText) {
|
function messagePlayerError(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
logToConsole(LOG_INFO, `❌ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `❌ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `❌ ${messageText}`);
|
messageDiscordUser(client, `❌ ${messageText}`);
|
||||||
@@ -89,12 +89,12 @@ function messagePlayerError(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerSyntax(client, messageText) {
|
function messagePlayerSyntax(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
logToConsole(LOG_INFO, `⌨️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
messagePlayerNormal(client, `⌨️ USAGE: {MAINCOLOUR} ${messageText}`, getColourByType("syntaxMessage"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `⌨️ ${messageText}`);
|
messageDiscordUser(client, `⌨️ ${messageText}`);
|
||||||
@@ -104,12 +104,12 @@ function messagePlayerSyntax(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerAlert(client, messageText) {
|
function messagePlayerAlert(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
logToConsole(LOG_INFO, `⚠️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `⚠️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `⚠️ ${messageText}`);
|
messageDiscordUser(client, `⚠️ ${messageText}`);
|
||||||
@@ -119,12 +119,12 @@ function messagePlayerAlert(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerSuccess(client, messageText) {
|
function messagePlayerSuccess(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
logToConsole(LOG_INFO, `✔️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `✔️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `✔️ ${messageText}`);
|
messageDiscordUser(client, `✔️ ${messageText}`);
|
||||||
@@ -134,12 +134,12 @@ function messagePlayerSuccess(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerInfo(client, messageText) {
|
function messagePlayerInfo(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||||
@@ -149,12 +149,12 @@ function messagePlayerInfo(client, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerTip(client, messageText) {
|
function messagePlayerTip(client, messageText) {
|
||||||
if(isConsole(client)) {
|
if (isConsole(client)) {
|
||||||
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
logToConsole(LOG_INFO, `ℹ️ ${messageText}`);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
messagePlayerNormal(client, `ℹ️ ${messageText}`, getColourByName("white"));
|
||||||
} else {
|
} else {
|
||||||
messageDiscordUser(client, `:information_source: ${messageText}`);
|
messageDiscordUser(client, `:information_source: ${messageText}`);
|
||||||
@@ -188,7 +188,7 @@ function messagePlayerShout(client, shoutingClient, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
function messagePlayerDoAction(client, doingActionClient, messageText) {
|
||||||
if(!isClientFromDiscord(client)) {
|
if (!isClientFromDiscord(client)) {
|
||||||
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
messagePlayerNormal(client, `${messageText} * (${getClientSubAccountName(doingActionClient)})`, getColourByType("doActionMessage"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -214,7 +214,7 @@ function messagePlayerAdminChat(client, adminChattingClient, messageText) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerNewbieTip(client, message) {
|
function messagePlayerNewbieTip(client, message) {
|
||||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
if (!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoActionTips"))) {
|
||||||
messagePlayerNormal(client, `💡 ${message}`);
|
messagePlayerNormal(client, `💡 ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -222,8 +222,8 @@ function messagePlayerNewbieTip(client, message) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayerTimedRandomTip(client, message) {
|
function messagePlayerTimedRandomTip(client, message) {
|
||||||
if(isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
if (isPlayerLoggedIn(client) && isPlayerSpawned(client)) {
|
||||||
if(!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
if (!hasBitFlag(getPlayerData(client).accountData.settings, getAccountSettingsFlagValue("NoRandomTips"))) {
|
||||||
messagePlayerNormal(client, `💡 ${message}`);
|
messagePlayerNormal(client, `💡 ${message}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -233,7 +233,7 @@ function messagePlayerTimedRandomTip(client, message) {
|
|||||||
|
|
||||||
function makeChatBoxSectionHeader(name) {
|
function makeChatBoxSectionHeader(name) {
|
||||||
let resultString = `{clanOrange}== {jobYellow}${name} `;
|
let resultString = `{clanOrange}== {jobYellow}${name} `;
|
||||||
let endFiller = fillStringWithCharacter("=", getGlobalConfig().chatSectionHeaderLength-resultString.length);
|
let endFiller = fillStringWithCharacter("=", getGlobalConfig().chatSectionHeaderLength - resultString.length);
|
||||||
return `${resultString} {clanOrange}${endFiller}`;
|
return `${resultString} {clanOrange}${endFiller}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +241,7 @@ function makeChatBoxSectionHeader(name) {
|
|||||||
|
|
||||||
function clearChatBox(client) {
|
function clearChatBox(client) {
|
||||||
//game.messages.clear();
|
//game.messages.clear();
|
||||||
for(let i = 0; i <= 20; i++) {
|
for (let i = 0; i <= 20; i++) {
|
||||||
messageClient(" ", client, COLOUR_WHITE);
|
messageClient(" ", client, COLOUR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -255,8 +255,8 @@ function messagePlayerHelpContent(client, messageString) {
|
|||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
|
|
||||||
function messagePlayersInRace(raceId, message) {
|
function messagePlayersInRace(raceId, message) {
|
||||||
for(let i in clients) {
|
for (let i in clients) {
|
||||||
if(getPlayerRace(clients[i]) == raceId) {
|
if (getPlayerRace(clients[i]) == raceId) {
|
||||||
messagePlayerNormal(clients[i], message);
|
messagePlayerNormal(clients[i], message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1382,4 +1382,15 @@ function createAttachedGameBlip(element, type, size, colour = toColour(255, 255,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===========================================================================
|
||||||
|
|
||||||
|
function deletePlayerPed(client) {
|
||||||
|
if (areServerElementsSupported()) {
|
||||||
|
destroyElement(client.player);
|
||||||
|
} else {
|
||||||
|
sendNetworkEventToPlayer("vrr.deleteLocalPlayerPed", client);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// ===========================================================================
|
// ===========================================================================
|
||||||
@@ -242,7 +242,7 @@ function showRandomTipToAllPlayers() {
|
|||||||
if (isClientInitialized(clients[i])) {
|
if (isClientInitialized(clients[i])) {
|
||||||
if (isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
if (isPlayerLoggedIn(clients[i]) && isPlayerSpawned(clients[i])) {
|
||||||
if (!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
if (!doesPlayerHaveRandomTipsDisabled(clients[i])) {
|
||||||
let localeId = getPlayerLocaleId(clients[i]);
|
let localeId = getPlayerData(clients[i]).locale;
|
||||||
let tipId = getRandom(0, getServerData().localeStrings[localeId]["RandomTips"].length - 1);
|
let tipId = getRandom(0, getServerData().localeStrings[localeId]["RandomTips"].length - 1);
|
||||||
messagePlayerTip(clients[i], getGroupedLocaleString(clients[i], "RandomTips", tipId));
|
messagePlayerTip(clients[i], getGroupedLocaleString(clients[i], "RandomTips", tipId));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4856,7 +4856,6 @@ let gameData = {
|
|||||||
Job: 56,
|
Job: 56,
|
||||||
Bar: 49,
|
Bar: 49,
|
||||||
Club: 48,
|
Club: 48,
|
||||||
RepairGarage: 27,
|
|
||||||
Trophy: 33,
|
Trophy: 33,
|
||||||
Race: 53,
|
Race: 53,
|
||||||
Job: 56,
|
Job: 56,
|
||||||
@@ -5751,7 +5750,8 @@ let gameData = {
|
|||||||
JailCell: [toVector3(328.40, -1093.31, 25.98), 0, false, -1],
|
JailCell: [toVector3(328.40, -1093.31, 25.98), 0, false, -1],
|
||||||
Church: [toVector3(13.87, -1122.43, 26.12), 0, false, -1],
|
Church: [toVector3(13.87, -1122.43, 26.12), 0, false, -1],
|
||||||
Mansion: [toVector3(1461.00, -173.87, 55.78), 0, false, -1],
|
Mansion: [toVector3(1461.00, -173.87, 55.78), 0, false, -1],
|
||||||
Garage: [toVector3(-420.69, 289.86, 62.96), 0, false, -1],
|
SmallGarage: [toVector3(-420.69, 289.86, 62.96), 0, false, -1],
|
||||||
|
JoeyGarage: [toVector3(1189.40, -867.69, 15.18), 0, false, -1],
|
||||||
},
|
},
|
||||||
[VRR_GAME_GTA_VC]: { // GTA VC
|
[VRR_GAME_GTA_VC]: { // GTA VC
|
||||||
Mall: [toVector3(379.62, 1007.00, 19.22), 4, false, -1],
|
Mall: [toVector3(379.62, 1007.00, 19.22), 4, false, -1],
|
||||||
|
|||||||
Reference in New Issue
Block a user