Jump to content

Help with font on my script


Evil-Cod3r

Recommended Posts

Hi all i made this but the font not work !

addEvent("Enter",true) 
addEventHandler("Enter",getRootElement(), 
function(name) 
    if isElement(jon) and isElement(p_name) then 
    restTimer(pn) 
    restTimer(jn) 
    guiSetText(p_name,tostring(name)) 
    else 
    jon = guiCreateLabel(14,197,38,14," Joined: ",false) 
    p_name = guiCreateLabel(59, 198, 227, 17,tostring(name),false) 
    pn = setTimer(destroyElement,22000,1,p_name) 
                jn = setTimer(destroyElement,22000,1,jon) 
        end 
end) 
  
function start () 
            myFont = guiCreateFont( "font/20.ttf", 12 ) 
            guiSetFont( jon, myFont ) 
        else         
            destroyElement( myFont ) 
            myFont = nil 
        end 
    end 
end 
addEventHandler("onClientResourceStart",getRootElement(), start ) 

Link to comment
addEventHandler("onClientResourceStart",resourceRoot, 
    function () 
        myFont = guiCreateFont( "font/20.ttf", 12 ) 
    end 
) 
  
addEvent("Enter",true) 
addEventHandler("Enter",getRootElement(), 
    function(name) 
        if isElement(jon) and isElement(p_name) then 
            restTimer(pn) 
            restTimer(jn) 
            guiSetText(p_name,tostring(name)) 
        else 
            jon = guiCreateLabel(14,197,38,14," Joined: ",false) 
            guiSetFont( jon, myFont ) 
            p_name = guiCreateLabel(59, 198, 227, 17,tostring(name),false) 
            pn = setTimer(destroyElement,22000,1,p_name) 
            jn = setTimer(destroyElement,22000,1,jon) 
        end 
    end 
) 

Link to comment

So, you need add this files to meta.xml

Simple script:

  
local text,anim 
  
local function Remove ( ) 
    text:color( 0, 0, 0, 0 ) 
    text:destroy() 
    text = nil 
    anim:remove() 
    anim = nil 
end 
  
addCommandHandler( 'simple', 
    function( ) 
        if text then  
            Remove( )  
        end 
        text = dxText:create(  
            "Text", 
            650.0, 
            91.0,  
            false,  
            'default', 
            2,  
            'center'  
        ) 
        text:align("center", "center") 
        text:type( 'stroke' ) 
        text:color( 255,0,0,255 ) 
        anim = Animation.createAndPlay( 
            text, 
            Animation.presets.dxTextFadeOut( 5000 ), 
            Remove 
        ) 
    end 
)    
  

type /simple and this text shows only 5 sec and destroy.

Edited by Guest
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...