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

Wysłany: 2018-12-03, 20:48


adisonboss







Wiek: 23
Na forum: 3472 dni
Posty: 237

Piwa: 6

Respekt: 50

Witam. Jak zrobi? by nie widzie? swojego nametaga nad g?ow?. Za pomoc :piwo: i R*

--[[
    # Resource Name
      Basic HUD
    # Author
      Rage
    # Date created
      12.04.2014
    # Copyright (c)
      If you edit it, then please respect me and keep
      the credits.
--]]

--# Fix on all resolutions
local screenW,screenH = guiGetScreenSize()
local resW,resH = 1280,720
local sW,sH =  (screenW/resW), (screenH/resH)
        
local validWeaponSlots = 
        {
        [ 2 ] = true,
        [ 3 ] = true,
        [ 4 ] = true,
        [ 5 ] = true,
        [ 6 ] = true,
        [ 7 ] = true,
        [ 8 ] = true, 
        }  

addEventHandler("onClientRender", root,
    function()
        --# Player
        local hour, mins = getTime ()
        local time = hour .. ":" .. (((mins < 10) and "0"..mins) or mins)
        local zone = getZoneName (getElementPosition(getLocalPlayer()))    
        local money = convertNumber(getPlayerMoney(localPlayer))
        local health = math.floor (getElementHealth ( getLocalPlayer() ))    
        local armor = math.floor(getPedArmor ( getLocalPlayer() ))    
            dxDrawText(tostring (time), 1150*sW, 17*sH, 1270*sW, 38*sH, tocolor(255, 255, 255, 255), 1.25, "default-bold", "center", "center", false, false, false, false, false)        
            dxDrawText(zone, 1150*sW, 45*sH, 1270*sW, 45*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false)        
            dxDrawText("$ "..money, 1150*sW, 50*sH, 1270*sW, 70*sH, tocolor(255, 255, 255, 255), 1.25, "default-bold", "left", "center", false, false, true, true, false)
            dxDrawText("Health: "..health.." %", 1150*sW, 70*sH, 1270*sW, 85*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, true, true, false)                
            dxDrawText("Armor: "..armor.." %", 1150*sW, 85*sH, 1270*sW, 100*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, true, true, false)        
        local oxygen = getPedOxygenLevel (getLocalPlayer())
            if  ( oxygen < 1000 or isElementInWater(getLocalPlayer()) ) then    
                dxDrawText("Oxygen: "..math.floor(oxygen/10).."%", 1150*sW, 100*sH, 1270*sW, 115*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, true, true, false)            
            end    
        if getControlState ("aim_weapon") or isPedDoingGangDriveby(getLocalPlayer()) then
            local ammo = getPedTotalAmmo (getLocalPlayer())
            local clip = getPedAmmoInClip (getLocalPlayer())
            local weaponID = getPedWeapon(localPlayer)
            local weapName = getWeaponNameFromID(weaponID)
            local weapSlot = getPedWeaponSlot(getLocalPlayer())        
            local xBone,yBone,zBone = getPedBonePosition(getLocalPlayer(), 8)
            local zBone = zBone - 0.5
            local xSP,ySP = getScreenFromWorldPosition ( xBone,yBone,zBone )            
                if ( xSP and ySP ) then    
                    dxDrawText(weapName.." "..clip.." | "..ammo, xSP+100,ySP, 290*sW, 250*sH, tocolor (255, 255, 255, 255), 1.25*sW,1.25*sH,"default-bold","left","top",false,false,false,true) 
                        if ( clip < 1 and validWeaponSlots [ weapSlot ]  ) then
                            dxDrawText("Reloading...", xSP+100,ySP+20, 290*sW, 250*sH, tocolor (255, 255, 255, 255), 1.25*sW,1.25*sH,"default-bold","left","top",false,false,false,true)        
                        end
                end
        end
        --# Vehicle
        local vehicle = getPedOccupiedVehicle(getLocalPlayer())
            if ( vehicle ) then
                local speedx, speedy, speedz = getElementVelocity ( vehicle  )
                local actualspeed = (speedx^2 + speedy^2 + speedz^2)^(0.5) 
                local kmh = math.floor(actualspeed*180)    
                    if getElementHealth(vehicle) >= 999 then
                        vehiclehealth = 100
                    else
                        vehiclehealth = math.floor(getElementHealth ( vehicle )/10)
                    end
                        dxDrawText(kmh.." km/h", 1160*sW, 653*sH, 1190*sW, 680*sH, tocolor(255, 255, 255, 255), 1.25, "default-bold", "left", "center", false, false, false, false, false)
                        dxDrawText("Damage: "..vehiclehealth.." %", 1150*sW, 680*sH, 1270*sW, 695*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, false, false, false)                        
                    end        
            local vehicle = getPedOccupiedVehicle(getLocalPlayer())
                if ( vehicle ) then            
                    local nitro = getVehicleNitroLevel(getPedOccupiedVehicle(getLocalPlayer()))
                    local nitroCount = getVehicleNitroCount(getPedOccupiedVehicle(getLocalPlayer()))
                        if getVehicleUpgradeOnSlot(vehicle, 8) then            
                            if  nitro ~= false and nitro ~= nil and nitro > 0  then
                                dxDrawText("Nitro: "..nitroCount.." | "..math.floor(nitro/1*100).." %", 1150*sW, 695*sH, 1270*sW, 710*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, false, false, false)                
                            else
                                dxDrawText("", 1150*sW, 695*sH, 1270*sW, 710*sH, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "center", false, false, false, false, false)            
                            end
                        end
                end
        end)

