Hallo user, ich möchte euch mal ein Script vorstellen, was ich vor etwa einer Woche erstellt hatte.
Das Usermenue hat mich um die 2 Stunden gekostet, bis es fertig war.
So sieht es aus:
Externer Inhalt
www.abload.de
Inhalte von externen Seiten werden ohne Ihre Zustimmung nicht automatisch geladen und angezeigt.
Der Quellcode:
Spoiler anzeigen
Lua
-- Tacho bei MuLTi -
local sx, sy = guiGetScreenSize()
local enabled = true
local font1 = dxCreateFont("data/fonts/digital.ttf", 9, true)
showPlayerHudComponent ( "ammo", false )
showPlayerHudComponent ( "clock", false )
showPlayerHudComponent ( "armour", false )
showPlayerHudComponent ( "breath", false )
showPlayerHudComponent ( "clock", false )
showPlayerHudComponent ( "health", false )
showPlayerHudComponent ( "weapon", false )
local COLORHEALTH = "0, 255, 0"
local COLORARMOUR = "121, 143, 145"
local COLORSPEED = "255, 150, 0"
local COLORDAMAGE = "255, 0, 0"
local DAMAGEVALUE = 0
addEventHandler("onClientRender", getRootElement(), function()
if(enabled == true) and(isPlayerEingeloggt(gMe) == true) then
local fontbig = {}
-- Background --
local x, y = sx/2, sy/2
local fx, fy = sx-sx/5-20, 15
dxDrawImage(fx, fy, sx/5, sy/7, "data/images/tacho/background.png")
-- Uhr --
fontbig.uhr = 2/1920*sx
local time = getRealTime()
local fx2, fy2 = sx-sx/12, 30/1080*sy
local hour, minute, second = time.hour, time.minute, time.second
local day = time.monthday
local month = time.month+1
local year = time.year+1900
if(hour < 10) then hour = "0"..hour end
if(minute < 10) then minute = "0"..minute end
if(second < 10) then second = "0"..second end
-- Tag
dxDrawText(day.."."..month.."."..year, fx2+2, fy2+2, fx2, fy2, tocolor(0, 0, 0, 200), fontbig.uhr, font1)
dxDrawText(day.."."..month.."."..year, fx2, fy2, fx2, fy2, tocolor(255, 255, 255, 200), fontbig.uhr, font1)
-- Datum --
dxDrawText(hour..":"..minute..":"..second, fx2+2, fy2+30/1080*sy+2, fx2, fy2+30, tocolor(0, 0, 0, 200), fontbig.uhr, font1)
dxDrawText(hour..":"..minute..":"..second, fx2, fy2+30/1080*sy, fx2, fy2+30, tocolor(255, 255, 255, 200), fontbig.uhr, font1)
-- Leben --
local WIDTH, HEIGHT = 120, 20
local NWIDTH, NHEIGHT = WIDTH/1920*sx-1, HEIGHT/1080*sy-5
NWIDTH = NWIDTH/100*getElementHealth(gMe)
dxDrawRectangle(fx2, fy2+70/1080*sy, WIDTH/1920*sx, HEIGHT/1080*sy, tocolor(gettok(COLORHEALTH, 1, string.byte(",")), gettok(COLORHEALTH, 2, string.byte(",")), gettok(COLORHEALTH, 3, string.byte(",")), 150))
dxDrawRectangle(fx2, fy2+72.5/1080*sy, NWIDTH, NHEIGHT, tocolor(gettok(COLORHEALTH, 1, string.byte(",")), gettok(COLORHEALTH, 2, string.byte(",")), gettok(COLORHEALTH, 3, string.byte(",")), 255))
-- Armour --
local WIDTH2, HEIGHT2 = 120, 20
local NWIDTH2, NHEIGHT2 = WIDTH2/1920*sx-1, HEIGHT2/1080*sy-5
NWIDTH2 = NWIDTH2/100*getPedArmor(gMe)
dxDrawRectangle(fx2, fy2+100/1080*sy, WIDTH2/1920*sx, HEIGHT2/1080*sy, tocolor(gettok(COLORARMOUR, 1, string.byte(",")), gettok(COLORARMOUR, 2, string.byte(",")), gettok(COLORARMOUR, 3, string.byte(",")), 150))
dxDrawRectangle(fx2, fy2+102.5/1080*sy, NWIDTH2, NHEIGHT2, tocolor(gettok(COLORARMOUR, 1, string.byte(",")), gettok(COLORARMOUR, 2, string.byte(",")), gettok(COLORARMOUR, 3, string.byte(",")), 255))
-- Fahrzeug --
local veh
fontbig.vehicle = 1.2/1920*sx
if(isPedInVehicle(gMe)) then
-- Name
veh = getPedOccupiedVehicle(gMe)
if(veh) then
local vehname = getVehicleName(veh)
local fx3, fy3 = sx-sx/5, 8/1080*sy
dxDrawText("Vehicle: "..vehname, fx3+2, fy3+30/1080*sy+2, fx3, fy3+30, tocolor(0, 0, 0, 200), fontbig.vehicle, font1)
dxDrawText("Vehicle: "..vehname, fx3, fy3+30/1080*sy, fx3, fy3+30, tocolor(255, 255, 255, 200), fontbig.vehicle, font1)
-- Geschwindigkeit --
local WIDTH3, HEIGHT3 = 180, 20
local NWIDTH3, NHEIGHT3 = WIDTH3/1920*sx-1, HEIGHT3/1080*sy-5
NWIDTH3 = NWIDTH3/100*getElementSpeed(veh)/2.5
if(NWIDTH3 > WIDTH3) then NWIDTH3 = WIDTH3 end
local r, g, b = gettok(COLORSPEED, 1, string.byte(",")), gettok(COLORSPEED, 2, string.byte(",")), gettok(COLORSPEED, 3, string.byte(","))
dxDrawRectangle(fx3, fy3+70/1080*sy, WIDTH3/1920*sx, HEIGHT3/1080*sy, tocolor(r, g, b, 150))
dxDrawRectangle(fx3, fy3+72.5/1080*sy, NWIDTH3, NHEIGHT3, tocolor(r, g, b, 255))
dxDrawText(math.floor(getElementSpeed(veh)/1.5).." KM/H", sx-sx/5, 8/1080*sy+71/1080*sy, fx2, fy2+30, tocolor(255, 255, 255, 200), fontbig.vehicle, font1)
dxDrawText(math.floor(getElementSpeed(veh)/1.5).." KM/H", sx-sx/5+2, 8/1080*sy+71/1080*sy+2, fx2, fy2+30, tocolor(0, 0, 0, 200), fontbig.vehicle, font1)
-- Damage --
local WIDTH4, HEIGHT4 = 180, 20
local NWIDTH4, NHEIGHT4 = WIDTH4/1920*sx-1, HEIGHT4/1080*sy-5
NWIDTH4 = NWIDTH4/1000*getElementHealth(veh)
local r, g, b = gettok(COLORDAMAGE, 1, string.byte(",")), gettok(COLORDAMAGE, 2, string.byte(",")), gettok(COLORDAMAGE, 3, string.byte(","))
-- Damagevalue --
if(DAMAGEVALUE > 0) then
DAMAGEVALUE = DAMAGEVALUE-3
end
b = b+DAMAGEVALUE
r = r-DAMAGEVALUE
dxDrawRectangle(fx3, fy3+100/1080*sy, WIDTH4/1920*sx, HEIGHT4/1080*sy, tocolor(r, g, b, 150))
dxDrawRectangle(fx3, fy3+102.5/1080*sy, NWIDTH4, NHEIGHT4, tocolor(r, g, b, 255))
dxDrawText(math.floor(getElementHealth(veh)*0.1).." %", sx-sx/5, 8/1080*sy+101/1080*sy, fx2, fy2+30, tocolor(255, 255, 255, 200), fontbig.vehicle, font1)
dxDrawText(math.floor(getElementHealth(veh)*0.1).." %", sx-sx/5+2, 8/1080*sy+101/1080*sy+2, fx2, fy2+30, tocolor(0, 0, 0, 200), fontbig.vehicle, font1)
end
end
end
end)
addEventHandler("onClientVehicleCollision", getRootElement(), function(hit, force)
if(source == getPedOccupiedVehicle(gMe)) then
local fDamageMultiplier = getVehicleHandling(source).collisionDamageMultiplier
if(force > 200) then
DAMAGEVALUE = 255
end
end
end)
Alles anzeigen
Das Script wird in dem Multistunt Gamemode vorhanden sein, was momentan auf meiner Festplatte vergammelt.
Wie findet ihr es?
Vielen Dank für die Antworten!
mfg
/Edit: Kein Copy & Paste script!