Guuuten Tag Community,
Ich habe ein kleines HUD gescriptet, jedoch wird mein Damage sowie die Kills nicht im hud angezeigt.
Die Frage ist, warum ?
Es gab hier ja bereits ein Thema, jedoch habe ich alles versucht, was dort geschrieben wurde und das hat alles nix gebracht ..
Lua
damage = {
[1] = 0,
}
kills = {
[1] = 0,
}
function dxDrawHUD()
local sx,sy = guiGetScreenSize()
local px,py = 1680,1050
local x,y = (sx/px), (sy/py)
showPlayerHudComponent("clock",false)
showPlayerHudComponent("money",false)
showPlayerHudComponent("health",false)
showPlayerHudComponent("armour",false)
showPlayerHudComponent("weapon",true)
showPlayerHudComponent("ammo",true)
showPlayerHudComponent("wanted",false)
local playerHealth = getElementHealth ( getLocalPlayer() )
local playerArmor = getPedArmor ( getLocalPlayer() )
dxDrawRectangle(x*1429, y*0, x*251, y*186, tocolor(255,255, 255, 100), true)
dxDrawText(getPlayerName(localPlayer), x*1467, y*5, x*1645, y*34, tocolor(0, 0, 0, 200), 1.50, "default", "center", "top", false, false, true, false, false)
dxDrawImage(x*1448, y*44, x*49, y*49, "Heart.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawImage(x*1514, y*54, x*131/100*playerHealth, y*25, "leben.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawImage(x*1449, y*103, x*48, y*48, "armor.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawImage(x*1514, y*113, x*131/100*playerArmor, y*25, "schutzweste.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawRectangle(x*1429, y*229, x*106, y*49, tocolor(0, 0, 0, 123), true)
dxDrawRectangle(x*1557, y*229, x*103, y*49, tocolor(0, 0, 0, 123), true)
dxDrawLine(x*1429, y*229, x*1428, y*276, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1429, y*278, x*1535, y*278, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1535, y*231, x*1536, y*278, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1429, y*231, x*1535, y*231, tocolor(255, 255, 255, 255), 2, true)
dxDrawLine(x*1429, y*231, x*1535, y*231, tocolor(0, 0, 0, 255), 2, true)
dxDrawImage(x*1567, y*241, x*28, y*25, "flash.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawLine(x*1557, y*231, x*1557, y*278, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1555, y*278, x*1661, y*278, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1556, y*231, x*1662, y*231, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1661, y*231, x*1660, y*278, tocolor(0, 0, 0, 255), 2, true)
dxDrawImage(x*1439, y*240, x*27, y*26, "skull.png", 0, 0, 0, tocolor(255, 255, 255, 255), true)
dxDrawText(kills[1], x*1476, y*246, x*1518, y*266, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false)
dxDrawText(math.floor(damage[1]), x*1605, y*246, x*1647, y*266, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, true, false, false)
dxDrawLine(x*1428, y*1, x*1428, y*186, tocolor(0, 0, 0, 255), 2, true)
dxDrawLine(x*1428, y*186, x*1688, y*186, tocolor(0, 0, 0, 255), 2, true)
end
addEventHandler("onClientRender", getRootElement(), dxDrawHUD)
function cancelpeddamage ( attacker, weapon, bodypart, loss )
if attacker == localPlayer then
table.insert(damage,1,tonumber(damage[1] + loss))
end
end
addEventHandler("onClientPedDamage", getRootElement(), cancelpeddamage)
function kill( attacker, weapon, bodypart, loss )
if attacker == localPlayer then
table.insert(kills,1,tonumber(kills[1] + 1))
end
end
function die ()
table.insert(damage,1,tonumber(0))
table.insert(kills,1,tonumber(0))
end
addEventHandler("onClientPlayerWasted", getRootElement(), die)
Alles anzeigen