--# Nametags
addEventHandler( "onClientRender",root,
   function( )
      local px, py, pz, tx, ty, tz, dist
      px, py, pz = getCameraMatrix( )
      for _, v in ipairs( getElementsByType 'player' ) do
         tx, ty, tz = getElementPosition( v )
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
         if dist < 30.0 then
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then
               local sx, sy, sz = getPedBonePosition( v, 5 )
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.6 )
               local playerR, playerG, playerB = getPlayerNametagColor ( localPlayer )               
               local Level = getElementData(localPlayer,"Level") or 0               
               if x then
                dxDrawText( string.gsub ( getPlayerName ( v ), "#%x%x%x%x%x%x", "" ).."", x, y, x, y, tocolor(playerR, playerG, playerB), 0.85 + ( 15 - dist ) * 0.02, "default-bold" )            
               end
            end
         end
      end
   end
)

--# Convert numbers
function convertNumber ( number )  
    local formatted = number  
    while true do      
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
        if ( k==0 ) then      
            break  
        end  
    end  
    return formatted
end

addEventHandler( "onClientResourceStart", resourceRoot,
    function()
        setPlayerHudComponentVisible ( "all", false )
        setPlayerHudComponentVisible ( "radar", true )    
        setPlayerHudComponentVisible ( "vehicle_name", true )    
        setPlayerHudComponentVisible ( "radio", true )        
        setPlayerHudComponentVisible ( "crosshair", true )            
    end);

addEventHandler( "onClientResourceStop", resourceRoot,
    function()
        setPlayerHudComponentVisible ( "all", true )        
    end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2018-12-03, 20:50


Kalizman







Wiek: 24
Na forum: 3792 dni
Posty: 1394

Piwa: 4624

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

Powinno dzia?a?:
--# Nametags
addEventHandler( "onClientRender",root,
   function( )
      local px, py, pz, tx, ty, tz, dist
      px, py, pz = getCameraMatrix( )
      for _, v in ipairs( getElementsByType 'player' ) do
        if v~=localPlayer then
         tx, ty, tz = getElementPosition( v )
         dist = math.sqrt( ( px - tx ) ^ 2 + ( py - ty ) ^ 2 + ( pz - tz ) ^ 2 )
         if dist < 30.0 then
            if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false,localPlayer ) then
               local sx, sy, sz = getPedBonePosition( v, 5 )
               local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.6 )
               local playerR, playerG, playerB = getPlayerNametagColor ( localPlayer )               
               local Level = getElementData(localPlayer,"Level") or 0               
               if x then
                dxDrawText( string.gsub ( getPlayerName ( v ), "#%x%x%x%x%x%x", "" ).."", x, y, x, y, tocolor(playerR, playerG, playerB), 0.85 + ( 15 - dist ) * 0.02, "default-bold" )            
               end
            end
         end
         end
      end
   end
)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
adisonboss
Wysłany: 2018-12-04, 17:43


adisonboss







Wiek: 23
Na forum: 3472 dni
Posty: 237

Piwa: 6

Respekt: 50

Dziena do zamkniecia

Postaw piwo autorowi tego posta
 

 
Tagi: swoje :: 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 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