104 lines
No EOL
4.1 KiB
JavaScript
104 lines
No EOL
4.1 KiB
JavaScript
var currentMoney = null;
|
|
var currentwanteds = null;
|
|
var res_X = API.getScreenResolutionMaintainRatio().Width;
|
|
var playingtime = null
|
|
var essen = null;
|
|
var trinken = null;
|
|
|
|
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 () {
|
|
if(rotation <= 359){
|
|
rotation = rotation + 1;
|
|
} else {
|
|
rotation = 0;
|
|
}
|
|
if (currentMoney != null) {
|
|
API.drawText(currentMoney + "", parseInt(res_X) - 60, 70, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//dollar.png", new Point(parseInt(res_X) - 55, 78), new Size(50, 50), rotation);
|
|
}
|
|
if (currentwanteds != null) {
|
|
API.drawText(currentwanteds + "", parseInt(res_X) - 60, 142, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//star.png", new Point(parseInt(res_X) - 55, 152), new Size(50, 50), rotation);
|
|
}
|
|
if (playingtime != null) {
|
|
API.drawText(playingtime + "", parseInt(res_X) - 60, 218, 1, 115, 186, 131, 255, 4, 2, false, true, 0);
|
|
API.dxDrawTexture("images//playingtime.png", new Point(parseInt(res_X) - 55, 232), new Size(50, 50), rotation);
|
|
}
|
|
if(essen != null && trinken != null){
|
|
|
|
API.drawRectangle(38, 850, 250, 15, 0, 0, 0, 150);
|
|
API.drawRectangle(40, 852, 1.25 * essen, 10, 10, 120, 10, 180);
|
|
API.drawRectangle(165, 852, 1.20 * trinken, 10, 10, 10, 120, 180);
|
|
|
|
}
|
|
});
|
|
|
|
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 - 60, res_Y - 200, 1, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
API.drawText(`kmh`, res_X - 20, res_Y - 180, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
API.drawText(`Zustand:`, res_X - 70, res_Y - 225, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
API.drawText(`Tank:`, res_X - 70, res_Y - 255, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 225, 0.5, 255, 255, 255, 255, 4, 2, false, true, 0);
|
|
if (healthpercent < 60) {
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 225, 0.5, 219, 122, 46, 255, 4, 2, false, true, 0);
|
|
}
|
|
if (healthpercent < 30) {
|
|
API.drawText(`${healthpercent}%`, res_X - 20, res_Y - 225, 0.5, 219, 46, 46, 255, 4, 2, false, true, 0);
|
|
}
|
|
API.drawText(`${tank}%`, res_X - 20, res_Y - 255, 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];
|
|
}
|
|
}); |