Jump to content

Help in dxDrawImg !


X-SHADOW

Recommended Posts

Posted

dxDrawImage requires "onClientRender" event in order to work.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Castillo

I alredy Tried onClientRender + onClientPerRender + onClientResourceStart + onClientPlayerDamage !

i have set my health to 50 and 10

no images shown ?

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

  • Moderators
Posted (edited)

You also don't update the health. This isn't your code right?

-- local localPlayer = getLocalPlayer() -- not needed 
local screenWidth, screenHeight = guiGetScreenSize() 
local ax, ay = screenWidth - 34, 0  
addEventHandler ( "onClientRender", root, 
function () 
    local health = getElementHealth( localPlayer ) 
    if (health <= 50) then 
            dxDrawImage(ax,ay,32,37,"images/lowhp.png") 
            if (health <= 10) then 
                local getTickStart = getTickCount () 
                getTickStart = math.floor(getTickStart / 1000) 
                if math.mod(getTickStart, 2) == 0 then 
                    dxDrawImage(ax,ay+37,32,37,"images/bleeding.png") 
                end 
            end 
           -- ax = ax - 34 -- wtf? fly down?  
        end 
    end 
end) 

Edited by Guest

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted (edited)

local screenWidth, screenHeight = guiGetScreenSize() 
local health = getElementHealth( localPlayer ) 
local ax, ay = screenWidth - 34, 0 
function xxx() 
 ax = ax -34 
    if (health <= 50) then 
             dxDrawImage(ax,ay,32,37,"images/lowhp.png") 
            if (health <= 10) then 
                local getTickStart = getTickCount () 
                getTickStart = math.floor(getTickStart / 1000) 
                if math.mod(getTickStart, 2) == 0 then 
                dxDrawImage(ax,ay+37,32,37,"images/bleeding.png") 
                end 
            end 
        end 
    end 
addEventHandler('onClientPlayerDamage', root,xxx) 
addEventHandler("onClientRender",root,xxx) 
Edited by Guest

  

Posted

No i found it on another scripting site

the image is shown but show flying form right to left then dispeer !

i need it shown under the orgnial mta hud or next to radar ?

------------------

#Mr.Pres[T]ege your code dont show the image !

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

  • Moderators
Posted
the image is shown but show flying form right to left then dispeer !

I wrote this before, and I disable it after I noticed what would happen, not my mistake.......

-- ax = ax - 34 -- wtf? fly down?

try again my sample.

Do you want to improve your Lua programming skills and make less mistakes?   Start with Lua Language Server!   🙀

 

  Useful functions  3x 

  Tutorials  4x 

 

Posted

My One Should Work And The image Moving Up I Saw It

:P .

Your code contains unnecessary events.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

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...