Hey Leute, habe ein Problem mit meinem Nametag Script..
Und zwar möchte, dass alle Spieler halt ein tolles Nametag übern Schädel haben.
Das Problem ist, dass man nur sein eigenes sieht.
Desweiteren bekomme ich diesen Error:
https://picload.org/image/rprairca…26_01-08-51.png
Hier mein Script (ich habe die Zeile mit dem Error mit einem Kommentar versehen!)
Spoiler anzeigen
Lua
local Name = getElementData(player, "Charakter")
local Fraktion = getElementData(player, "Fraktion")
local xN, yN, zN = getCameraMatrix(player)
local px, py, pz = getElementPosition(player)
local pdistance = getDistanceBetweenPoints3D (xN, yN, zN, px, py, pz)
local hX, hY, hZ = getPedBonePosition(localPlayer, 6)--Für die Lebensanzeige
xR, yR = getScreenFromWorldPosition(hX, hY, hZ +0.32) --Für die Lebensanzeige
HealthBar = yR /2.5 * (getElementHealth(player) / 100) -------------------------------Hier ist der Error!---------
if pdistance <= Nametag_Distance then else return end
--Spieler soll seinen eichnen nametag nicht sehen
if Name == getElementData(localPlayer, "Charakter") then
if not(isPedInVehicle(player)) then
--Hat der Spieler den Nametag eingeschaltet?
if getElementData(localPlayer, "showNametag") == true then
dxDrawRectangle(xR -70, yR +10, yR /2.3, -45, tocolor(0, 0, 0, 150))
dxDrawTextOnElement(player, Name, "Ped", 0.4, Nametag_Distance, 255, 255, 0, 200, 1.2, "clear")
dxDrawTextOnElement(player, Fraktion, "Ped", 0.35, Nametag_Distance, 255, 255, 255, 200, 1.2, "clear")
if getElementHealth(player) >= 60 then
dxDrawRectangle(xR -65, yR, yR /2.5, 10, tocolor(0, 0, 0, 200))
dxDrawRectangle(xR -65, yR, HealthBar, 10, tocolor(255, 0, 0, 255)) --Lebensanzeige
elseif getElementHealth(player) <= 59 and getElementHealth(player) >= 25 then
dxDrawRectangle(xR -65, yR, yR /2.5, 10, tocolor(0, 0, 0, 200))
dxDrawRectangle(xR -65, yR, HealthBar, 10, tocolor(255, 255, 0, 255)) --Lebensanzeige
elseif getElementHealth(player) <= 24 then
dxDrawRectangle(xR -65, yR, yR /2.5, 10, tocolor(0, 0, 0, 200))
dxDrawRectangle(xR -65, yR, HealthBar, 10, tocolor(50, 50, 50, 255)) --Lebensanzeige
end
end
else
if getElementData(localPlayer, "showNametag") == true then
dxDrawRectangle(xR -135 /2, yR +3 /2.3, yR /3.5, -40, tocolor(0, 0, 0, 150))
dxDrawTextOnElement(player, Name, "Ped", 0.5, Nametag_Distance, 255, 255, 0, 200, 1.2, "clear")
dxDrawTextOnElement(player, Fraktion, "Ped", 0.4, Nametag_Distance, 255, 255, 255, 200, 1.2, "clear")
if getElementHealth(player) >= 60 then
dxDrawRectangle(xR -68, yR -5, yR /3.5, 5, tocolor(0, 0, 0, 255))
dxDrawRectangle(xR -68, yR -5, HealthBar /1.5, 5, tocolor(255, 0, 0, 200)) --Lebensanzeige
elseif getElementHealth(player) <= 59 and getElementHealth(player) >= 25 then
dxDrawRectangle(xR -68, yR -5, yR /3.5, 5, tocolor(0, 0, 0, 255))
dxDrawRectangle(xR -68, yR -5, HealthBar/1.5, 5, tocolor(255, 255, 0, 200)) --Lebensanzeige
elseif getElementHealth(player) <= 24 then
dxDrawRectangle(xR -68, yR -5, yR /3.5, 5, tocolor(0, 0, 0, 255))
dxDrawRectangle(xR -68, yR -5, HealthBar /1.5, 5, tocolor(50, 50, 50, 200)) --Lebensanzeige
end
end
end
end
Alles anzeigen
Hoffe jemand kann mir weiter helfen.
Mfg KeksKing