Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-11-02, 16:05


NoNamik







Wiek: 35
Na forum: 2326 dni
Posty: 288
Nick w MP: JestemNoNamem

Piwa: 379

Respekt: 60

witam jak usunac nametagi na /inv

--local nametagFont = "default"
local nametagFont = dxCreateFont( "czcionka.ttf", 20 )
if not nametagFont then nametagFont = "default-bold" end
local vopisFont = dxCreateFont( "czcionka.ttf", 20 )
if not vopisFont then vopisFont = "default-bold" end

local screenSize = Vector2(guiGetScreenSize())
local timer = false
local nametagAlpha = 175
local nametagColor =
{
    r = 255,
    g = 255,
    b = 255
}

-- Funkcja nametag?w graczy i pojazd?w
-- zazwyczaj s? dla u?atwienia wygl?du.
addEventHandler("onClientRender", root, function()
    local rootx, rooty, rootz = getCameraMatrix()
        for i,player in ipairs(getElementsByType("player")) do
            if getElementDimension(localPlayer) == getElementDimension(player) and getElementInterior(localPlayer) == getElementInterior(player) then
                local x,y,z = getPedBonePosition(player,7)
                local sx, sy = getScreenFromWorldPosition(x, y, z+0.50)
                local sxc,syc =getScreenFromWorldPosition(x, y, z+0.69)
                local sxc1,syc2 =getScreenFromWorldPosition(x, y, z+0.57)
                local sxc2,syc3 =getScreenFromWorldPosition(x, y, z+0.63)
                local sxc5,syc5 =getScreenFromWorldPosition(x, y, z+0.42)
                if sx and sy and sxc and syc and sxc1 and syc2 then
                local distance = getDistanceBetweenPoints3D(rootx, rooty, rootz, x, y, z)
                if getElementAlpha(player) < 2 and not getElementData(localPlayer,"player:admin") then
                return end
                if(distance <= 12) then
                --if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, false, false, false, true,localPlayer ) then
                      dxDrawText ((getPlayerName(player).." [#b8b8b8"..getElementData(player,"id").."#ffffff]"):gsub("#%x%x%x%x%x%x",""),sx, sy, sx, sy,tocolor(255, 255, 255,255),1.0,"default-bold","center","center",false,false,false,true, true)
                    if getElementData(player,"player:premium") then
                    dxDrawText ("[PREMIUM]",sxc1, syc2, sxc1, syc2, tocolor(169, 191, 46, 255),1.02,"default","center","center",false,false,false,true, true)
                    end
                    if getElementData(player,"player:premiumplus") then
                    dxDrawText ("[PREMIUM+]",sxc1, syc2 -15, sxc1, syc2, tocolor(116, 191, 46, 255),1.02,"default","center","center",false,false,false,true, true)
                    end
                    if getElementData(player, "player:mute") then 
                    dxDrawText ("[Zmutowany]",sxc5, syc5, sxc5, syc5,tocolor(255, 0, 0, 255),1.02,"default","center","center",false,false,false,true, true)
                    end
                    local frakcja = getElementData(player, "player:faction")
                    if frakcja == "SAPD" then
                    dxDrawText("[San Andreas Police Departament]", sxc2, syc3, sxc2, syc3, tocolor(3, 0, 253, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif frakcja == "SAFD" then
                    dxDrawText("[San Andreas Fire Departament]", sxc2, syc3, sxc2, syc3, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif frakcja == "SAMC" then
                    dxDrawText("[San Andreas Medical Center]", sxc2, syc3, sxc2, syc3, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif frakcja == "SARA" then
                    dxDrawText("[San Andreeas Road Assistance]", sxc2, syc3, sxc2, syc3, tocolor(205, 87, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif frakcja == "TSA" then
                    dxDrawText("[Transport San Andreas]", sxc2, syc3, sxc2, syc3, tocolor(255, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    end
                    local level = getElementData(player, "player:level")
                    if type(level) == "number" then
                    if level == 6 then
                    dxDrawText("Support", sxc, syc, sxc, syc, tocolor(0, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 1 then
                    dxDrawText("Moderator", sxc, syc, sxc, syc, tocolor(0, 255, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 2 then
                    dxDrawText("Administrator", sxc, syc, sxc, syc, tocolor(255, 0, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 3 then
                    dxDrawText("Opiekun", sxc, syc, sxc, syc, tocolor(255, 0, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 5 then
                    dxDrawText("RCON", sxc, syc, sxc, syc, tocolor(102, 0, 255, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 7 then
                    dxDrawText("VCEO", sxc, syc, sxc, syc, tocolor(255, 100, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    elseif level == 4 then
                    dxDrawText("CEO", sxc, syc, sxc, syc, tocolor(255, 255, 0, 255), 1.02, "default-bold", "center", "center",false,false,false,true, true)
                    end
                    --dxDrawText (name,fX+1, fY+1, fX+1, fY+1,white,nametagScale,"default","center","center",false,false,false,true,true )
                    if getElementData(localPlayer,"player:duty") == "SAMC" then
                    dxDrawRectangle(sx-25*2-1, sy+5*2, 100-distance, 18+2-distance/2.0, tocolor(27,27,27,155)) 
                    dxDrawRectangle(sx-25*2, sy+5*2+1, getElementHealth(player)-distance, 18-distance/1.0, tocolor(255,5,5,155))
                    end
                  end
                end
            end
        end
    end
    for i,ped in ipairs(getElementsByType("ped")) do
        if ped~=localPlayer and getElementDimension(localPlayer)==getElementDimension(ped) and getElementInterior(localPlayer) == getElementInterior(ped) and getElementAlpha(ped) > 0 then
            local x,y,z=getElementPosition(ped)
            local sx,sy =getScreenFromWorldPosition(x, y, z+1)
            if sx and sy then
                local desc=getElementData(ped,"ped:desc")
                if desc then
                    local distance = getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                    if distance <= 25 then
                        dxDrawText(desc, sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.0, "default`", "center", "center")
                    end
                end
            end
        end
    end
    for i,vehicle in ipairs(getElementsByType("vehicle")) do
        local x,y,z=getElementPosition(vehicle)
        local sx,sy=getScreenFromWorldPosition(x,y,z)
        if sx and sy then
            local desc=getElementData(vehicle,"vehicle:desc")
            if desc then
                local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                if distance <= 25 then
                    if isLineOfSightClear( rootx,rooty,rootz, x,y,z, true, false, false, true, false, false, true,localPlayer ) then
                    dxDrawText(desc:gsub("#%x%x%x%x%x%x",""), sx, sy, sx, sy, tocolor(255, 255, 255, 255), 1.00,"default", "center", "center")
                    end
                end
            end
        end
    end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
    for _,v in ipairs(getElementsByType("player")) do
        setPlayerNametagShowing(v, false)
    end
end)

addEventHandler("onClientPlayerSpawn", root,  function()
    setPlayerNametagShowing(source, false)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-02, 17:42


VVirmex

Sgrypter luja






Wiek: 21
Na forum: 3506 dni
Posty: 284
Nick w MP: AxyZ

Piwa: 235

Respekt: 110
Respekt: 110

Najlepiej jakby? zrobi? co? takiego pod ka?dym sprawdzeniem elementdaty (nick, frakcja itd.):


elseif getElementAlpha(player) == 0 then return end



My?l? ?e to powinno rozwi?za? problem :)

[ Dodano: 2020-11-02, 21:26 ]
Albo po prostu wklej po ipairs:

if getElementAlpha(player) == 0 then return end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-11-02, 21:53


vAnimo

Zielony w luła






Wiek: 20
Na forum: 2453 dni
Posty: 165
Nick w MP: vAnimo

Piwa: 883

Respekt: 70

dodaj to do komendy /inv
-- do w??czania inva
setElementData(plr,"p:inv",true)
--do wylaczania
setElementData(plr,"p:inv",false)

a to do nametag?w
addEventHandler("onClientRender", root, function()
    local rootx, rooty, rootz = getCameraMatrix()
        for i,player in ipairs(getElementsByType("player")) do
if getElementData(player,"p:inv") then return end


[ Dodano: 2020-11-02, 21:56 ]
albo tak jak pan wy?ej sprawdzaj alphe :)

Postaw piwo autorowi tego posta
 

 
Tagi: /inv :: nametagi
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » /inv nametagi Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

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
Dodaj temat do Ulubionych
Wersja do druku