[YARDIM] Hudu Ekrana Göre Kayma

0 Üye ve 1 Ziyaretçi konuyu incelemekte.

Çevrimdışı aves67

  • Yeni Üye
  • *
    • İleti: 50
: 02 Ağustos 2019, 22:52:12
Kod
----------------------------------------->>
-- GTI: Grand Theft International
-- Date: 08 Dec 2013
-- Resource: GTIhud/hud.lua
-- Type: Client Side
-- Author: JT Pennington (JTPenn)
----------------------------------------->>

F_SCREEN_X, F_SCREEN_Y = guiGetScreenSize();
F_RES_X, F_RES_Y = 1280, 1024;

local iFPS = 0;
local iFrames = 0;
local iStartTick = getTickCount();

local sX,sY = guiGetScreenSize()
hudEnabled = nil -- Is the Hud Enabled?

local SAFEZONE_X = sX*0.01
local SAFEZONE_Y = sY*0.05
local SERVER_NAME = "Destan Gaming | "..#getElementsByType("player").."/"..getElementData(root, "max_players").." Oyuncu"

local disabledHUD = {"health", "armour", "breath", "clock", "money", "weapon", "ammo", "vehicle_name", "area_name", "wanted"}
-- Replaced HUD Components

local game_time = "" -- Game Date and Time
local date_ = "" -- Client Date and Time
local uptime = getRealTime().timestamp
-- Client Uptime

local healthTimer = setTimer(function() end, 1000, 0)
-- Timer that makes health flash

