Jump to content

Custom font


Blinker.

Recommended Posts

Hello folks,

i'm using a custom font to draw a vehicle's health ,but i got 2 problems ,

1 - it lags when the number changes like if i had 99% hp and i hit someone it will go down to 90 % and here it lags for 1 sec

2 - when the number changes also , a line is drawn under the number like in this photo :

http://imgur.com/9PlrSfz

nothing more to say.. i've tried bangothic font and it works with 0 lag.

any help would be greatly appreciated.

Link to comment
  
local font = dxCreateFont( "font.ttf",19 ) 
  
function render() 
  
local vehicle = getPedOccupiedVehicle(localPlayer) 
local health = math.round(((getElementHealth(vehicle)-250)/750*100),0) 
local speed = getElementSpeed(vehicle) 
  
if health <= 0 then 
health = 0 
end 
  
  
dxDrawImage ( sw-118, sh/1.15,110,70, 'progress_health_bg.png') 
dxDrawImage ( sw-118, sh/1.15,speed,70, 'progress_speed.png') 
    dxDrawText(health.."%", sw-118, (sh/1.15)+5,sw-6,1,tocolor(r,g,b,255),1,font,"right") 
  
  
  
  
end 
addEventHandler("onClientRender",root,render) 
  

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