Jump to content

dxDrawText doesn't work


Recommended Posts

Why this function doesn't work?

showPlayerHudComponent("clock", false) 
  
function updateHud() 
    --outputChatBox("function test") -- It works 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local sx, sy = screenWidth/1400, screenHeight/900 
    local realtime = getRealTime() 
    local hour = realtime.hour 
    local minute = realtime.minute 
    local timestring = string.format("%i:%i", hour, minute) 
    dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, 0xFFFFFF, 140*sx, 148*sy) 
end 
  
function timeHudF() 
    --outputChatBox("culo") -- It works 
    addEventHandler("onClientRender", getRootElement(), updateHud)   
end 
  
addEvent("timeHud", true) 
addEventHandler("timeHud", getRootElement(), timeHudF) 

The function timeHud is called from the server, and all works, but if I add the last 3 parameters to dxDrawText, it doesn't work.

I wanna set the font bigger than how is presented by default.

Link to comment
  • Administrators

You should read the wiki variables before asking here. Anyway this is the fix.:

  
showPlayerHudComponent("clock", false) 
  
function updateHud() 
    --outputChatBox("function test") -- It works 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local sx, sy = screenWidth/1400, screenHeight/900 
    local realtime = getRealTime() 
    local hour = realtime.hour 
    local minute = realtime.minute 
    local timestring = string.format("%i:%i", hour, minute) 
    dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, tocolor(255,255,255,255), 2, "default") 
end 
  
function timeHudF() 
    --outputChatBox("culo") -- It works 
    addEventHandler("onClientRender", getRootElement(), updateHud)  
end 
  
addEvent("timeHud", true) 
addEventHandler("timeHud", getRootElement(), timeHudF) 

Link to comment
You should read the wiki variables before asking here. Anyway this is the fix.:
  
showPlayerHudComponent("clock", false) 
  
function updateHud() 
    --outputChatBox("function test") -- It works 
    local screenWidth, screenHeight = guiGetScreenSize() 
    local sx, sy = screenWidth/1400, screenHeight/900 
    local realtime = getRealTime() 
    local hour = realtime.hour 
    local minute = realtime.minute 
    local timestring = string.format("%i:%i", hour, minute) 
    dxDrawText(timestring, 1229*sx, 56*sy, 140*sx, 148*sy, tocolor(255,255,255,255), 2, "default") 
end 
  
function timeHudF() 
    --outputChatBox("culo") -- It works 
    addEventHandler("onClientRender", getRootElement(), updateHud)  
end 
  
addEvent("timeHud", true) 
addEventHandler("timeHud", getRootElement(), timeHudF) 

Thanks, it works.

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