function GetFPS()
return iFPS;
end
-- Toggle HUD
-------------->>
addEvent("onClientSettingChange", true)
addEventHandler("onClientSettingChange", localPlayer,
function (setting, oldVal, newVal)
local setting = exports.GTIsettings:getSetting("hud")
if (not hudEnabled) and (setting == "GTI Hud")  then
for i,hud in ipairs(disabledHUD) do
setPlayerHudComponentVisible(hud, false)
end
hudEnabled = true
elseif ( hudEnabled ) and ( setting == "GTA Hud" ) then
for i,hud in ipairs(disabledHUD) do
setPlayerHudComponentVisible(hud, true)
end
hudEnabled = nil
else -- if not, set it as default (GTI's hud)
for i,hud in ipairs(disabledHUD) do
setPlayerHudComponentVisible(hud, false)
end
hudEnabled = true
end
end
)

addEventHandler("onClientResourceStart", resourceRoot, function()
for i,hud in ipairs(disabledHUD) do
setPlayerHudComponentVisible(hud, false)
end
hudEnabled = true
end)

function renderHealth2()
for i,hud in ipairs(disabledHUD) do
setPlayerHudComponentVisible(hud, false)
end
end
addEventHandler("onClientRender", root, renderHealth2)

-- HUD Exports
--------------->>

local enabledHud = {"radar", "radio", "crosshair"}
function showHud()
if (isCustomHudEnabled()) then
setPlayerHudComponentVisible("all", false)
for i,hud in ipairs(enabledHud) do
setPlayerHudComponentVisible(hud, true)
end
else
setPlayerHudComponentVisible("all", true)
end
end
addEvent("GTIhud.showHud", true)
addEventHandler("GTIhud.showHud", root, showHud)

function isCustomHudEnabled()
return hudEnabled or false
end

function CustomHud(bool)
hudEnabled = bool
end

-- Health
---------->>

function arkaplan()
if (isPlayerMapVisible() or not hudEnabled) then return end
        local dX,dY,dW,dH = sX-150,10,250,20
        local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
dxDrawImage( dX-50,dY-55,310,230, "img/arkaplan.png", 0, 0, 0, tocolor(255, 255, 255, 255))
end
addEventHandler("onClientRender", root, arkaplan)


function renderHealth()
        if (isPlayerMapVisible() or not hudEnabled) then return end
       
        local health = getElementHealth(localPlayer)
        local maxHealth = getPedStat(localPlayer, 24)
        local maxHealth = (((maxHealth-569)/(1000-569))*100)+100
        local healthStat = health/maxHealth
       
        local r1,g1,b1, r2,g2,b2, a
        if (healthStat > 0.25) then
                r1,g1,b1 = 180,25,29
                r2,g2,b2 = 90,12,14
                a = 200
        else
                r1,g1,b1 = 180,25,29
                r2,g2,b2 = 90,12,14
               
                local aT = getTimerDetails(healthTimer)
                if (aT > 500) then
                        a = (aT-500)/500*200
                else
                        a = (500-aT)/500*200
                end
        end
       
        local dX,dY,dW,dH = sX-150,10,250,20
        local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
        --dxDrawRectangle( dX,dY,dW,dH, tocolor(0,0,0,150) )
dxDrawImage( dX+90,dY-25,10,10, "img/health.png", 0, 0, 0, tocolor(255, 255, 255, 255))
        local dX,dY,dW,dH = sX-10,-15,140,14

        local dX,dY,dW,dH = sX-153-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
addOutlines (dX, dY, dW, dH, tocolor (0, 0, 0, 255), 1);
        dxDrawRectangle( dX,dY,dW,dH, tocolor(r2,g2,b2,200) )
        dxDrawRectangle( dX,dY,healthStat*dW,dH, tocolor(r1,g1,b1,a) )
end
addEventHandler("onClientRender", root, renderHealth)

-- Armor
--------->>

function renderArmor()
        if (isPlayerMapVisible() or not hudEnabled) then return end
       
        local armor = getPedArmor(localPlayer)
        local armorStat = armor/100
       
        local r1,g1,b1, r2,g2,b2
        r1,g1,b1 = 225,225,225
        r2,g2,b2 = 112,112,112
       
        local dX,dY,dW,dH = sX-150,-10,250,20
        local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
        --dxDrawRectangle( dX,dY,dW,dH, tocolor(0,0,0,150) )
dxDrawImage( dX+90,dY+20,10,10, "img/sheild.png", 0, 0, 0, tocolor(255, 255, 255, 255))
        local dX,dY,dW,dH = sX-10,8,140,14
        local dX,dY,dW,dH = sX-153-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
addOutlines (dX, dY, dW, dH, tocolor (0, 0, 0, 255), 1);
        dxDrawRectangle( dX,dY,dW,dH, tocolor(r2,g2,b2,200) )
        dxDrawRectangle( dX,dY,armorStat*dW,dH, tocolor(r1,g1,b1,200) )
end
addEventHandler("onClientRender", root, renderArmor)

-- Oxygen
---------->>

function renderOxygenLevel()
        if (isPlayerMapVisible() or not hudEnabled) then return end
       
        local oxygen = getPedOxygenLevel(localPlayer)
        if (oxygen >= 1000) then return end
        local oxygenStat = oxygen/1000
       
        local r1,g1,b1, r2,g2,b2
        r1,g1,b1 = 172,203,241
        r2,g2,b2 = 86,101,120
       
        local dX,dY,dW,dH = sX-150,-30,250,20
        local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
        --dxDrawRectangle( dX,dY,dW,dH, tocolor(0,0,0,150) )
dxDrawImage( dX+90,dY+63,10,10, "img/oxygen.png", 0, 0, 0, tocolor(255, 255, 255, 255))
        local dX,dY,dW,dH = sX-10,29,140,14
        local dX,dY,dW,dH = sX-153-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
addOutlines (dX, dY, dW, dH, tocolor (0, 0, 0, 255), 1);
        dxDrawRectangle( dX,dY,dW,dH, tocolor(r2,g2,b2,200) )
        dxDrawRectangle( dX,dY,oxygenStat*dW,dH, tocolor(r1,g1,b1,200) )
end
addEventHandler("onClientRender", root, renderOxygenLevel)

-- Ping/FPS Meter
------------------>>

--local FPScount = 0
--local ping = 0
--local fps = 0
--function updatePingAndFPS()
-- ping = getPlayerPing(localPlayer)
-- fps = FPScount
-- FPScount = 0
--end
--setTimer(updatePingAndFPS, 1000, 0)

--function renderFPSandPing()
-- if (isPlayerMapVisible() or not hudEnabled) then return end
-- FPScount = FPScount + 1

-- if (not ping or not fps) then return end
-- local dX,dY,dW,dH = sX-150,35,250,20
-- local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
-- local dX,dY,dW,dH = sX-10,30,sX-20,20
-- local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW-SAFEZONE_X, dH+SAFEZONE_Y
-- dxDrawText( string.gsub( getPlayerName( localPlayer ), "#%x%x%x%x%x%x", "" ), dX-235.5, dY+0.5, dW+0.1, dH, tocolor(0, 0, 0, 255), 1, "clear", "left", "top")
-- dxDrawText( string.gsub( getPlayerName( localPlayer ), "#%x%x%x%x%x%x", "" ), dX-235.1, dY, dW+0.1, dH, tocolor(255, 255, 255, 255), 1, "clear", "left", "top")
-- dxDrawText( string.gsub( getPlayerName( localPlayer ), "#%x%x%x%x%x%x", "" ), dX-235, dY+0.1, dW, dH+0.1, tocolor(255, 255, 255, 255), 1, "clear", "left", "top")
-- dxDrawText( string.gsub( getPlayerName( localPlayer ), "#%x%x%x%x%x%x", "" ), dX-235, dY, dW+0.1, dH, tocolor(255, 255, 255, 255), 1, "clear", "left", "top")
-- dxDrawText("Ping: "..ping.." | FPS: "..fps, dX+1,dY,dW+1,dH, tocolor(0,0,0,100), 1, "clear", "right", "top")
-- dxDrawText("Ping: "..ping.." | FPS: "..fps, dX,dY+1,dW,dH+1, tocolor(0,0,0,100), 1, "clear", "right", "top")
-- dxDrawText("Ping: "..ping.." | FPS: "..fps, dX,dY,dW,dH, tocolor(255,255,255,255), 1, "clear", "right", "top")
--end
--addEventHandler("onClientRender", root, renderFPSandPing)


-- Wanted Level
---------------->>

local wantedOff = 0
function renderWantedLevel()
if (isPlayerMapVisible() or not hudEnabled) then return end
local wanted = getPlayerWantedLevel()
if (wanted == 0) then wantedOff = 0 return end
wantedOff = 35

local DIST_BTWN_STARS = 216/6
local dX,dY,dW,dH = sX-33,37,30,29
local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH

active = "wanted/wanted_active2.png"

local total_stars = 0
local active_stars = 0
for i=1,wanted do
dxDrawImage(dX-(total_stars*DIST_BTWN_STARS), dY, dW, dH, active)
total_stars = total_stars + 1
active_stars = active_stars + 1
end
for i=1,6-active_stars do
dxDrawImage(dX-(total_stars*DIST_BTWN_STARS), dY, dW, dH, "wanted/wanted_inactive.png")
total_stars = total_stars + 1
end
end
addEventHandler("onClientRender", root, renderWantedLevel)

-- Money
--------->>
local SAFEZONE_X = sX*0.05
local SAFEZONE_Y = sY*0.05
local moneyY = 0
function renderMoney()
if (isPlayerMapVisible() or not hudEnabled) then return end

                --# Para
                local moneyY = 0
                local SAFEZONE_X = sX*0.06
                local SAFEZONE_Y = sY*0.08
                local cash = ("%008d"):format(getPlayerMoney(getLocalPlayer()))
                cash = cash
                local r1,g1,b1
                if (getPlayerMoney() >= 0) then
                r1,g1,b1 = 255,255,255
                else
                cash = string.gsub(cash, "%D", "")
                cash = "-₺"..cash
                r1,g1,b1 = 180,25,29
                end
                local dX,dY,dW,dH = sX-6,28+moneyY,sX+50,30
                local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW-SAFEZONE_X, dH+SAFEZONE_Y
                dxDrawText(cash, dX+2,dY-2,dW,dH, tocolor(0,0,0,255), 0.70, "pricedown", "right")
                dxDrawText(cash, dX,dY+2,dW,dH+2, tocolor(0,0,0,255), 0.70, "pricedown", "right")
                dxDrawText(cash, dX-2,dY,dW-2,dH, tocolor(0,0,0,255), 0.70, "pricedown", "right")
                dxDrawText(cash, dX,dY-2,dW,dH-2, tocolor(0,0,0,255), 0.70, "pricedown", "right")
                dxDrawText(cash, dX,dY,dW,dH, tocolor(r1,g1,b1,255), 0.70, "pricedown", "right")
               

                --# Silah
                local weapon = getPedWeapon(localPlayer)
                local clip = getPedAmmoInClip(localPlayer)
                local ammo = getPedTotalAmmo(localPlayer)
                if (weapon == 0 or weapon == 1 or ammo == 0) then moneyY = 0 return end
        moneyY = 35
                local len = #tostring(clip)
                if string.find(tostring(clip), 1) then len = len - 0.5 end
                local xoff = (len*17) + 10
       
                local len2 = #tostring(ammo-clip)
                if string.find(tostring(ammo-clip), 1) then len2 = len2 - 0.5 end
                local weapLen = ((len+len2)*17) + 20
               
                if (weapon >= 15 and weapon ~= 40 and weapon <= 44 or weapon >= 46) then
                local dX,dY,dW,dH = sX-4,05,sX-75,-10
                local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW-SAFEZONE_X, dH+SAFEZONE_Y
                dxDrawText(clip, dX+2,dY,dW+2,dH, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(clip, dX,dY+2,dW,dH+2, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(clip, dX-2,dY,dW-2,dH, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(clip, dX,dY-2,dW,dH-2, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(clip, dX,dY,dW,dH, tocolor(110,110,110,255), 0.50, "pricedown", "right")
                -- Total Ammo
                local dX,dY,dW,dH = sX-4-xoff,05,sX-60-xoff,-10
                local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW-SAFEZONE_X, dH+SAFEZONE_Y
                dxDrawText(ammo-clip, dX+2-xoff,dY,dW+2,dH, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(ammo-clip, dX,dY+2,dW,dH+2, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(ammo-clip, dX-2,dY,dW-2,dH, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(ammo-clip, dX,dY-2,dW,dH-2, tocolor(0,0,0,255), 0.50, "pricedown", "right")
                dxDrawText(ammo-clip, dX,dY,dW,dH, tocolor(220,220,220,255), 0.50, "pricedown", "right")
                else
                xoff = 0
                weapLen = 0
                end
                if (weapon == 0 or weapon == 1) then return end
                local img = "weaps/"..weapon..".png"
                local dX,dY,dW,dH = sX-160-weapLen,-45,150,50
                local dX,dY,dW,dH = dX-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH
                dxDrawImage(dX, dY, dW, dH, img)
end
addEventHandler("onClientRender", root, renderMoney)

function addOutlines(screenW, screenH, width, height, lineColor, lineSize, postGUI)
    dxDrawLine(screenW - 1, (screenH - lineSize), screenW - 1, screenH + height + (lineSize - 1), lineColor, lineSize, postGUI); --left
    dxDrawLine(screenW + width, (screenH) - 1, (screenW) - 1, (screenH) - 1, lineColor, lineSize, postGUI); -- top
    dxDrawLine((screenW) - 1, screenH + height, screenW + width, screenH + height, lineColor, lineSize, postGUI); -- bottom
    dxDrawLine(screenW + width, screenH - lineSize, screenW + width, screenH + height + (lineSize - 1), lineColor, lineSize, postGUI); -- right
end


function renderGTIVersion()
local dX,dY,dW,dH = sX-87,sY,sX-87,sY
dxDrawText(SERVER_NAME.." |", dX,dY,dW,dH, tocolor(255,255,255,100), 1, "default", "right", "bottom")
end
addEventHandler("onClientRender", root, renderGTIVersion)

setTimer(function()
SERVER_NAME = "[DG] Freeroam | "..#getElementsByType("player").."/"..getElementData(root, "max_players").." Oyuncu"
end, 15000, 0)

addEventHandler( "onClientRender", root,
function()
local fFont = ( F_SCREEN_X / F_RES_X ) * 0.70

local Time = getRealTime();
local iHours = Time.hour;
local iMinutes = Time.minute;



                local dX,dY,dW,dH = sX-150,63,1715,20
        local dX,dY,dW,dH = sX-263-SAFEZONE_X, dY+SAFEZONE_Y, dW, dH

--dxDrawText("Saat: " .. iHours .. ":" .. iMinutes, dX+2,dY-2,dW,dH, tocolor(0,0,0,255), 0.70, "pricedown", "right")
--dxDrawText("Saat: " .. iHours .. ":" .. iMinutes, dX,dY+2,dW,dH+2, tocolor(0,0,0,255), 0.70, "pricedown", "right")
dxDrawText("Saat: " .. iHours .. ":" .. iMinutes, dX-2,dY,dW-2,dH, tocolor(0,0,0,255), 0.70, "pricedown", "right")
dxDrawText("Saat: " .. iHours .. ":" .. iMinutes, dX,dY-2,dW,dH-2, tocolor(0,0,0,255), 0.70, "pricedown", "right")
dxDrawText( "Saat: " .. iHours .. ":" .. iMinutes, dX,dY-2,dW,dH-2, tocolor(255, 255, 255, 255), 0.70, "pricedown", "right")
end)

addEventHandler( "onClientRender", root,
function()
iFrames = iFrames + 1;
if getTickCount() - iStartTick >= 1000 then
iFPS = iFrames;
iFrames = 0;
iStartTick = getTickCount();
end
end
);

addEventHandler( "onClientRender", root,
function()
local fFont = ( F_SCREEN_X / F_RES_X ) * 1

dxDrawText(
"FPS: " .. GetFPS(),

0.01 * F_SCREEN_X,  -- X
0.997 * F_SCREEN_Y,  -- Y

0.01 * F_SCREEN_X,  -- X
0.997 * F_SCREEN_Y,  -- Y

tocolor( 178, 178, 178, 255 ), -- Цвет

fFont,

"default-bold",

"left",
"bottom"
);
end
);


Ekrana göre kaymalar yapıyor yardımcı olurmusunuz
« Son Düzenleme: 30 Ağustos 2019, 23:05:23 Gönderen: Narkoz »
 


MTASATURK

[YARDIM] Hudu Ekrana Göre Kayma
« : 02 Ağustos 2019, 22:52:12 »