Poka? kod.
Prawdopodonie w p?tli sprawdzasz czy gracz, kt?remu rysujesz nametag to nie jest lokalny gracz.
Domy?lam si?, ?e tego sam nie znajdziesz wi?c wy?lij kod i b?dzie nam ?atwiej.
--local nametagFont = "default-bold"
--local nametagFont = dxCreateFont( "defualt-bold", 10) -- f/droid-sans.ttf
if not nametagFont then nametagFont = "default-bold" end
local fontHeight=dxGetFontHeight(1, nametagFont)
local nametagScale = 1.10
local nametagAlpha = 180
local nametagColor =
{
r = 255,
g = 255,
b = 255
}
local hp_width=math.floor(sw/20)
if hp_width<50 then hp_width=50 end
local hp_height=math.floor(hp_width/10)
local gsize=sw>800 and 32 or 16
local ourlevel=0
local ourfid=""
setTimer(function()
ourlevel=getElementData(localPlayer, "level") or 0
ourfid=getElementData(localPlayer, "player:faction") or ""
end, 15000, 0)
addEventHandler("onClientRender", root, function()
local rootx, rooty, rootz = getCameraMatrix()--getElementPosition(getLocalPlayer())
for i, player in ipairs(getElementsByType("player",root,true)) do
if player ~= localPlayer and (getElementAlpha(player)>50 or ourlevel>1 or getElementDimension(player)==901) then
local x,y,z = getPedBonePosition(player,8)
local sx, sy = getScreenFromWorldPosition(x, y, z+0.5)
if sx then
local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
if getElementAlpha(player) < 1 and not getElementData(localPlayer,"player:admin") then
return end
local name = "["..getElementData(player, "id").."] "..getPlayerName(player)..""
local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
local fX = math.floor(sx)
local fY = math.floor(sy)
local alpha = 120
if(distance <= 35) then
local level = tonumber(getElementData(player, "player:level"))
local p_level = tonumber(getElementData(player, "premium:level"))
if getElementData(player,"mute:player") then
dxDrawText("#911584MUTE", fX, fY-32, fX, fY-32, tocolor(0, 255, 255, 255), nametagScale, nametagFont, "center", "center",false,false,false,true,true)
end
if ourfid=="PR" then -- pokazujemy hp innych graczy
dxDrawRectangle(fX-hp_width/2-1, fY+fontHeight, hp_width+2, hp_height+2, tocolor(27,27,27,155))
local hp=getElementHealth(player)
if hp>100 then hp=100 end
local hhp_width=(hp*hp_width/100)
dxDrawRectangle(fX-hp_width/2, fY+fontHeight+1, hhp_width, hp_height, tocolor(255,5,5,155))
end
end
end
end
end
end)
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function()
for k, v in ipairs(getElementsByType("player")) do
setPlayerNametagShowing ( v, false )
end
end
)
Nie możesz pisać nowych tematów Nie możesz odpowiadać w tematach Nie możesz zmieniać swoich postów Nie możesz usuwać swoich postów Nie możesz głosować w ankietach