96 lines
No EOL
3.9 KiB
JavaScript
96 lines
No EOL
3.9 KiB
JavaScript
var currentMoney = null;
|
|
var currentwanteds = null;
|
|
var res_X = API.getScreenResolutionMaintainRatio().Width;
|
|
var playingtime = null
|
|
var essen = null;
|
|
var trinken = null;
|
|
var player = API.getLocalPlayer();
|
|
|
|
API.onServerEventTrigger.connect(function (name, args) {
|
|
if (name === "update_wanted_display") {
|
|
currentwanteds = args[0];
|
|
}
|
|
if (name == "update_playingtime_display"){
|
|
playingtime = args[0];
|
|
}
|
|
});
|
|
|
|
var rotation = 0;
|
|
API.onUpdate.connect(function () {
|
|
rotation = 0;
|
|
if (currentMoney != null) {
|
|
API.drawText(currentMoney + "", parseInt(res_X) - 60, 66, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//dollar.png", new Point(parseInt(res_X) - 55, 76), new Size(50, 50), rotation);
|
|
}
|
|
if (essen != null) {
|
|
API.drawText(essen + "%", parseInt(res_X) - 60, 142, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//playingtime.png", new Point(parseInt(res_X) - 55, 152), new Size(50, 50), rotation);
|
|
}
|
|
if (trinken != null) {
|
|
API.drawText(trinken + "%", parseInt(res_X) - 60, 218, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//star.png", new Point(parseInt(res_X) - 55, 232), new Size(50, 50), rotation);
|
|
}
|
|
|
|
|
|
});
|
|
|
|
var drawVehicleHUD = false;
|
|
var drawAnimationHUD = false;
|
|
var Res = API.getScreenResolution();
|
|
var res_X = API.getScreenResolutionMaintainRatio().Width;
|
|
var res_Y = API.getScreenResolutionMaintainRatio().Height;
|
|
|
|
API.onUpdate.connect(function () {
|
|
|
|
|
|
var player = API.getLocalPlayer();
|
|
var inVeh = API.isPlayerInAnyVehicle(player);
|
|
|
|
if (inVeh) {
|
|
var veh = API.getPlayerVehicle(player);
|
|
var vel = API.getEntityVelocity(veh);
|
|
var health = API.getVehicleHealth(veh);
|
|
var maxhealth = API.returnNative("GET_ENTITY_MAX_HEALTH", 0, veh);
|
|
var healthpercent = Math.floor((health / maxhealth) * 100);
|
|
var tank = 0;
|
|
if (API.hasEntitySyncedData(veh, "tank") == true) {
|
|
tank = API.getEntitySyncedData(veh,"tank");
|
|
} else {
|
|
tank = 100;
|
|
}
|
|
var speed = Math.sqrt(
|
|
vel.X * vel.X +
|
|
vel.Y * vel.Y +
|
|
vel.Z * vel.Z
|
|
);
|
|
var displaySpeedMph = Math.round(speed * 2.23693629 * 1.60934);
|
|
API.drawText(`${displaySpeedMph}`, res_X - 20, res_Y - 195, 0.8, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//Kmhanzeige.png", new Point(parseInt(res_X) - 125, res_Y - 190), new Size(50, 50), 0);
|
|
API.dxDrawTexture("images//Motor.png", new Point(parseInt(res_X) - 125, res_Y - 245), new Size(50, 50), 0);
|
|
API.dxDrawTexture("images//Tank.png", new Point(parseInt(res_X) - 125, res_Y - 300), new Size(50, 50), 0);
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 240, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
if (healthpercent < 60) {
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 240, 0.5, 219, 122, 46, 255, 4, 2, false, true, 0);
|
|
}
|
|
if (healthpercent < 30) {
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 240, 0.5, 219, 46, 46, 255, 4, 2, false, true, 0);
|
|
}
|
|
API.drawText(`${tank}%`, res_X - 20, res_Y - 295, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
}
|
|
|
|
|
|
});
|
|
|
|
API.onServerEventTrigger.connect(function (eventName, args) {
|
|
|
|
if (eventName === "update_money_display") {
|
|
currentMoney = Number(args[0]).toFixed(2).replace(/(\d)(?=(\d{3})+\.)/g, '$1,');
|
|
}
|
|
else if (eventName === "animation_text") {
|
|
drawAnimationHUD = !drawAnimationHUD;
|
|
}
|
|
else if(eventName === "update_essentrinken_display"){
|
|
essen = args[0];
|
|
trinken = args[1];
|
|
}
|
|
}); |