Remove scripts that've been moved to new resources
This commit is contained in:
7
meta.xml
7
meta.xml
@@ -24,7 +24,6 @@
|
|||||||
<script src="scripts/server/business.js" type="server" language="javascript" />
|
<script src="scripts/server/business.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/chat.js" type="server" language="javascript" />
|
<script src="scripts/server/chat.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/clan.js" type="server" language="javascript" />
|
<script src="scripts/server/clan.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/client.js" type="server" language="javascript" />
|
|
||||||
<script src="scripts/server/crime.js" type="server" language="javascript" />
|
<script src="scripts/server/crime.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/database.js" type="server" language="javascript" />
|
<script src="scripts/server/database.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/developer.js" type="server" language="javascript" />
|
<script src="scripts/server/developer.js" type="server" language="javascript" />
|
||||||
@@ -47,6 +46,7 @@
|
|||||||
<script src="scripts/server/messaging.js" type="server" language="javascript" />
|
<script src="scripts/server/messaging.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/misc.js" type="server" language="javascript" />
|
<script src="scripts/server/misc.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/npc.js" type="server" language="javascript" />
|
<script src="scripts/server/npc.js" type="server" language="javascript" />
|
||||||
|
<script src="scripts/server/netevents.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/race.js" type="server" language="javascript" />
|
<script src="scripts/server/race.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
<script src="scripts/server/radio.js" type="server" language="javascript" />
|
||||||
<script src="scripts/server/security.js" type="server" language="javascript" />
|
<script src="scripts/server/security.js" type="server" language="javascript" />
|
||||||
@@ -90,16 +90,11 @@
|
|||||||
<script src="scripts/client/item.js" type="client" language="javascript" />
|
<script src="scripts/client/item.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/job.js" type="client" language="javascript" />
|
<script src="scripts/client/job.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
<script src="scripts/client/keybind.js" type="client" language="javascript" />
|
||||||
//<script src="scripts/client/label.js" type="client" language="javascript" />
|
|
||||||
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
<script src="scripts/client/locale.js" type="client" language="javascript" />
|
||||||
<!--<script src="scripts/client/logo.js" type="client" language="javascript" />-->
|
|
||||||
<script src="scripts/client/main.js" type="client" language="javascript" />
|
<script src="scripts/client/main.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/messaging.js" type="client" language="javascript" />
|
<script src="scripts/client/messaging.js" type="client" language="javascript" />
|
||||||
<!--<script src="scripts/client/mousecam.js" type="client" language="javascript" />-->
|
|
||||||
<!--<script src="scripts/client/nametag.js" type="client" language="javascript" />-->
|
|
||||||
<script src="scripts/client/npc.js" type="client" language="javascript" />
|
<script src="scripts/client/npc.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/radio.js" type="client" language="javascript" />
|
<script src="scripts/client/radio.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/scoreboard.js" type="client" language="javascript" />
|
|
||||||
<script src="scripts/client/netevents.js" type="client" language="javascript" />
|
<script src="scripts/client/netevents.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/skin-select.js" type="client" language="javascript" />
|
<script src="scripts/client/skin-select.js" type="client" language="javascript" />
|
||||||
<script src="scripts/client/sync.js" type="client" language="javascript" />
|
<script src="scripts/client/sync.js" type="client" language="javascript" />
|
||||||
|
|||||||
@@ -1,384 +0,0 @@
|
|||||||
// ===========================================================================
|
|
||||||
// Vortrex's Roleplay Resource
|
|
||||||
// https://github.com/VortrexFTW/gtac_roleplay
|
|
||||||
// ===========================================================================
|
|
||||||
// FILE: labels.js
|
|
||||||
// DESC: Provides functionality for world labels (3D labels)
|
|
||||||
// TYPE: Client (JavaScript)
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
let businessLabels = [];
|
|
||||||
let houseLabels = [];
|
|
||||||
let jobLabels = [];
|
|
||||||
|
|
||||||
let propertyLabelNameFont = null;
|
|
||||||
let propertyLabelLockedFont = null;
|
|
||||||
let propertyLabelHeight = 1.0;
|
|
||||||
|
|
||||||
let jobNameLabelFont = null;
|
|
||||||
let jobHelpLabelFont = null;
|
|
||||||
|
|
||||||
let unlockedColour = toColour(50, 205, 50, 255);
|
|
||||||
let lockedColour = toColour(205, 92, 92, 255);
|
|
||||||
let jobHelpColour = toColour(234, 198, 126, 255);
|
|
||||||
|
|
||||||
let renderLabelDistance = 7.5;
|
|
||||||
|
|
||||||
let propertyLabelLockedOffset = 16;
|
|
||||||
let propertyLabelNameOffset = 18;
|
|
||||||
let propertyLabelPriceOffset = 16;
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLabelScript() {
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Label]: Initializing label script ...");
|
|
||||||
propertyLabelNameFont = initLabelPropertyNameFont();
|
|
||||||
propertyLabelLockedFont = initLabelPropertyLockedFont();
|
|
||||||
jobNameLabelFont = initLabelJobNameFont();
|
|
||||||
jobHelpLabelFont = initLabelJobHelpFont();
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Label]: Label script initialized!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLabelPropertyNameFont() {
|
|
||||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLabelPropertyLockedFont() {
|
|
||||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLabelJobNameFont() {
|
|
||||||
return lucasFont.createDefaultFont(16.0, "Roboto", "Regular");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLabelJobHelpFont() {
|
|
||||||
return lucasFont.createDefaultFont(10.0, "Roboto", "Light");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function renderPropertyEntranceLabel(name, position, locked, isBusiness, price, rentPrice, labelInfoType) {
|
|
||||||
if(localPlayer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let tempPosition = position;
|
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
|
||||||
} else {
|
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = "";
|
|
||||||
if(price > "0") {
|
|
||||||
text = getLocaleString("PropertyForSaleLabel", price);
|
|
||||||
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);
|
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
text = "";
|
|
||||||
if(rentPrice != "0") {
|
|
||||||
text = getLocaleString("PropertyForRentLabel", rentPrice);
|
|
||||||
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);
|
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelPriceOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isBusiness) {
|
|
||||||
text = (locked) ? toUpperCase(getLocaleString("Closed")) : toUpperCase(getLocaleString("Open"));
|
|
||||||
} else {
|
|
||||||
text = (locked) ? toUpperCase(getLocaleString("Locked")) : toUpperCase(getLocaleString("Unlocked"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!locked && labelInfoType != VRR_PROPLABEL_INFO_NONE) {
|
|
||||||
let infoText = "";
|
|
||||||
switch(labelInfoType) {
|
|
||||||
case VRR_PROPLABEL_INFO_ENTER: {
|
|
||||||
if(enterPropertyKey) {
|
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
|
||||||
} else {
|
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUY: {
|
|
||||||
infoText = getLocaleString("BusinessBuyItemsLabel", "/buy");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUYBIZ: {
|
|
||||||
infoText = getLocaleString("BuyBusinessLabel", "/bizbuy");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_BUYHOUSE: {
|
|
||||||
infoText = getLocaleString("BuyHouseLabel", "/housebuy");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_RENTHOUSE: {
|
|
||||||
infoText = getLocaleString("RentHouseLabel", "/houserent");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_PROPLABEL_INFO_ENTERVEHICLE: {
|
|
||||||
infoText = getLocaleString("VehicleDealershipLabel");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default: {
|
|
||||||
if(enterPropertyKey) {
|
|
||||||
infoText = getLocaleString("PropertyEnterKeyPressLabel", toUpperCase(getKeyNameFromId(enterPropertyKey)));
|
|
||||||
} else {
|
|
||||||
infoText = getLocaleString("PropertyEnterCommandLabel", "/enter");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(getDistance(localPlayer.position, position) <= renderLabelDistance-2) {
|
|
||||||
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);
|
|
||||||
screenPosition.y -= propertyLabelLockedOffset;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
screenPosition.y -= propertyLabelNameOffset;
|
|
||||||
|
|
||||||
text = name || " ";
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function renderPropertyExitLabel(position) {
|
|
||||||
if(localPlayer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(propertyLabelNameFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(propertyLabelLockedFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let tempPosition = position;
|
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
|
||||||
} else {
|
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = "EXIT";
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function renderJobLabel(name, position, jobType) {
|
|
||||||
if(localPlayer == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(jobNameLabelFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(jobHelpLabelFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
if(!natives.doesViewportExist(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport does not exist!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!natives.isViewportActive(natives.getGameViewportId())) {
|
|
||||||
logToConsole(LOG_INFO, "[VRR.Label]: Game viewport is not active!");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let tempPosition = position;
|
|
||||||
tempPosition.z = tempPosition.z + propertyLabelHeight;
|
|
||||||
let screenPosition = new Vec3(0.0, 0.0, 0.0);
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
screenPosition = natives.getViewportPositionOfCoord(tempPosition, natives.getGameViewportId());
|
|
||||||
} else {
|
|
||||||
screenPosition = getScreenFromWorldPosition(tempPosition);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(screenPosition.x < 0 || screenPosition.x > game.width) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
let text = "";
|
|
||||||
if(jobType == localPlayerJobType) {
|
|
||||||
if(localPlayerWorking) {
|
|
||||||
text = getLocaleString("JobEquipAndUniformLabel", "/equip", "/uniform", "/stopwork");
|
|
||||||
} else {
|
|
||||||
text = getLocaleString("StartWorkLabel", "/startwork");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if(localPlayerJobType == 0) {
|
|
||||||
text = getLocaleString("TakeJobLabel", "/takejob");
|
|
||||||
} else {
|
|
||||||
text = getLocaleString("NotYourJobLabel", "/quitjob");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
|
||||||
|
|
||||||
screenPosition.y -= 18;
|
|
||||||
|
|
||||||
text = getLocaleString("JobLabel", name);
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
|
|
||||||
function processLabelRendering() {
|
|
||||||
if(renderLabels) {
|
|
||||||
if(!areServerElementsSupported()) {
|
|
||||||
if(localPlayer != null) {
|
|
||||||
getServerData().businesses.forEach((business) => {
|
|
||||||
if(getDistance(localPlayer.position, business.entrancePosition) <= 75.0) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
getServerData().houses.forEach((house) => {
|
|
||||||
if(getDistance(localPlayer.position, house.entrancePosition) <= 75.0) {
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
getServerData().jobs.forEach((job) => {
|
|
||||||
if(getDistance(localPlayer.position, job.position) <= 75.0) {
|
|
||||||
natives.drawColouredCylinder(getPosBelowPos(job.position, 1.0), 0.0, 0.0, 255, 255, 0, 255);
|
|
||||||
//renderJobLabel(job.name, job.position, job.jobType);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(areWorldLabelsSupported()) {
|
|
||||||
if(localPlayer != null) {
|
|
||||||
let pickups = getElementsByType(ELEMENT_PICKUP);
|
|
||||||
for(let i in pickups) {
|
|
||||||
if(pickups[i].getData("vrr.label.type") != null) {
|
|
||||||
if(getDistance(localPlayer.position, pickups[i].position) <= renderLabelDistance) {
|
|
||||||
if(!pickups[i].isOnScreen) {
|
|
||||||
let price = "0";
|
|
||||||
let rentPrice = "0";
|
|
||||||
let labelInfoType = VRR_PROPLABEL_INFO_NONE;
|
|
||||||
if(pickups[i].getData("vrr.label.price") != null) {
|
|
||||||
price = makeLargeNumberReadable(pickups[i].getData("vrr.label.price"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.rentprice") != null) {
|
|
||||||
rentPrice = makeLargeNumberReadable(pickups[i].getData("vrr.label.rentprice"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pickups[i].getData("vrr.label.help") != null) {
|
|
||||||
labelInfoType = pickups[i].getData("vrr.label.help");
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(pickups[i].getData("vrr.label.type")) {
|
|
||||||
case VRR_LABEL_BUSINESS: {
|
|
||||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), true, price, rentPrice, labelInfoType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_LABEL_HOUSE: {
|
|
||||||
renderPropertyEntranceLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.locked"), false, price, rentPrice, labelInfoType);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_LABEL_JOB: {
|
|
||||||
renderJobLabel(pickups[i].getData("vrr.label.name"), pickups[i].position, pickups[i].getData("vrr.label.jobType"));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case VRR_LABEL_EXIT: {
|
|
||||||
renderPropertyExitLabel(pickups[i].position);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
// ===========================================================================
|
|
||||||
// Vortrex's Roleplay Resource
|
|
||||||
// https://github.com/VortrexFTW/gtac_roleplay
|
|
||||||
// ===========================================================================
|
|
||||||
// FILE: logo.js
|
|
||||||
// DESC: Provides logo rendering functions
|
|
||||||
// TYPE: Client (JavaScript)
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
let logoImage = null;
|
|
||||||
let logoPos = toVector2(game.width-132, game.height-132);
|
|
||||||
let logoSize = toVector2(128, 128);
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initLogoScript() {
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Initializing logo script ...");
|
|
||||||
//logoImage = loadLogoImage();
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.Logo]: Logo script initialized!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function loadLogoImage() {
|
|
||||||
let logoStream = openFile(mainLogoPath);
|
|
||||||
let tempLogoImage = null;
|
|
||||||
if(logoStream != null) {
|
|
||||||
tempLogoImage = graphics.loadPNG(logoStream);
|
|
||||||
logoStream.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
return tempLogoImage;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function processLogoRendering() {
|
|
||||||
if(renderLogo) {
|
|
||||||
if(logoImage != null) {
|
|
||||||
graphics.drawRectangle(logoImage, logoPos, logoSize);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function setServerLogoRenderState(state) {
|
|
||||||
logToConsole(LOG_DEBUG, `[VRR.Main] Server logo ${(state) ? "enabled" : "disabled"}`);
|
|
||||||
renderLogo = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -1,579 +0,0 @@
|
|||||||
|
|
||||||
// ===========================================================================
|
|
||||||
// Asshat-Gaming Roleplay
|
|
||||||
// https://github.com/VortrexFTW/gtac_asshat_rp
|
|
||||||
// Copyright (c) 2020 Asshat-Gaming (https://asshatgaming.com)
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// FILE: mouse-camera.js
|
|
||||||
// DESC: Provides a freelook camera similar to SA for III and VC
|
|
||||||
// TYPE: Client (JavaScript)
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
// CREDITS TO LUCASC190 FOR MAKING THE MOUSE CAMERA
|
|
||||||
// WALKING CODE ADDED BY VORTREX
|
|
||||||
|
|
||||||
function SetStandardControlsEnabled(bEnabled) {
|
|
||||||
if (typeof gta == "undefined") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (game.standardControls === undefined) {
|
|
||||||
logToConsole(LOG_WARN, "game.standardControls not implemented");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
game.standardControls = bEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetCurrentPlayerIndex() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetPlayerPed(uiIndex) {
|
|
||||||
if (uiIndex >= 1)
|
|
||||||
throw new Error("player index out of range");
|
|
||||||
return localPlayer;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetPedVehicle(pPed) {
|
|
||||||
return pPed.vehicle;
|
|
||||||
}
|
|
||||||
|
|
||||||
let ENTITYTYPE_BUILDING = 1;
|
|
||||||
let ENTITYTYPE_VEHICLE = 2;
|
|
||||||
let ENTITYTYPE_PED = 3;
|
|
||||||
let ENTITYTYPE_OBJECT = 4;
|
|
||||||
let ENTITYTYPE_DUMMY = 5;
|
|
||||||
|
|
||||||
function GetEntityType(Entity) {
|
|
||||||
if (Entity.isType(ELEMENT_BUILDING))
|
|
||||||
return ENTITYTYPE_BUILDING;
|
|
||||||
if (Entity.isType(ELEMENT_VEHICLE))
|
|
||||||
return ENTITYTYPE_VEHICLE;
|
|
||||||
if (Entity.isType(ELEMENT_PED))
|
|
||||||
return ENTITYTYPE_PED;
|
|
||||||
if (Entity.isType(ELEMENT_OBJECT))
|
|
||||||
return ENTITYTYPE_OBJECT;
|
|
||||||
//if (Entity.isType(ELEMENT_DUMMY))
|
|
||||||
// return ENTITYTYPE_DUMMY;
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetPlaceableMatrix(pPlaceable) {
|
|
||||||
if (pPlaceable == GetCamera())
|
|
||||||
return game.cameraMatrix;
|
|
||||||
return pPlaceable.matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetEntityModel(pEntity) {
|
|
||||||
return pEntity;
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetModelBoundingSphere(usModel) {
|
|
||||||
return [usModel.boundingRadius, usModel.boundingCentre.x, usModel.boundingCentre.y, usModel.boundingCentre.z];
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetMouseSpeed() {
|
|
||||||
if (gui.cursorEnabled)
|
|
||||||
return [0, 0];
|
|
||||||
let MouseSpeed = game.getMouseSpeed();
|
|
||||||
return [MouseSpeed.x, -MouseSpeed.y];
|
|
||||||
}
|
|
||||||
|
|
||||||
function GetMouseSensitivity() {
|
|
||||||
if (game.getMouseSensitivity === undefined) {
|
|
||||||
//logToConsole(LOG_ERROR, "game.getMouseSensitivity not implemented");
|
|
||||||
return [0.0025, 0.003];
|
|
||||||
}
|
|
||||||
let MouseSensitivity = game.getMouseSensitivity();
|
|
||||||
return [MouseSensitivity.x, MouseSensitivity.y];
|
|
||||||
}
|
|
||||||
|
|
||||||
let GetCamera;
|
|
||||||
{
|
|
||||||
const Camera = Symbol();
|
|
||||||
|
|
||||||
GetCamera = function () {
|
|
||||||
return Camera;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function AreEntityCollisionsEnabled(pEntity) {
|
|
||||||
return pEntity.collisionsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
function SetEntityCollisionsEnabled(pEntity, bCollisionsEnabled) {
|
|
||||||
pEntity.collisionsEnabled = bCollisionsEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
function ProcessLineOfSight(vecStartX, vecStartY, vecStartZ, vecEndX, vecEndY, vecEndZ, bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera) {
|
|
||||||
if (game.processLineOfSight === undefined) {
|
|
||||||
logToConsole(LOG_WARN, "game.processLineOfSight not implemented");
|
|
||||||
return [null];
|
|
||||||
}
|
|
||||||
let Result = game.processLineOfSight([vecStartX, vecStartY, vecStartZ], [vecEndX, vecEndY, vecEndZ], bCheckBuildings, bCheckVehicles, bCheckPeds, bCheckObjects, bCheckDummies, bCheckSeeThroughStuff, bIgnoreSomeObjectsForCamera);
|
|
||||||
if (Result == null)
|
|
||||||
return [null];
|
|
||||||
return [Result.position.x, Result.position.y, Result.position.z, Result.normal.x, Result.normal.y, Result.normal.z, Result.entity];
|
|
||||||
}
|
|
||||||
|
|
||||||
function SetPlaceableMatrix(pPlaceable, mat) {
|
|
||||||
if (pPlaceable == GetCamera()) {
|
|
||||||
game.setCameraMatrix(mat);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pPlaceable.matrix = mat;
|
|
||||||
}
|
|
||||||
|
|
||||||
const UpdateCamera = game.updateCamera;
|
|
||||||
|
|
||||||
let GetTickCount;
|
|
||||||
{
|
|
||||||
let FrameCount = 0;
|
|
||||||
|
|
||||||
setInterval(() => {
|
|
||||||
++FrameCount;
|
|
||||||
}, 0);
|
|
||||||
|
|
||||||
let GTAFrameCount = 0;
|
|
||||||
|
|
||||||
addEventHandler("OnProcess", (event, deltaTime) => {
|
|
||||||
++GTAFrameCount;
|
|
||||||
});
|
|
||||||
|
|
||||||
GetTickCount = function (bGTA, bFrames) {
|
|
||||||
if (bFrames)
|
|
||||||
return bGTA ? GTAFrameCount : FrameCount;
|
|
||||||
else
|
|
||||||
return bGTA ? game.tickCount : sdl.ticks;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function easingSinusoidalInOut(t, b, c, d)//TODO: Move this to MathUtil.js
|
|
||||||
{
|
|
||||||
return -c / 2 * (Math.cos((Math.PI) * t / d) - 1) + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: extract
|
|
||||||
|
|
||||||
function applyMultiplierTimeStep(m, t)//TODO: Move this to MathUtil.js
|
|
||||||
{
|
|
||||||
return Math.max(Math.min(1.0 - (1.0 - m) * (t), 1), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: getOffset
|
|
||||||
//TODO: round
|
|
||||||
//TODO: getNumberBetween
|
|
||||||
//TODO: split
|
|
||||||
//TODO: isWhiteSpaceCharacter
|
|
||||||
//TODO: isControlCharacter
|
|
||||||
//TODO: alert
|
|
||||||
//TODO: confirm
|
|
||||||
|
|
||||||
const identityMatrix = new Matrix4x4();
|
|
||||||
if (identityMatrix.setIdentity === undefined) {
|
|
||||||
identityMatrix.m11 = 1;
|
|
||||||
identityMatrix.m12 = 0;
|
|
||||||
identityMatrix.m13 = 0;
|
|
||||||
identityMatrix.m14 = 0;
|
|
||||||
identityMatrix.m21 = 0;
|
|
||||||
identityMatrix.m22 = 1;
|
|
||||||
identityMatrix.m23 = 0;
|
|
||||||
identityMatrix.m24 = 0;
|
|
||||||
identityMatrix.m31 = 0;
|
|
||||||
identityMatrix.m32 = 0;
|
|
||||||
identityMatrix.m33 = 1;
|
|
||||||
identityMatrix.m34 = 0;
|
|
||||||
identityMatrix.m41 = 0;
|
|
||||||
identityMatrix.m42 = 0;
|
|
||||||
identityMatrix.m43 = 0;
|
|
||||||
identityMatrix.m44 = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const cameraIdentityMatrix = new Matrix4x4();
|
|
||||||
cameraIdentityMatrix.m11 = -1;
|
|
||||||
cameraIdentityMatrix.m12 = 0;
|
|
||||||
cameraIdentityMatrix.m13 = 0;
|
|
||||||
cameraIdentityMatrix.m14 = 0;
|
|
||||||
cameraIdentityMatrix.m21 = 0;
|
|
||||||
cameraIdentityMatrix.m22 = 1;
|
|
||||||
cameraIdentityMatrix.m23 = 0;
|
|
||||||
cameraIdentityMatrix.m24 = 0;
|
|
||||||
cameraIdentityMatrix.m31 = 0;
|
|
||||||
cameraIdentityMatrix.m32 = 0;
|
|
||||||
cameraIdentityMatrix.m33 = 1;
|
|
||||||
cameraIdentityMatrix.m34 = 0;
|
|
||||||
cameraIdentityMatrix.m41 = 0;
|
|
||||||
cameraIdentityMatrix.m42 = 0;
|
|
||||||
cameraIdentityMatrix.m43 = 0;
|
|
||||||
cameraIdentityMatrix.m44 = 1;
|
|
||||||
|
|
||||||
function createMultipliedMatrix() {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
matrix.setMultiply.apply(matrix, arguments);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createXRotationMatrix(x) {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
matrix.setRotateX(x);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createYRotationMatrix(x) {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
matrix.setRotateY(x);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createZRotationMatrix(z) {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
matrix.setRotateZ(z);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function createTranslationMatrix(x, y, z) {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
matrix.setTranslate([x, y, z]);
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO: createScaleMatrix
|
|
||||||
|
|
||||||
function getDotProduct(x, y, z, x2, y2, z2) {
|
|
||||||
return x * x2 + y * y2 + z * z2;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCrossProduct(x, y, z, x2, y2, z2) {
|
|
||||||
return [y * z2 - z * y2, z * x2 - x * z2, x * y2 - y * x2];
|
|
||||||
}
|
|
||||||
|
|
||||||
function getLength(x, y, z) {
|
|
||||||
return Math.sqrt(getDotProduct(x, y, z, x, y, z));
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalise(x, y, z) {
|
|
||||||
let length = getLength(x, y, z);
|
|
||||||
if (length == 0)
|
|
||||||
throw new Error("an attempt was made to normalise a three dimensional vector with a length of zero");
|
|
||||||
return [x / length, y / length, z / length];
|
|
||||||
}
|
|
||||||
|
|
||||||
function createLookAtLHMatrix(eyeX, eyeY, eyeZ, atX, atY, atZ, upX, upY, upZ) {
|
|
||||||
let matrix = new Matrix4x4();
|
|
||||||
let [lookX, lookY, lookZ] = normalise(atX - eyeX, atY - eyeY, atZ - eyeZ);
|
|
||||||
let [rightX, rightY, rightZ] = normalise.apply(null, getCrossProduct(upX, upY, upZ, lookX, lookY, lookZ));
|
|
||||||
[upX, upY, upZ] = getCrossProduct(lookX, lookY, lookZ, rightX, rightY, rightZ);
|
|
||||||
matrix.m11 = rightX;
|
|
||||||
matrix.m12 = rightY;
|
|
||||||
matrix.m13 = rightZ;
|
|
||||||
matrix.m14 = 0;
|
|
||||||
|
|
||||||
matrix.m21 = lookX;
|
|
||||||
matrix.m22 = lookY;
|
|
||||||
matrix.m23 = lookZ;
|
|
||||||
matrix.m24 = 0;
|
|
||||||
|
|
||||||
matrix.m31 = upX;
|
|
||||||
matrix.m32 = upY;
|
|
||||||
matrix.m33 = upZ;
|
|
||||||
matrix.m34 = 0;
|
|
||||||
|
|
||||||
matrix.m41 = eyeX;
|
|
||||||
matrix.m42 = eyeY;
|
|
||||||
matrix.m43 = eyeZ;
|
|
||||||
matrix.m44 = 1;
|
|
||||||
|
|
||||||
matrix.m41 = eyeX;
|
|
||||||
matrix.m42 = eyeY;
|
|
||||||
matrix.m43 = eyeZ;
|
|
||||||
matrix.m44 = 1;
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDifferenceBetweenAngles(current, target) {
|
|
||||||
let f = (((target - current) + Math.PI) / (Math.PI * 2));
|
|
||||||
return ((f - Math.floor(f)) * (Math.PI * 2)) - Math.PI;
|
|
||||||
}
|
|
||||||
|
|
||||||
let easeCamera = false;
|
|
||||||
let easeStartTicks;
|
|
||||||
let easeDuration;
|
|
||||||
let easeStartPosX, easeStartPosY, easeStartPosZ;
|
|
||||||
let easeStartLookX, easeStartLookY, easeStartLookZ;
|
|
||||||
let easeStartUpX, easeStartUpY, easeStartUpZ;
|
|
||||||
|
|
||||||
function getCameraPositionInfo(matrix) {
|
|
||||||
return [matrix.m41, matrix.m42, matrix.m43, matrix.m21, matrix.m22, matrix.m23, matrix.m31, matrix.m32, matrix.m33];
|
|
||||||
}
|
|
||||||
|
|
||||||
function startCameraEase() {
|
|
||||||
easeCamera = true;
|
|
||||||
easeStartTicks = GetTickCount(true, false);
|
|
||||||
easeDuration = 1000;
|
|
||||||
let matrix = GetPlaceableMatrix(GetCamera());
|
|
||||||
[easeStartPosX, easeStartPosY, easeStartPosZ, easeStartLookX, easeStartLookY, easeStartLookZ, easeStartUpX, easeStartUpY, easeStartUpZ] = getCameraPositionInfo(matrix);
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyCameraEase(matrix) {
|
|
||||||
if (!easeCamera)
|
|
||||||
return matrix;
|
|
||||||
let ease = (GetTickCount(true, false) - easeStartTicks) / easeDuration;
|
|
||||||
if (ease < 1) {
|
|
||||||
ease = easingSinusoidalInOut(ease, 0, 1, 1);
|
|
||||||
let [newPosX, newPosY, newPosZ, newLookX, newLookY, newLookZ, newUpX, newUpY, newUpZ] = getCameraPositionInfo(matrix);
|
|
||||||
let easePosX = easeStartPosX + (newPosX - easeStartPosX) * ease;
|
|
||||||
let easePosY = easeStartPosY + (newPosY - easeStartPosY) * ease;
|
|
||||||
let easePosZ = easeStartPosZ + (newPosZ - easeStartPosZ) * ease;
|
|
||||||
let easeLookX = easeStartLookX + (newLookX - easeStartLookX) * ease;
|
|
||||||
let easeLookY = easeStartLookY + (newLookY - easeStartLookY) * ease;
|
|
||||||
let easeLookZ = easeStartLookZ + (newLookZ - easeStartLookZ) * ease;
|
|
||||||
let easeUpX = easeStartUpX + (newUpX - easeStartUpX) * ease;
|
|
||||||
let easeUpY = easeStartUpY + (newUpY - easeStartUpY) * ease;
|
|
||||||
let easeUpZ = easeStartUpZ + (newUpZ - easeStartUpZ) * ease;
|
|
||||||
return createLookAtLHMatrix(easePosX, easePosY, easePosZ, easePosX + easeLookX, easePosY + easeLookY, easePosZ + easeLookZ, easeUpX, easeUpY, easeUpZ);
|
|
||||||
}
|
|
||||||
return matrix;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isCameraEasing() {
|
|
||||||
return easeCamera && GetTickCount(true, false) < (easeStartTicks + easeDuration);
|
|
||||||
}
|
|
||||||
|
|
||||||
let oldCameraTarget = null;
|
|
||||||
let OldPosition = null;//2019 Lucas was here!
|
|
||||||
let cameraRotZ;
|
|
||||||
let cameraRotY;
|
|
||||||
|
|
||||||
function getCameraTarget() {
|
|
||||||
let playerPed = GetPlayerPed(GetCurrentPlayerIndex());
|
|
||||||
let vehicle = GetPedVehicle(playerPed);
|
|
||||||
if (vehicle != null)
|
|
||||||
return vehicle;
|
|
||||||
if (playerPed != null) {
|
|
||||||
//if (playerPed.health <= 1)//Breaks because of fade//2019 Lucas was here!
|
|
||||||
// return null;
|
|
||||||
return playerPed;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isRelativeToTarget(target) {
|
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
|
||||||
return false;
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
function isClipped(target) {
|
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED)
|
|
||||||
return true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//2019 Lucas was here!
|
|
||||||
function ShouldReturnToRestRotation(Target) {
|
|
||||||
if (GetEntityType(Target) == ENTITYTYPE_PED)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getCameraRestRotation(target) {
|
|
||||||
let targetMatrix = GetPlaceableMatrix(target);
|
|
||||||
let rotZ;
|
|
||||||
if (isRelativeToTarget(target))
|
|
||||||
rotZ = 0;
|
|
||||||
else
|
|
||||||
rotZ = -Math.atan2(targetMatrix.m21, targetMatrix.m22);
|
|
||||||
let rotY = -0.2;
|
|
||||||
return [rotZ, rotY];
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetCameraRotation() {
|
|
||||||
[cameraRotZ, cameraRotY] = getCameraRestRotation(getCameraTarget());
|
|
||||||
}
|
|
||||||
|
|
||||||
//2019 Lucas was here!
|
|
||||||
let DeltaTime = 0;
|
|
||||||
addEventHandler("OnProcess", (event, deltaTime) => {
|
|
||||||
DeltaTime = deltaTime;
|
|
||||||
if (!localPlayer) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
let IdleTime = 0;//2019 Lucas was here!
|
|
||||||
|
|
||||||
function processReturnToRestRotation() {
|
|
||||||
//resetCameraRotation();//2019 Lucas was here!
|
|
||||||
|
|
||||||
//2019 Lucas was here!
|
|
||||||
let Target = getCameraTarget();
|
|
||||||
if (!ShouldReturnToRestRotation(Target))
|
|
||||||
return;
|
|
||||||
IdleTime += DeltaTime;
|
|
||||||
if (IdleTime > 1.5) {
|
|
||||||
let Velocity = Target.velocity;
|
|
||||||
let Matrix = Target.matrix;
|
|
||||||
let Speed = getDotProduct(Velocity.x, Velocity.y, Velocity.z, Matrix.getElement(1 * 4 + 0), Matrix.getElement(1 * 4 + 1), Matrix.getElement(1 * 4 + 2));
|
|
||||||
let AbsSpeed = Math.abs(Speed);
|
|
||||||
let Multiplier = Math.min(AbsSpeed / 0.75, 1);
|
|
||||||
if (Multiplier != 0) {
|
|
||||||
let [TargetCameraRotZ2, TargetCameraRotY2] = getCameraRestRotation(Target);
|
|
||||||
if (Speed < 0)
|
|
||||||
TargetCameraRotZ2 += Math.PI;
|
|
||||||
let TimeStep = game.timeStep / 50 * 60;
|
|
||||||
cameraRotZ += getDifferenceBetweenAngles(cameraRotZ, TargetCameraRotZ2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
|
|
||||||
cameraRotY += getDifferenceBetweenAngles(cameraRotY, TargetCameraRotY2) * applyMultiplierTimeStep(1 / 20, TimeStep) * Multiplier;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function cancelReturnToRestRotation() {
|
|
||||||
IdleTime = 0;//2019 Lucas was here!
|
|
||||||
}
|
|
||||||
|
|
||||||
let distance;
|
|
||||||
let zIncrease;
|
|
||||||
|
|
||||||
function getCameraOffsetInfo(target) {
|
|
||||||
if (GetEntityType(target) == ENTITYTYPE_PED) {
|
|
||||||
let distance = 4;
|
|
||||||
let zIncrease = 0.8;
|
|
||||||
let offsetX = 0;
|
|
||||||
let offsetY = 0;
|
|
||||||
let offsetZ = 0;
|
|
||||||
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
|
||||||
}
|
|
||||||
let model = GetEntityModel(target);
|
|
||||||
let [radius] = GetModelBoundingSphere(model);
|
|
||||||
let minDistance;
|
|
||||||
let maxDistance;
|
|
||||||
let minZIncrease;
|
|
||||||
let maxZIncrease;
|
|
||||||
let minRadius;
|
|
||||||
let maxRadius;
|
|
||||||
let offsetX;
|
|
||||||
let offsetY;
|
|
||||||
let offsetZ;
|
|
||||||
if (radius <= 3.0535011291504) {
|
|
||||||
minDistance = 4;
|
|
||||||
maxDistance = 8;
|
|
||||||
minZIncrease = 0.5;
|
|
||||||
maxZIncrease = 1;
|
|
||||||
minRadius = 2;
|
|
||||||
maxRadius = 3.0535011291504;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
minDistance = 8;
|
|
||||||
maxDistance = 16;
|
|
||||||
minZIncrease = 1;
|
|
||||||
maxZIncrease = 2;
|
|
||||||
minRadius = 3.05350112915042;
|
|
||||||
maxRadius = 6.3955960273743;
|
|
||||||
}
|
|
||||||
offsetX = 0;
|
|
||||||
offsetY = 0;
|
|
||||||
offsetZ = 0;
|
|
||||||
distance = minDistance + (radius - minRadius) / (maxRadius - minRadius) * (maxDistance - minDistance);
|
|
||||||
zIncrease = minZIncrease + (radius - minRadius) / (maxRadius - minRadius) * (maxZIncrease - minZIncrease);
|
|
||||||
return [distance, zIncrease, offsetX, offsetY, offsetZ];
|
|
||||||
}
|
|
||||||
|
|
||||||
function update() {
|
|
||||||
let target = getCameraTarget();
|
|
||||||
if (target != null) {
|
|
||||||
if (oldCameraTarget != target) {
|
|
||||||
//if (oldCameraTarget != null)//2019 Lucas was here!
|
|
||||||
let Position = target.position;
|
|
||||||
if (OldPosition == null || getLength(Position.x - OldPosition.x, Position.y - OldPosition.y, Position.z - OldPosition.z) < 10)
|
|
||||||
startCameraEase()
|
|
||||||
resetCameraRotation()
|
|
||||||
}
|
|
||||||
let [mouseSpeedX, mouseSpeedY] = GetMouseSpeed();
|
|
||||||
let [mouseSensitivityX, mouseSensitivityY] = GetMouseSensitivity();
|
|
||||||
mouseSpeedX = mouseSpeedX * mouseSensitivityX * 2;
|
|
||||||
mouseSpeedY = mouseSpeedY * mouseSensitivityY * 2;
|
|
||||||
if (mouseSpeedX == 0 && mouseSpeedY == 0) {
|
|
||||||
processReturnToRestRotation();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
cameraRotZ = cameraRotZ - mouseSpeedX;
|
|
||||||
cameraRotY = cameraRotY - mouseSpeedY;
|
|
||||||
cancelReturnToRestRotation();
|
|
||||||
}
|
|
||||||
cameraRotY = Math.max(cameraRotY, -Math.PI / 2 + 0.01);
|
|
||||||
if (GetEntityType(target) != ENTITYTYPE_PED)
|
|
||||||
cameraRotY = Math.min(cameraRotY, Math.PI / 8.5);//2019 Lucas was here!
|
|
||||||
else
|
|
||||||
cameraRotY = Math.min(cameraRotY, Math.PI / 4);
|
|
||||||
let camera = GetCamera();
|
|
||||||
let targetMatrix = GetPlaceableMatrix(target);
|
|
||||||
let [distance, zIncrease, offsetX, offsetY, offsetZ] = getCameraOffsetInfo(target);
|
|
||||||
let offsetTranslationMatrix = createTranslationMatrix(offsetX, offsetY, offsetZ);
|
|
||||||
targetMatrix = createMultipliedMatrix(offsetTranslationMatrix, targetMatrix);
|
|
||||||
let targetPosX, targetPosY, targetPosZ;
|
|
||||||
if (isRelativeToTarget(target))
|
|
||||||
[targetPosX, targetPosY, targetPosZ] = [0, 0, 0];
|
|
||||||
else
|
|
||||||
[targetPosX, targetPosY, targetPosZ] = [targetMatrix.m41, targetMatrix.m42, targetMatrix.m43];
|
|
||||||
let distanceTranslationMatrix = createTranslationMatrix(0, -distance, 0);
|
|
||||||
targetPosZ = targetPosZ + zIncrease;
|
|
||||||
let targetTranslationMatrix = createTranslationMatrix(targetPosX, targetPosY, targetPosZ);
|
|
||||||
let offsetRotationX = createXRotationMatrix(cameraRotY);
|
|
||||||
let offsetRotationZ = createZRotationMatrix(cameraRotZ);
|
|
||||||
let cameraMatrix = createMultipliedMatrix(cameraIdentityMatrix, distanceTranslationMatrix, offsetRotationX, offsetRotationZ, targetTranslationMatrix);
|
|
||||||
if (isRelativeToTarget(target)) {
|
|
||||||
cameraMatrix = createMultipliedMatrix(cameraMatrix, targetMatrix);
|
|
||||||
targetTranslationMatrix = createMultipliedMatrix(targetTranslationMatrix, targetMatrix);
|
|
||||||
}
|
|
||||||
if (isClipped(target)) {
|
|
||||||
let startX = targetTranslationMatrix.m41;
|
|
||||||
let startY = targetTranslationMatrix.m42;
|
|
||||||
let startZ = targetTranslationMatrix.m43;
|
|
||||||
let endX = cameraMatrix.m41;
|
|
||||||
let endY = cameraMatrix.m42;
|
|
||||||
let endZ = cameraMatrix.m43;
|
|
||||||
let checkBuildings = true;
|
|
||||||
let checkVehicles = true;
|
|
||||||
let checkPeds = true;
|
|
||||||
let checkObjects = true;
|
|
||||||
let checkDummies = false;
|
|
||||||
let checkSeeThroughStuff = false;
|
|
||||||
let ignoreSomeObjectsForCamera = true;
|
|
||||||
let collisionsEnabled = AreEntityCollisionsEnabled(target);
|
|
||||||
if (collisionsEnabled)
|
|
||||||
SetEntityCollisionsEnabled(target, false);
|
|
||||||
let [positionX, positionY, positionZ, normalX, normalY, normalZ, targetEntity] = ProcessLineOfSight(startX, startY, startZ, endX, endY, endZ, checkBuildings, checkVehicles, checkPeds, checkObjects, checkDummies, checkSeeThroughStuff, ignoreSomeObjectsForCamera);
|
|
||||||
if (collisionsEnabled)
|
|
||||||
SetEntityCollisionsEnabled(target, true);
|
|
||||||
if (positionX != null) {
|
|
||||||
//2019 Lucas was here!
|
|
||||||
let Distance = 0.3;
|
|
||||||
positionX += normalX * Distance;
|
|
||||||
positionY += normalY * Distance;
|
|
||||||
positionZ += normalZ * Distance;
|
|
||||||
|
|
||||||
cameraMatrix.m41 = positionX;
|
|
||||||
cameraMatrix.m42 = positionY;
|
|
||||||
cameraMatrix.m43 = positionZ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isCameraEasing())
|
|
||||||
cameraMatrix = applyCameraEase(cameraMatrix);
|
|
||||||
SetPlaceableMatrix(camera, cameraMatrix);
|
|
||||||
UpdateCamera(camera);
|
|
||||||
}
|
|
||||||
oldCameraTarget = target;
|
|
||||||
OldPosition = (target != null) ? target.position : null;//2019 Lucas was here!
|
|
||||||
return target != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
addEventHandler("OnCameraProcess", (event) => {
|
|
||||||
if (mouseCameraEnabled) {
|
|
||||||
update();
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function toggleMouseCamera() {
|
|
||||||
mouseCameraEnabled = !mouseCameraEnabled;
|
|
||||||
}
|
|
||||||
@@ -1,243 +0,0 @@
|
|||||||
// ===========================================================================
|
|
||||||
// Vortrex's Roleplay Resource
|
|
||||||
// https://github.com/VortrexFTW/gtac_roleplay
|
|
||||||
// ===========================================================================
|
|
||||||
// FILE: nametags.js
|
|
||||||
// DESC: Provides nametag rendering
|
|
||||||
// TYPE: Client (JavaScript)
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
// Configuration
|
|
||||||
let nametagFont = null;
|
|
||||||
let afkStatusFont = null;
|
|
||||||
let pingFont = null;
|
|
||||||
let nametagDistance = 50.0;
|
|
||||||
let nametagWidth = 70;
|
|
||||||
|
|
||||||
let playerNames = {};
|
|
||||||
let playerColours = {};
|
|
||||||
let playerPaused = {};
|
|
||||||
let playerPing = {};
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initNameTagScript() {
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.NameTag]: Initializing nametag script ...");
|
|
||||||
nametagFont = loadNameTagFont();
|
|
||||||
afkStatusFont = loadPausedStatusFont();
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.NameTag]: Nametag script initialized!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function loadNameTagFont() {
|
|
||||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function loadPausedStatusFont() {
|
|
||||||
return lucasFont.createDefaultFont(18.0, "Roboto", "Light");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function updatePlayerNameTag(clientName, characterName, colour, paused, ping) {
|
|
||||||
playerNames[clientName] = characterName;
|
|
||||||
playerColours[clientName] = colour;
|
|
||||||
playerPaused[clientName] = paused;
|
|
||||||
playerPing[clientName] = ping;
|
|
||||||
|
|
||||||
if(getGame() == VRR_GAME_GTA_IV) {
|
|
||||||
let client = getPlayerFromParams(clientName);
|
|
||||||
if(client != false) {
|
|
||||||
if(getPlayerPed(client) != null) {
|
|
||||||
getPlayerPed(client).setNametag(characterName, colour);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function updatePlayerPing(clientName, ping) {
|
|
||||||
playerPing[clientName] = ping;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function drawNametag(x, y, health, armour, text, ping, alpha, distance, colour, afk, skin) {
|
|
||||||
if(nametagFont == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
alpha *= 0.75;
|
|
||||||
let width = nametagWidth;
|
|
||||||
health = Math.max(0.0, Math.min(1.0, health));
|
|
||||||
armour = Math.max(0.0, Math.min(1.0, armour));
|
|
||||||
|
|
||||||
// Starts at bottom and works it's way up
|
|
||||||
// -------------------------------------------
|
|
||||||
// Health Bar
|
|
||||||
|
|
||||||
if(getMultiplayerMod() == VRR_MPMOD_GTAC) {
|
|
||||||
if(getGame() == VRR_GAME_GTA_III) {
|
|
||||||
// Mickey Hamfists is ridiculously tall. Raise the nametag for him a bit
|
|
||||||
if(skin == 109) {
|
|
||||||
y -= 20;
|
|
||||||
} else {
|
|
||||||
y -= 5;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
y -= 5;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
y -= 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(health > 0.0) {
|
|
||||||
let hx = x-width/2;
|
|
||||||
let hy = y-10/2;
|
|
||||||
let colourB = toColour(0, 0, 0, Math.floor(255.0*alpha)); // Background colour (black)
|
|
||||||
graphics.drawRectangle(null, [hx, hy], [width, 8], colourB, colourB, colourB, colourB);
|
|
||||||
let colour = toColour(Math.floor(255.0-(health*255.0)), Math.floor(health*255.0), 0, Math.floor(255.0*alpha)); // Health bar colour (varies, depending on health)
|
|
||||||
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*health, 10-6], colour, colour, colour, colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Armour Bar
|
|
||||||
if (armour > 0.0)
|
|
||||||
{
|
|
||||||
// Go up 10 pixels to draw the next part
|
|
||||||
y -= 10;
|
|
||||||
let hx = x-width/2;
|
|
||||||
let hy = y-10/2;
|
|
||||||
let colourB = toColour(255, 0, 0, 0); // Background colour (black)
|
|
||||||
graphics.drawRectangle(null, [hx, hy], [width, 8], colourB, colourB, colourB, colourB);
|
|
||||||
let colour = toColour(255, 255, 255, 255); // Armour bar colour (white)
|
|
||||||
graphics.drawRectangle(null, [hx+2, hy+2], [(width-4)*armour, 10-6], colour, colour, colour, colour);
|
|
||||||
}
|
|
||||||
|
|
||||||
y -= 20;
|
|
||||||
|
|
||||||
// Nametag
|
|
||||||
if(nametagFont != null) {
|
|
||||||
let size = nametagFont.measure(text, game.width, 0.0, 0.0, nametagFont.size, false, false);
|
|
||||||
nametagFont.render(text, [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, nametagFont.size, colour, false, false, false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Go up another 10 pixels for the next part
|
|
||||||
y -= 20;
|
|
||||||
|
|
||||||
// AFK Status
|
|
||||||
if(afkStatusFont != null) {
|
|
||||||
if(afk) {
|
|
||||||
let size = afkStatusFont.measure("PAUSED", game.width, 0.0, 0.0, afkStatusFont.size, false, false);
|
|
||||||
afkStatusFont.render("PAUSED", [x-size[0]/2, y-size[1]/2], game.width, 0.0, 0.0, afkStatusFont.size, toColour(255, 0, 0, 255), false, false, false, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function updateNametag(element) {
|
|
||||||
if(!areWorldLabelsSupported()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(localPlayer != null) {
|
|
||||||
let playerPos = localPlayer.position;
|
|
||||||
let elementPos = element.position;
|
|
||||||
|
|
||||||
elementPos[2] += 0.9;
|
|
||||||
|
|
||||||
//if(typeof element.getComponentPosition()) {
|
|
||||||
|
|
||||||
let screenPos = getScreenFromWorldPosition(elementPos);
|
|
||||||
if (screenPos[2] >= 0.0) {
|
|
||||||
let health = element.health/100.0;
|
|
||||||
if(health > 1.0) {
|
|
||||||
health = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let armour = element.armour/100.0;
|
|
||||||
if(armour > 1.0) {
|
|
||||||
armour = 1.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let distance = playerPos.distance(elementPos);
|
|
||||||
if(distance <= nametagDistance) {
|
|
||||||
if(typeof game.processLineOfSight != "undefined") {
|
|
||||||
let losCheck = game.processLineOfSight(playerPos, elementPos, true, false, false, true, true, false, true, true);
|
|
||||||
if(losCheck != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(element.type == ELEMENT_PLAYER) {
|
|
||||||
let name = element.name;
|
|
||||||
let colour = COLOUR_WHITE;
|
|
||||||
let paused = false;
|
|
||||||
let ping = -1;
|
|
||||||
|
|
||||||
if(element.isType(ELEMENT_PLAYER)) {
|
|
||||||
if(typeof playerNames[element.name] != "undefined") {
|
|
||||||
name = playerNames[element.name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerPaused[element.name] != "undefined") {
|
|
||||||
paused = playerPaused[element.name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerColours[element.name] != "undefined") {
|
|
||||||
colour = playerColours[element.name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerPing[element.name] != "undefined") {
|
|
||||||
ping = playerPing[element.name];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
drawNametag(screenPos[0], screenPos[1], health, armour, name, ping, 1.0-distance/nametagDistance, distance, colour, paused, element.skin);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function getClientFromPlayer(player) {
|
|
||||||
getClients().forEach(function(client) {
|
|
||||||
if(getPlayerPed(client) == player) {
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function processNameTagRendering(event) {
|
|
||||||
//if(getGame() >= GAME_GTA_IV) {
|
|
||||||
// return false;
|
|
||||||
//}
|
|
||||||
|
|
||||||
getElementsByType(ELEMENT_PED).forEach(function(ped) {
|
|
||||||
if(ped != localPlayer) {
|
|
||||||
updateNametag(ped);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function createColour(alpha, red, green, blue) {
|
|
||||||
return alpha << 24 | red << 16 | green << 8 | blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function setNameTagDistance(distance) {
|
|
||||||
nametagDistance = distance;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
@@ -1,104 +0,0 @@
|
|||||||
// ===========================================================================
|
|
||||||
// Vortrex's Roleplay Resource
|
|
||||||
// https://github.com/VortrexFTW/gtac_roleplay
|
|
||||||
// ===========================================================================
|
|
||||||
// FILE: scoreboard.js
|
|
||||||
// DESC: Provides scoreboard features and rendering
|
|
||||||
// TYPE: Client (JavaScript)
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
let scoreBoardTitleFont = null;
|
|
||||||
let scoreBoardListFont = null;
|
|
||||||
|
|
||||||
let pausedColour = COLOUR_RED;
|
|
||||||
|
|
||||||
let scoreboardKey = SDLK_TAB;
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initScoreBoardScript() {
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Initializing scoreboard script ...");
|
|
||||||
scoreBoardTitleFont = initScoreBoardTitleFont();
|
|
||||||
scoreBoardListFont = initScoreBoardListFont();
|
|
||||||
logToConsole(LOG_DEBUG, "[VRR.ScoreBoard]: Scoreboard script initialized!");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initScoreBoardTitleFont() {
|
|
||||||
return lucasFont.createDefaultFont(22.0, "Roboto", "Regular");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function initScoreBoardListFont() {
|
|
||||||
return lucasFont.createDefaultFont(12.0, "Roboto", "Light");
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===========================================================================
|
|
||||||
|
|
||||||
function processScoreBoardRendering() {
|
|
||||||
if(isAnyGUIActive()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(renderScoreBoard) {
|
|
||||||
if(isKeyDown(SDLK_TAB)) {
|
|
||||||
if(scoreBoardListFont != null && scoreBoardTitleFont != null) {
|
|
||||||
let scoreboardStart = (game.height/2)-(Math.floor(getClients().length/2)*20);
|
|
||||||
let titleSize = scoreBoardTitleFont.measure("PLAYERS", game.width, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardTitleFont.render("PLAYERS", [game.width/2, scoreboardStart-50], 0, 0.5, 0.0, scoreBoardTitleFont.size, COLOUR_WHITE, false, false, false, true);
|
|
||||||
|
|
||||||
titleSize = scoreBoardTitleFont.measure("____________________________", game.width, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardTitleFont.render("____________________________", [game.width/2, scoreboardStart-35], 0, 0.5, 0.0, scoreBoardTitleFont.size, COLOUR_WHITE, false, false, false, true);
|
|
||||||
|
|
||||||
let clients = getClients();
|
|
||||||
for(let i in clients) {
|
|
||||||
if(!clients[i].console) {
|
|
||||||
let name = clients[i].name;
|
|
||||||
let colour = COLOUR_WHITE;
|
|
||||||
let paused = false;
|
|
||||||
let ping = "-1";
|
|
||||||
|
|
||||||
if(typeof playerNames[clients[i].name] != "undefined") {
|
|
||||||
name = playerNames[clients[i].name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerPaused[clients[i].name] != "undefined") {
|
|
||||||
paused = playerPaused[clients[i].name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerColours[clients[i].name] != "undefined") {
|
|
||||||
colour = playerColours[clients[i].name];
|
|
||||||
}
|
|
||||||
|
|
||||||
if(typeof playerPing[clients[i].name] != "undefined") {
|
|
||||||
ping = toString(playerPing[clients[i].name]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player ID
|
|
||||||
let text = String(clients[i].index);
|
|
||||||
let size = scoreBoardListFont.measure(text, 75, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardListFont.render(text, [game.width/2-100, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, COLOUR_WHITE, false, false, false, true);
|
|
||||||
|
|
||||||
// Player Name
|
|
||||||
text = name;
|
|
||||||
size = scoreBoardListFont.measure(text, 100, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardListFont.render(text, [game.width/2, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, colour, false, false, false, true);
|
|
||||||
|
|
||||||
// Ping
|
|
||||||
text = ping;
|
|
||||||
size = scoreBoardListFont.measure(ping, 75, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardListFont.render(ping, [game.width/2+100, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, COLOUR_WHITE, false, false, false, true);
|
|
||||||
|
|
||||||
// PAUSED Status (depends on resource "afk")
|
|
||||||
if(paused == true) {
|
|
||||||
size = scoreBoardListFont.measure("PAUSED", 100, 0.0, 1.0, 10, false, false);
|
|
||||||
scoreBoardListFont.render("PAUSED", [game.width/2+200, scoreboardStart + (i*20)], 0, 0.5, 0.0, scoreBoardListFont.size, pausedColour, false, false, false, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user