Guten Tag und Frohes Neues Jahr MTA Community,
Ich habe noch ein Altes Hud bei mir aufm Pc gefunden und finde es nice ich habe es bei meinem Script eingefügt und jetzt kommen fehler.
Ich wollte mein geld einzahlen ( sieht man auf den Screen ) und es bleibt trz auf meine Handy Woran liegt das?
http://www.pic-upload.de/view-29288554/…-29-18.png.html
Hier das Script :
Lua
local xResolution, yResolution = guiGetScreenSize()
local isHudShowing = false
function popOutWindow()
local now = getTickCount()
local elapsedTime = now - startTime
local duration = endTime - startTime
local progress = elapsedTime / duration
local w, h = 400, 150
local xp, yp, _ = interpolateBetween (
xResolution-w, 0-h, 0,
xResolution-w, 0, 0,
progress, "OutBack")
if progress >= 1 then
progress = 1
end
displayHudFunc(xp, yp, w, h)
end
function popInWindow()
local now = getTickCount()
local elapsedTime = now - startTime
local duration = endTime - startTime
local progress = elapsedTime / duration
local w, h = 400, 150
local xp, yp, _ = interpolateBetween (
xResolution-w, 0, 0,
xResolution-w, 0-h-200, 0,
progress, "InBack")
if progress >= 1 then
progress = 1
end
displayHudFunc(xp, yp, w, h)
end
function displayHudFunc(xp, yp, w, h)
--Health
if getElementData ( player, "loggedin" ) == 1 then
dxDrawRectangle(xp-2+180, yp-2+10, 200+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+180, yp+10, getElementHealth(getLocalPlayer()) * 2, 20, tocolor(255, 0, 0))
dxDrawImage(xp+155-2, yp+10-2, 20+4, 20+4, "beta/img/hud/health.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+10, 20, 20, "beta/img/hud/health.png")
dxDrawText(math.floor(getElementHealth(getLocalPlayer())) .. " %", xp+180, yp+10, xp, yp, tocolor (255, 255, 255), 1.25, "arial")
--Armor
if getPedArmor(getLocalPlayer()) > 0 then
dxDrawRectangle(xp-2+180, yp-2+40, 200+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+180, yp+40, getPedArmor(getLocalPlayer()) * 2, 20, tocolor(200, 200, 200))
dxDrawImage(xp+155-2, yp+40-2, 20+4, 20+4, "beta/img/hud/armor.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+40, 20, 20, "beta/img/hud/armor.png")
dxDrawText(math.floor(getPedArmor(getLocalPlayer())) .. " %", xp+180, yp+40, xp, yp, tocolor (255, 255, 255), 1.25, "arial")
end
--Oxygen
if getPedOxygenLevel(getLocalPlayer()) < 1000 then
dxDrawRectangle(xp-2+180, yp-2+70, 200+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+180, yp+70, getPedOxygenLevel(getLocalPlayer()) / 10* 2, 20, tocolor(100, 149, 237))
dxDrawImage(xp+155-2, yp+70-2, 20+4, 20+4, "beta/img/hud/oxygen.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+70, 20, 20, "beta/img/hud/oxygen.png")
dxDrawText(math.floor(getPedOxygenLevel(getLocalPlayer()) / 10) .. " %", xp+180, yp+70, xp, yp, tocolor ( 255, 255, 255), 1.25, "arial")
end
--Hunger
dxDrawRectangle(xp-2+180, yp-2+100, 200+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+180, yp+100, getElementData(getLocalPlayer(), "hunger")* 2, 20, tocolor(0, 205, 0))
dxDrawImage(xp+155-2, yp+100-2, 20+4, 20+4, "beta/img/hud/hunger.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+100, 20, 20, "beta/img/hud/hunger.png")
dxDrawText(math.floor(getElementData(getLocalPlayer(), "hunger")) .. " %", xp+180, yp+100, xp, yp, tocolor ( 255, 255, 255), 1.25, "arial")
--Weapon
dxDrawImage(xp, yp, 125, 125, "beta/img/weapons/weapon_"..getPedWeapon(getLocalPlayer())..".png")
if getPedTotalAmmo(getLocalPlayer()) > 1 then
if getPedTotalAmmo(getLocalPlayer()) > 9999 then
ammo = " ∞".." - "..getPedAmmoInClip(getLocalPlayer())
else
ammo = getPedTotalAmmo(getLocalPlayer())-getPedAmmoInClip(getLocalPlayer()).. " - "..getPedAmmoInClip(getLocalPlayer())
end
dxDrawText(ammo, xp + 40 - #ammo*2.7-1, yp+120-1, xp, yp, tocolor (0, 0, 0), 1.8, "arial")
dxDrawText(ammo, xp + 40 - #ammo*2.7, yp+120, xp, yp, tocolor (255, 255, 255), 1.8, "arial")
end
--Wanteds
if getPlayerWantedLevel() > 0 then
offset = 0
for i = 1, getPlayerWantedLevel() do
dxDrawText("★", xp + 250 + offset - 1, yp + 125 - 1, xp, yp, tocolor (0, 0, 0), 2, "arial")
dxDrawText("★", xp + 250 + offset, yp + 125, xp, yp, tocolor (255, 255, 255), 2, "arial")
offset = offset + 25
end
end
--Time
local hours, minutes = getTime()
if hours < 10 then
hours = "0"..hours
end
if minutes < 10 then
minutes = "0"..minutes
end
dxDrawImage(xp+155-2, yp+130-2, 20+4, 20+4, "beta/img/hud/clock.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+130, 20, 20, "beta/img/hud/clock.png")
dxDrawText(hours..":"..minutes, xp + 180 - 1, yp + 125 - 1, xp, yp, tocolor (0, 0, 0), 2, "arial")
dxDrawText(hours..":"..minutes, xp + 180, yp + 125, xp, yp, tocolor (255, 255, 255), 2, "arial")
--Money
local money = 0
if #tostring(getPlayerMoney()) <= 7 then
for i = 1, 7-#tostring(getPlayerMoney()) do
money = "0"..money
end
money = money..getPlayerMoney()
else
money = getPlayerMoney()
end
dxDrawImage(xp+155-2, yp+155-2, 20+4, 20+4, "beta/img/hud/money.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp+155, yp+155, 20, 20, "beta/img/hud/money.png")
dxDrawText(money, xp + 180 - 1, yp + 150 - 1, xp, yp, tocolor (0, 0, 0), 2, "arial")
dxDrawText(money, xp + 180, yp + 150, xp, yp, tocolor (255, 255, 255), 2, "arial")
--Car
if getPedOccupiedVehicle(getLocalPlayer()) then
if getElementHealth(getPedOccupiedVehicle(getLocalPlayer())) > 1000 then
dxDrawRectangle(xp-2+25, yp-2+185, 355+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+25, yp+185, 355, 20, tocolor(255,127,0))
dxDrawImage(xp-2, yp+185-2, 20+4, 20+4, "beta/img/hud/car.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp, yp+185, 20, 20, "beta/img/hud/car.png")
dxDrawText(">100 %", xp+25, yp+185, xp, yp, tocolor ( 255, 255, 255), 1.25, "arial")
else
if getElementHealth(getPedOccupiedVehicle(getLocalPlayer())) < 250 then
dxDrawRectangle(xp-2+25, yp-2+185, 355+4, 20+4, tocolor(0, 0, 0))
dxDrawImage(xp, yp+185, 20, 20, "beta/img/hud/car_fire.png")
dxDrawText("Das Fahrzeug brennt, nichts wie raus!", xp+25, yp+185, xp, yp, tocolor ( 255, 0, 0), 1.25, "arial")
else
dxDrawRectangle(xp-2+25, yp-2+185, 355+4, 20+4, tocolor(0, 0, 0))
dxDrawRectangle(xp+25, yp+185, getElementHealth(getPedOccupiedVehicle(getLocalPlayer())) / 10* 3.55, 20, tocolor(255,127,0))
dxDrawImage(xp-2, yp+185-2, 20+4, 20+4, "beta/img/hud/car.png", 0, 0, 0, tocolor(0, 0, 0))
dxDrawImage(xp, yp+185, 20, 20, "beta/img/hud/car.png")
dxDrawText(math.floor(getElementHealth(getPedOccupiedVehicle(getLocalPlayer())) / 10) .. " %", xp+25, yp+185, xp, yp, tocolor ( 255, 255, 255), 1.25, "arial")
end
end
end
end
end
function playerPressedKey(button, press)
if(not press and button == "mouse2" and isHudShowing == false) then
toggleHud(false)
elseif (press and button == "mouse2") and (getPedWeapon(getLocalPlayer()) == 35 or getPedWeapon(getLocalPlayer()) == 36 or getPedWeapon(getLocalPlayer()) == 34 or getPedWeapon(getLocalPlayer()) == 43) and isHudShowing then
toggleHud(false)
end
end
addEventHandler("onClientKey", root, playerPressedKey)
local hudIsEnabled = true
function changeHudMode()
if xResolution > 800 and yResolution > 600 then
if hudIsEnabled then
removeEventHandler("onClientRender", root, popOutWindow)
removeEventHandler("onClientRender", root, popInWindow)
removeEventHandler("onClientRender", root, removeHud)
setTimer(function () showPlayerHudComponent ( "ammo", true )
showPlayerHudComponent ( "armour", true )
showPlayerHudComponent ( "breath", true )
showPlayerHudComponent ( "health", true )
showPlayerHudComponent ( "money", true )
showPlayerHudComponent ( "weapon", true )
showPlayerHudComponent ( "wanted", true )
showPlayerHudComponent ( "clock", true )
end, 500, 1)
else
initHud()
end
hudIsEnabled = not hudIsEnabled
end
end
addCommandHandler("togglehud", changeHudMode)
local animationIsMoving = false
function toggleHud(byPressingKey)
if xResolution > 800 and yResolution > 600 and not animationIsMoving and hudIsEnabled then
if byPressingKey then
animationIsMoving = true
setTimer(function() animationIsMoving = false end, 500, 1)
end
if isHudShowing then
isHudShowing = false
startTime = getTickCount()
endTime = startTime + 500
addEventHandler("onClientRender", root, popInWindow)
removeEventHandler("onClientRender", root, popOutWindow)
else
isHudShowing = true
startTime = getTickCount()
endTime = startTime + 500
addEventHandler("onClientRender", root, popOutWindow)
removeEventHandler("onClientRender", root, popInWindow)
end
end
end
bindKey("b", "down", toggleHud, true)
function initHud()
if xResolution > 800 and yResolution > 600 then
isHudShowing = true
startTime = getTickCount()
endTime = startTime + 500
addEventHandler("onClientRender", root, popOutWindow)
addEventHandler("onClientRender", root, removeHud)
end
end
addEventHandler("onClientResourceStart", root, initHud)
function removeHud()
if xResolution > 800 and yResolution > 600 then
showPlayerHudComponent ( "ammo", false )
showPlayerHudComponent ( "armour", false )
showPlayerHudComponent ( "breath", false )
showPlayerHudComponent ( "health", false )
showPlayerHudComponent ( "money", false )
showPlayerHudComponent ( "weapon", false )
showPlayerHudComponent ( "wanted", false )
showPlayerHudComponent ( "clock", false )
end
end
fileDelete("beta/dx/beta_client.lua")
Alles anzeigen