Jump to content

help


WASSIm.

Recommended Posts

hi guys i have problem

idk why show me my helth if restart script and Rectangle move and dont change color and if change dxDrawText in center show me in center screen :!:

local playerHealth = getElementHealth ( getLocalPlayer() ) 
  
addEventHandler( "onClientRender", getRootElement(), 
    function () 
            local currenthealth = math.floor(playerHealth) 
if ( playerHealthcolor ) then 
                HealthColor = math.max(playerHealth - 250, 0)/750 
                HealthColorMath = -510*(HealthColor^2) 
                rh, gh = math.max(math.min(HealthColorMath + 255*HealthColor + 255, 255), 0), math.max(math.min(HealthColorMath + 765*HealthColor, 255), 0) 
            end 
           if ( playerHealth ) then 
                dxDrawRectangle(hx1, hy1, hx2, hy2,tocolor(0,0,0,150),false) 
                dxDrawRectangle(hx3, hy3, hx4, hy4,tocolor(rh,gh,0,170),false) 
                dxDrawImage(hx5-150, hy5+1, hx6, hy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                dxDrawText(""..tostring(currenthealth).."%",hx3+100, hy3-2, hx4, hy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end 
end 
) 

Link to comment
local sx,sy = guiGetScreenSize() 
local playerHealth = getElementHealth ( getLocalPlayer() ) 
local playerArmor = getPlayerArmor (getLocalPlayer()) 
local hour, minutes = getTime(getLocalPlayer()) 
local money = getPlayerMoney(getLocalPlayer() )   
local wanted = getPlayerWantedLevel ( getLocalPlayer() ) 
  
  
addEventHandler( "onClientRender", getRootElement(), 
    function () 
-------------------- health 
                hx1, hy1, hx2, hy2 = sx*(1205.0/1440),sy*(157.0/900),sx*(232.0/1440),sy*(27.0/900) 
                hx3, hy3, hx4, hy4 = sx*(1209.0/1440),sy*(161.0/900),playerHealth*sx*(224.0/1440)/100,sy*(19.0/900) 
                hx5, hy5, hx6, hy6 = sx*(1302.0/1440),sy*(150.0/900),sx*(40.0/1440),sy*(40.0/900) 
-------------------- Armor 
                ax1, ay1, ax2, ay2 = sx*(1205.0/1440),sy*(197.0/900),sx*(232.0/1440),sy*(27.0/900) 
                ax3, ay3, ax4, ay4 = sx*(1209.0/1440),sy*(201.0/900),playerArmor*sx*(224.0/1440)/100,sy*(19.0/900) 
                ax5, ay5, ax6, ay6 = sx*(1310.0/1440),sy*(202.0/900),sx*(23.0/1440),sy*(20.0/900) 
--------------------time 
                tx1, ty1, tx2, ty2 = sx*(1205.0/1440),sy*(235.0/900),sx*(232.0/1440),sy*(27.0/900) 
                tx5, ty5, tx6, ty6 = sx*(1310.0/1440),sy*(238.0/900),sx*(20.0/1440),sy*(20.0/900) 
--------------------money 
                mx1, my1, mx2, my2 = sx*(1205.0/1440),sy*(275.0/900),sx*(232.0/1440),sy*(27.0/900) 
                mx5, my5, mx6, my6 = sx*(1310.0/1440),sy*(278.0/900),sx*(20.0/1440),sy*(20.0/900) 
--------------------wanted 
                wx1, wy1, wx2, wy2 = sx*(1205.0/1440),sy*(315.0/900),sx*(232.0/1440),sy*(27.0/900) 
                wx5, wy5, wx6, wy6 = sx*(1310.0/1440),sy*(314.0/900),sx*(20.0/1440),sy*(20.0/900) 
             
            local currenthealth = math.floor(playerHealth) 
            local currentarmor = math.floor(playerArmor) 
  
  
            if ( playerHealthcolor ) then 
                HealthColor = math.max(playerHealth - 250, 0)/750 
                HealthColorMath = -510*(HealthColor^2) 
                rh, gh = math.max(math.min(HealthColorMath + 255*HealthColor + 255, 255), 0), math.max(math.min(HealthColorMath + 765*HealthColor, 255), 0) 
            end 
  
            if ( playerArmorcolor ) then 
                ArmorColor = math.max(playerArmor - 250, 0)/750 
                ArmorColorMath = -510*(ArmorColor^2) 
                ra, ga = math.max(math.min(ArmorColorMath + 255*ArmorColor + 255, 255), 0), math.max(math.min(ArmorColorMath + 765*ArmorColor, 255), 0) 
            end 
  
            if ( playerHealth ) then 
                dxDrawRectangle(hx1, hy1, hx2, hy2,tocolor(0,0,0,150),false) 
                dxDrawRectangle(hx3, hy3, hx4, hy4,tocolor(rh,gh,0,170),false) 
                dxDrawImage(hx5-150, hy5+1, hx6, hy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                                                                                dxDrawText(""..tostring(currenthealth).."%",hx3+100, hy3-2, hx4, hy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end 
  
            if ( playerArmor ) then 
                dxDrawRectangle(ax1, ay1, ax2, ay2,tocolor(0,0,0,150),false) 
                dxDrawRectangle(ax3, ay3, ax4, ay4,tocolor(ra,ga,0,170),false) 
                dxDrawImage(ax5-150, ay5+1, ax6, ay6,"images/armor.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                                                                                dxDrawText(""..tostring(currentarmor).."%",ax3+100, ay3-2, ax4, ay4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end 
  
            if ( hour ) then 
                dxDrawRectangle(tx1, ty1, tx2, ty2,tocolor(0,0,0,150),false) 
                dxDrawImage(tx5-150, ty5+1, tx6, ty6,"images/time.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                                                                                dxDrawText(""..tostring(hour)..":"..tostring(minutes).."",tx1+100, ty1+2, tx2, ty4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end 
  
            if ( money ) then 
                dxDrawRectangle(mx1, my1, mx2, my2,tocolor(0,0,0,150),false) 
                dxDrawImage(mx5-150, my5+1, mx6, my6,"images/money.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                                                                                dxDrawText("$"..tostring(money).."",mx1+100, my1+2, mx2, my4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end 
  
            if ( wanted ) then 
                dxDrawRectangle(wx1, wy1, wx2, wy2,tocolor(0,0,0,150),false) 
                dxDrawImage(wx5-150, wy5+1, wx6, wy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
                                                                                dxDrawText(""..tostring(wanted).."",wx1+100, wy1+2, wx2, wy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
            end       
end 
) 

Link to comment
local sx,sy = guiGetScreenSize ( ) 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local playerHealth = math.floor ( getElementHealth ( localPlayer ) ) 
        local playerArmor = math.floor ( getPedArmor ( localPlayer ) ) 
        local hour, minutes = getTime ( ) 
        local money = getPlayerMoney ( ) 
        local wanted = getPlayerWantedLevel ( ) 
        -------------------- health 
        local hx1, hy1, hx2, hy2 = sx*(1205.0/1440),sy*(157.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local hx3, hy3, hx4, hy4 = sx*(1209.0/1440),sy*(161.0/900),playerHealth*sx*(224.0/1440)/100,sy*(19.0/900) 
        local hx5, hy5, hx6, hy6 = sx*(1302.0/1440),sy*(150.0/900),sx*(40.0/1440),sy*(40.0/900) 
        -------------------- Armor 
        local ax1, ay1, ax2, ay2 = sx*(1205.0/1440),sy*(197.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local ax3, ay3, ax4, ay4 = sx*(1209.0/1440),sy*(201.0/900),playerArmor*sx*(224.0/1440)/100,sy*(19.0/900) 
        local ax5, ay5, ax6, ay6 = sx*(1310.0/1440),sy*(202.0/900),sx*(23.0/1440),sy*(20.0/900) 
        --------------------time 
        local tx1, ty1, tx2, ty2 = sx*(1205.0/1440),sy*(235.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local tx5, ty5, tx6, ty6 = sx*(1310.0/1440),sy*(238.0/900),sx*(20.0/1440),sy*(20.0/900) 
        --------------------money 
        local mx1, my1, mx2, my2 = sx*(1205.0/1440),sy*(275.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local mx5, my5, mx6, my6 = sx*(1310.0/1440),sy*(278.0/900),sx*(20.0/1440),sy*(20.0/900) 
        --------------------wanted 
        local wx1, wy1, wx2, wy2 = sx*(1205.0/1440),sy*(315.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local wx5, wy5, wx6, wy6 = sx*(1310.0/1440),sy*(314.0/900),sx*(20.0/1440),sy*(20.0/900) 
  
        if ( playerHealthcolor ) then 
            HealthColor = math.max(playerHealth - 250, 0)/750 
            HealthColorMath = -510*(HealthColor^2) 
            rh, gh = math.max(math.min(HealthColorMath + 255*HealthColor + 255, 255), 0), math.max(math.min(HealthColorMath + 765*HealthColor, 255), 0) 
        end 
  
        if ( playerArmorcolor ) then 
            ArmorColor = math.max(playerArmor - 250, 0)/750 
            ArmorColorMath = -510*(ArmorColor^2) 
            ra, ga = math.max(math.min(ArmorColorMath + 255*ArmorColor + 255, 255), 0), math.max(math.min(ArmorColorMath + 765*ArmorColor, 255), 0) 
        end 
  
        if ( playerHealth ) then 
            dxDrawRectangle(hx1, hy1, hx2, hy2,tocolor(0,0,0,150),false) 
            dxDrawRectangle(hx3, hy3, hx4, hy4,tocolor(rh,gh,0,170),false) 
            dxDrawImage(hx5-150, hy5+1, hx6, hy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(currenthealth).."%",hx3+100, hy3-2, hx4, hy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( playerArmor ) then 
            dxDrawRectangle(ax1, ay1, ax2, ay2,tocolor(0,0,0,150),false) 
            dxDrawRectangle(ax3, ay3, ax4, ay4,tocolor(ra,ga,0,170),false) 
            dxDrawImage(ax5-150, ay5+1, ax6, ay6,"images/armor.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(currentarmor).."%",ax3+100, ay3-2, ax4, ay4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( hour ) then 
            dxDrawRectangle(tx1, ty1, tx2, ty2,tocolor(0,0,0,150),false) 
            dxDrawImage(tx5-150, ty5+1, tx6, ty6,"images/time.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(hour)..":"..tostring(minutes).."",tx1+100, ty1+2, tx2, ty4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( money ) then 
            dxDrawRectangle(mx1, my1, mx2, my2,tocolor(0,0,0,150),false) 
            dxDrawImage(mx5-150, my5+1, mx6, my6,"images/money.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText("$"..tostring(money).."",mx1+100, my1+2, mx2, my4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( wanted ) then 
            dxDrawRectangle(wx1, wy1, wx2, wy2,tocolor(0,0,0,150),false) 
            dxDrawImage(wx5-150, wy5+1, wx6, wy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(wanted).."",wx1+100, wy1+2, wx2, wy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end       
    end 
) 

Link to comment

nothing. i think problem here

           if ( playerHealthcolor ) then 
                HealthColor = math.max(playerHealth - 250, 0)/750 
                HealthColorMath = -510*(HealthColor^2) 
                rh, gh = math.max(math.min(HealthColorMath + 255*HealthColor + 255, 255), 0), math.max(math.min(HealthColorMath + 765*HealthColor, 255), 0) 
            end 
  
            if ( playerArmorcolor ) then 
                ArmorColor = math.max(playerArmor - 250, 0)/750 
                ArmorColorMath = -510*(ArmorColor^2) 
                ra, ga = math.max(math.min(ArmorColorMath + 255*ArmorColor + 255, 255), 0), math.max(math.min(ArmorColorMath + 765*ArmorColor, 255), 0) 
            end 

Link to comment

That's because you are checking a non-existant variable to set the color.

local sx,sy = guiGetScreenSize ( ) 
  
addEventHandler ( "onClientRender", root, 
    function ( ) 
        local playerHealth = math.floor ( getElementHealth ( localPlayer ) ) 
        local playerArmor = math.floor ( getPedArmor ( localPlayer ) ) 
        local hour, minutes = getTime ( ) 
        local money = getPlayerMoney ( ) 
        local wanted = getPlayerWantedLevel ( ) 
        -------------------- health 
        local hx1, hy1, hx2, hy2 = sx*(1205.0/1440),sy*(157.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local hx3, hy3, hx4, hy4 = sx*(1209.0/1440),sy*(161.0/900),playerHealth*sx*(224.0/1440)/100,sy*(19.0/900) 
        local hx5, hy5, hx6, hy6 = sx*(1302.0/1440),sy*(150.0/900),sx*(40.0/1440),sy*(40.0/900) 
        -------------------- Armor 
        local ax1, ay1, ax2, ay2 = sx*(1205.0/1440),sy*(197.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local ax3, ay3, ax4, ay4 = sx*(1209.0/1440),sy*(201.0/900),playerArmor*sx*(224.0/1440)/100,sy*(19.0/900) 
        local ax5, ay5, ax6, ay6 = sx*(1310.0/1440),sy*(202.0/900),sx*(23.0/1440),sy*(20.0/900) 
        --------------------time 
        local tx1, ty1, tx2, ty2 = sx*(1205.0/1440),sy*(235.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local tx5, ty5, tx6, ty6 = sx*(1310.0/1440),sy*(238.0/900),sx*(20.0/1440),sy*(20.0/900) 
        --------------------money 
        local mx1, my1, mx2, my2 = sx*(1205.0/1440),sy*(275.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local mx5, my5, mx6, my6 = sx*(1310.0/1440),sy*(278.0/900),sx*(20.0/1440),sy*(20.0/900) 
        --------------------wanted 
        local wx1, wy1, wx2, wy2 = sx*(1205.0/1440),sy*(315.0/900),sx*(232.0/1440),sy*(27.0/900) 
        local wx5, wy5, wx6, wy6 = sx*(1310.0/1440),sy*(314.0/900),sx*(20.0/1440),sy*(20.0/900) 
  
        local HealthColor = math.max(playerHealth - 250, 0)/750 
        local HealthColorMath = -510*(HealthColor^2) 
        local rh, gh = math.max(math.min(HealthColorMath + 255*HealthColor + 255, 255), 0), math.max(math.min(HealthColorMath + 765*HealthColor, 255), 0) 
  
        local ArmorColor = math.max(playerArmor - 250, 0)/750 
        local ArmorColorMath = -510*(ArmorColor^2) 
        local ra, ga = math.max(math.min(ArmorColorMath + 255*ArmorColor + 255, 255), 0), math.max(math.min(ArmorColorMath + 765*ArmorColor, 255), 0) 
  
        if ( playerHealth ) then 
            dxDrawRectangle(hx1, hy1, hx2, hy2,tocolor(0,0,0,150),false) 
            dxDrawRectangle(hx3, hy3, hx4, hy4,tocolor(rh,gh,0,170),false) 
            --dxDrawImage(hx5-150, hy5+1, hx6, hy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(currenthealth).."%",hx3+100, hy3-2, hx4, hy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( playerArmor ) then 
            dxDrawRectangle(ax1, ay1, ax2, ay2,tocolor(0,0,0,150),false) 
            dxDrawRectangle(ax3, ay3, ax4, ay4,tocolor(ra,ga,0,170),false) 
            dxDrawImage(ax5-150, ay5+1, ax6, ay6,"images/armor.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(currentarmor).."%",ax3+100, ay3-2, ax4, ay4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( hour ) then 
            dxDrawRectangle(tx1, ty1, tx2, ty2,tocolor(0,0,0,150),false) 
            dxDrawImage(tx5-150, ty5+1, tx6, ty6,"images/time.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(hour)..":"..tostring(minutes).."",tx1+100, ty1+2, tx2, ty4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( money ) then 
            dxDrawRectangle(mx1, my1, mx2, my2,tocolor(0,0,0,150),false) 
            dxDrawImage(mx5-150, my5+1, mx6, my6,"images/money.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText("$"..tostring(money).."",mx1+100, my1+2, mx2, my4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end 
  
        if ( wanted ) then 
            dxDrawRectangle(wx1, wy1, wx2, wy2,tocolor(0,0,0,150),false) 
            dxDrawImage(wx5-150, wy5+1, wx6, wy6,"images/health.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) 
            dxDrawText(""..tostring(wanted).."",wx1+100, wy1+2, wx2, wy4,tocolor(255,255,255,255),1.6,"sans","left","top",false,false,false) 
        end       
    end 
) 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...