Jump to content

dxDrawText help me


Zinjaaa

Recommended Posts

Posted

How I can add text of this information panel?

Besides I want a call letter font (Impact).

I really really appreciate it if you guys teach me

¿Cómo puedo añadir texto de este panel de información?

Además quiero un tipo de letra llamada (Impacto).

Yo realmente apreciaría si ustedes me enseñan

--------------------------------> http://tinypic.com/view.php?pic=15p5xyu&s=5 <--------------------------------

Posted (edited)
dxCreateFont -- creates custom font 
dxDrawText --draw text 

You can write an example?

not guided me a lot with the examples of the wiki.

Edited by Guest
Posted

ok,

Wiki Example:

local myFont = nil 
  
-- Display text using dxDrawText 
addEventHandler( "onClientRender", root, 
    function() 
        if myFont then 
            dxDrawText( "dxDrawText", 100, 350, 300, 350, tocolor(255,255,0), 1, myFont ) 
        end 
    end 
) 
  
-- Use 'toggle' command to switch custom font on and off 
addCommandHandler( "toggle", 
    function() 
        if not myFont then 
            myFont = dxCreateFont( "segoeui.ttf", 20 )  -- Create custom font 
        else         
            destroyElement( myFont )                    -- Destroy custom font 
            myFont = nil 
        end 
    end 
) 

Posted (edited)

Wow, ok

local sw,sh = guiGetScreenSize() 
local font = dxCreateFont("impact.ttf") --creates font 
--creates a text using the customed font in the middle of the screen 
dxDrawText( "THIS IS MY NEW FONT!!!", sw/2 - 200, sh/2 - 200, 200, 200, tocolor(0,255,0), 1, font ) 

Edited by Guest
Posted

This does not work. help me

local isPlayerViewingImage = false; 
local sx, sy = guiGetScreenSize ( ) 
function dxDrawTheImage ( ) 
    if ( isPlayerViewingImage ) then 
        dxDrawImage ( 240, 145, 550, 480, "window.png" ) 
  
    end 
end 
  
bindKey("f9", "down", 
function() 
  
    addEventHandler ( "onClientRender", root, dxDrawTheImage ) 
    isPlayerViewingImage = not isPlayerViewingImage 
     
end ) 
  
local sw,sh = guiGetScreenSize() 
local font = dxCreateFont("impact.ttf",) --creates font 
--creates a text using the customed font in the middle of the screen 
 dxDrawText( "THIS IS MY NEW FONT!!!", sw/2 - 1024, sh/2 - 768, 175, 80, tocolor(255,255,255), 1, myFont ) 

Posted

This should work:

local isPlayerViewingPanel = false 
local sw,sh = guiGetScreenSize() 
local font = dxCreateFont("impact.ttf") --creates font 
  
function dxDrawTheImage ( ) 
    if isPlayerViewingPanel then 
        dxDrawImage ( 240, 145, 550, 480, "window.png" ) 
        dxDrawText( "THIS IS MY NEW FONT!!!", sw/2 - 1024, sh/2 - 768, 175, 80, tocolor(255,255,255), 1, font ) 
    end 
end 
addEventHandler ( "onClientRender", root, dxDrawTheImage ) 
  
bindKey("f9", "down",function() 
    isPlayerViewingPanel = not isPlayerViewingPanel 
end) 

and make sure you have the font in the same folder as this script!!!

Posted
make sure you have the font in the same folder as this script!!!

And make sure the image.png is there too!!!

  
local isPlayerViewingPanel = false 
local sw,sh = guiGetScreenSize() 
local font = dxCreateFont("impact.ttf") --creates font 
  
function dxDrawTheImage ( ) 
    if isPlayerViewingPanel then 
        dxDrawImage (240, 145, 550, 480, "window.png" ) 
        dxDrawText( "THIS IS MY NEW FONT!!!", sw/2 - 1024, sh/2 - 768, sw/2 + 175, sh/2 + 80, tocolor(255,255,255), 1, font ) 
    end 
end 
addEventHandler ( "onClientRender", root, dxDrawTheImage ) 
  
bindKey("f9", "down",function() 
    isPlayerViewingPanel = not isPlayerViewingPanel 
end) 

Try this and if it doens't work please describe what's not working!

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