Jump to content

Help on dxtext


xXMADEXx

Recommended Posts

Hey guys, i got this script off of community, but don't like the way it looks. How can i put a black boarder over all the texts?

c.lua

triggerServerEvent ( "onLoadSettings", getRootElement ( ) ) 
  
function toboolean ( v ) if v == "false" then return false elseif v == "true" then return true else return nil end end 
  
addEvent ( "onClientLoadSettings", true ) 
addEventHandler ( "onClientLoadSettings", getRootElement ( ), 
function ( settings ) 
    if type(settings) == "table" then 
        defscale   = settings["scale"] 
        defr       = settings["r"] 
        defg       = settings["g"] 
        defb       = settings["b"] 
        defa       = settings["a"] 
        defdd      = settings["dd"] 
        defscale3d = settings["s3d"] 
        deffont    = settings["f"] 
    end 
end ) 
  
local sx, sy     = guiGetScreenSize ( ) 
local gx         = sx * 0.1 
local gy         = sy * 0.1 
  
local posX    = 0 
local posY    = 0 
local sizeX   = 0 
local sizeY   = 0 
  
local edit    = { } 
local deftext = { } 
  
local win = guiCreateWindow ( 0.0135, 0.315, 0.275, 0.4065, "Create New 3D DirectX Text", true ) 
  
edit[1] = guiCreateEdit ( 0.0410, 0.0990, 0.7590, 0.115, "X",        true, win ) 
edit[2] = guiCreateEdit ( 0.0410, 0.2220, 0.7590, 0.115, "Y",        true, win ) 
edit[3] = guiCreateEdit ( 0.0410, 0.3490, 0.7590, 0.115, "Z",        true, win ) 
edit[4] = guiCreateEdit ( 0.0410, 0.475,  0.9130, 0.115, "Text",     true, win ) 
edit[5] = guiCreateEdit ( 0.0410, 0.5930, 0.9130, 0.115, "Scale",    true, win ) 
edit[6] = guiCreateEdit ( 0.0410, 0.715,  0.2045, 0.115, "R",        true, win ) 
edit[7] = guiCreateEdit ( 0.2590, 0.715,  0.2045, 0.115, "G",        true, win ) 
edit[8] = guiCreateEdit ( 0.4820, 0.715,  0.2045, 0.115, "B",        true, win ) 
edit[9] = guiCreateEdit ( 0.7,    0.715,  0.2045, 0.115, "A",        true, win ) 
  
local create  = guiCreateButton ( 0.0410, 0.8395, 0.45,   0.122, "Create!", true, win ) 
local getPos  = guiCreateButton ( 0.8275, 0.0955, 0.1320, 0.300, "Get XYZ", true, win ) 
local default = guiCreateButton ( 0.5135, 0.8395, 0.2225, 0.125, "Default", true, win ) 
local clear   = guiCreateButton ( 0.75,   0.8395, 0.2090, 0.125, "Clear",   true, win ) 
  
for i, gui in ipairs ( edit ) do deftext[i] = guiGetText ( gui ) end 
  
addEventHandler ( "onClientGUIClick", getPos,  
function ( )  
    local x, y, z = getElementPosition ( getLocalPlayer ( ) ) 
    guiSetText ( edit[1], tostring ( x ) ) 
    guiSetText ( edit[2], tostring ( y ) ) 
    guiSetText ( edit[3], tostring ( z ) ) 
end, false ) 
  
addEventHandler ( "onClientGUIClick", clear,  
function ( )  
    for i, gui in ipairs ( edit ) do 
        guiSetText ( gui, deftext[i] ) 
    end 
end, false ) 
  
addEventHandler ( "onClientGUIClick", default,  
function ( )  
    for i = 1, 3 do if guiGetText ( edit[i] ) == "" or guiGetText ( edit[i] ) == deftext[i] then guiSetText ( edit[i], deftext[i] ) end end 
    guiSetText ( edit[4],  "Text" ) 
    guiSetText ( edit[5],  "1" ) 
    guiSetText ( edit[6],  "0" ) 
    guiSetText ( edit[7],  "255" ) 
    guiSetText ( edit[8],  "0" ) 
    guiSetText ( edit[9],  "255" ) 
end, false ) 
  
addEventHandler ( "onClientGUIClick", create,  
function ( ) 
  
    --Check if the values are OK 
    for i = 1, 3 do if tonumber ( guiGetText ( edit[i] ) ) == nil then outputChatBox ( "The 3D Texts need the position and the text to be created!", 255, 0, 0 ) return end end  
     
    --Create the text 
    local text = createElement ( "text" ) 
    if not text then return end 
     
    --The required arguments 
    local x = tonumber ( guiGetText ( edit[1] ) ) 
    local y = tonumber ( guiGetText ( edit[2] ) ) 
    local z = tonumber ( guiGetText ( edit[3] ) ) 
    local t = guiGetText ( edit[4] ) 
     
    setElementPosition ( text, x,      y, z    ) 
    setElementData     ( text, "text", t, true ) 
     
    --Now the optional 
    ----Color 
    local custom = true 
    for i = 6, 9 do if tonumber ( guiGetText ( edit[i] ) ) == nil then custom = false break end end 
    if custom == true then 
        outputChatBox ( "..." ) 
        local r = tonumber ( guiGetText ( edit[6]  ) ) 
        local g = tonumber ( guiGetText ( edit[7]  ) ) 
        local b = tonumber ( guiGetText ( edit[8]  ) ) 
        local a = tonumber ( guiGetText ( edit[9] ) ) 
        setElementData ( text, "rgba", { r, g, b, a }, true ) 
    end 
     
    ----Scale 
    local s = tonumber ( guiGetText ( edit[5] ) ) 
    if s ~= nil then setElementData ( text, "scale", s, true ) end 
     
    outputChatBox ( "3D DirectX Text sucessfully created!", 0, 255, 0 ) 
    return text 
end, false ) 
  
guiSetVisible ( win, false ) 
showCursor         ( false ) 
guiSetInputEnabled ( false ) 
guiWindowSetSizable ( win, false ) 
  
function dxtextitniga( )  
    guiSetVisible      ( win, not guiGetVisible ( win ) ) 
    showCursor         ( not isCursorShowing ( ) ) 
    guiSetInputEnabled ( not guiGetInputEnabled ( ) ) 
    for i = 1, 11 do guiSetText ( edit[i], deftext[i] ) end 
end ) 
addCommandHandler("createdx", dxtextitniga) 
  
--The 3D Text part 
addEventHandler ( "onClientRender", getRootElement ( ), 
function ( ) 
    --if dedfdd ~= nil then 
        local px, py, pz = getElementPosition ( getLocalPlayer ( ) ) 
        for i, t in ipairs ( getElementsByType ( "text" ) ) do 
         local cx, cy, cz = getElementPosition ( t ) 
            local dist = getDistanceBetweenPoints3D ( px, py, pz, cx, cy, cz ) 
             
            --Check if the distance between player and text drawing distance is same or less 
            if dist <= defdd then 
                local scx, scy = getScreenFromWorldPosition ( cx, cy, cz, -50, true ) 
                local scx2, scy2 = getScreenFromWorldPosition ( cx2, cy2, cz2, -40, true ) 
                if isLineOfSightClear ( px, py, pz, cx, cy, cz, true, false, false, false ) and scx and scy then 
                     
                    --The text default parameters 
                    local alpha   = defa 
                    local r       = defr 
                    local g       = defg 
                    local b       = defb 
                    local scale   = defscale 
                    local scale3d = defscale3d 
                    local font    = deffont 
                     
                    --Custom scale config 
                    if getElementData ( t, "scale", false ) then scale = getElementData ( t, "scale", false ) end 
                     
                    --Scale 3D config 
                    if scale3d == true then scale = scale * ( ( defdd - dist ) / defdd ) end 
                     
                    --Loads the text and stops function if there is no text loaded 
                    local text  = getElementData ( t, "text" ) 
                    if not text or text == "" then return end 
                     
                    --If the text has custom colors, load them 
                    local c     = getElementData ( t, "rgba" ) 
                    if c and type ( c ) == "table" then r = c[1] g = c[2] b = c[3] alpha = c[4] end 
                     
                    --Also the font 
                    local f     = getElementData ( t, "font" ) 
                    if f and type ( f ) == "string" then font = f end 
                     
                    --Draw the text 
                    dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center" ) 
                     
                else alpha = 0  
                end 
            else alpha = 0 
            end 
        end 
    --end 
end ) 
  
--Exported function 
function create3DText ( x, y, z, t, c, f, id ) 
    --Check arguments 
    if not x or not y or not z or not t then return false end 
     
    --Create the text 
    local text = createElement ( "text" ) 
    setElementPosition         ( text, x,      y, z, false ) 
    setElementData             ( text, "text", t, true     ) 
     
    --RGBA Colors 
    if c and type ( c ) == "table" then setElementData ( text, "rgba", { c[1], c[2], c[3], c[4] }, true ) end 
    --Font 
    if f and type ( f ) == "string" then setElementData ( text, "font", f ) end 
    --ID 
    if id and type ( id ) == "string" then setElementID ( text, id ) end 
     
    --If all was OK, returns the text element 
    return text 
end 

s.lua

addEvent ( "onLoadSettings", true ) 
  
function toboolean ( v )  
    if v == "false" then  
        return false  
        elseif v == "true" then  
            return true  
        else  
        return nil  
    end  
end 
  
autoloadtext = toboolean ( get ( getResourceName ( getThisResource ( ) )..".*autoloadtext" ) ) 
  
function loadText ( resource ) 
    if not fileExists ( ":" .. getResourceName ( resource ) .."/texts.xml" ) then return end 
    for i, t in ipairs ( xmlNodeGetChildren ( xmlLoadFile ( ":" .. getResourceName ( resource ) .."/texts.xml" ) ) ) do 
         
        local x  = tonumber ( xmlNodeGetAttribute ( t, "posX" ) ) 
        local y  = tonumber ( xmlNodeGetAttribute ( t, "posY" ) ) 
        local z  = tonumber ( xmlNodeGetAttribute ( t, "posZ" ) ) 
        local tt = xmlNodeGetAttribute ( t, "text" ) 
        if x and y and z and tt then 
            local text = createElement ( "text" ) 
            setElementPosition ( text, tonumber ( x ), tonumber ( y ), tonumber ( z ), false ) 
            setElementData ( text, "text", tt ) 
         
            local r = tonumber ( xmlNodeGetAttribute ( t, "red" ) ) 
            local g = tonumber ( xmlNodeGetAttribute ( t, "green" ) ) 
            local b = tonumber ( xmlNodeGetAttribute ( t, "blue" ) ) 
            local a = tonumber ( xmlNodeGetAttribute ( t, "alpha" ) ) 
            if r and g and b and a then setElementData ( text, "rgba", { r, g, b, a }, true ) end 
             
            local s = tonumber ( xmlNodeGetAttribute ( t, "scale" ) ) 
            if s then setElementData ( text, "scale", s, true ) end 
             
            local f = xmlNodeGetAttribute ( t, "font" ) 
            if f then setElementData ( text, "font", f, true ) end 
        end 
    end 
end 
  
function checkResource ( resource ) 
    if not resource and source then resource = source elseif not resource and not source then return end 
    if resource ~= getThisResource ( ) then loadText ( resource ) 
    elseif autoloadtext then 
        for i, r in ipairs ( getResources ( ) ) do 
            if getResourceState ( r ) == "running" then loadText ( r ) end 
        end 
    end 
end 
  
addEventHandler ( "onResourceStart", getRootElement ( ), loadText ) 
  
--Exported function 
function create3DText ( x, y, z, t, c, f, id ) 
    --Check arguments 
    if not x or not y or not z or not t then return false end 
     
    --Create the text 
    local text = createElement ( "text" ) 
    setElementPosition         ( text, x,      y, z, false ) 
    setElementData             ( text, "text", t, true     ) 
     
    --RGBA Colors 
    if c and type ( c ) == "table" then setElementData ( text, "rgba", { c[1], c[2], c[3], c[4] }, true ) end 
    --Font 
    if f and type ( f ) == "string" then setElementData ( text, "font", f ) end 
    --ID 
    if id and type ( id ) == "string" then setElementID ( text, id ) end 
     
    --If all was OK, returns the text element 
    return text 
end 
  
  
addEventHandler ( "onLoadSettings", getRootElement ( ), 
function ( ) 
local rn    = getResourceName ( getThisResource ( ) ) 
settings = { 
    ["scale"] = tonumber  ( get ( rn..".*scale"        ) ), 
    ["r"]     = tonumber  ( get ( rn..".*red"          ) ), 
    ["g"]     = tonumber  ( get ( rn..".*green"        ) ), 
    ["b"]     = tonumber  ( get ( rn..".*blue"         ) ), 
    ["a"]     = tonumber  ( get ( rn..".*alpha"        ) ), 
    ["dd"]    = tonumber  ( get ( rn..".*drawDistance" ) ), 
    ["s3d"]   = toboolean ( get ( rn..".*scale3D"      ) ), 
    ["f"]     =             get ( rn..".*font"         ), 
} 
triggerClientEvent ( "onClientLoadSettings", getRootElement ( ), settings  ) 
end ) 

Link to comment

You can use this function:

function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
    dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black 
    dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
end 

Link to comment
You can use this function:
function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
    dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black 
    dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
end 

So, should it look like this?

triggerServerEvent ( "onLoadSettings", getRootElement ( ) ) 
  
function toboolean ( v ) if v == "false" then return false elseif v == "true" then return true else return nil end end 
  
addEvent ( "onClientLoadSettings", true ) 
addEventHandler ( "onClientLoadSettings", getRootElement ( ), 
function ( settings ) 
    if type(settings) == "table" then 
        defscale   = settings["scale"] 
        defr       = settings["r"] 
        defg       = settings["g"] 
        defb       = settings["b"] 
        defa       = settings["a"] 
        defdd      = settings["dd"] 
        defscale3d = settings["s3d"] 
        deffont    = settings["f"] 
    end 
end ) 
  
local sx, sy     = guiGetScreenSize ( ) 
local gx         = sx * 0.1 
local gy         = sy * 0.1 
  
local posX    = 0 
local posY    = 0 
local sizeX   = 0 
local sizeY   = 0 
  
local edit    = { } 
local deftext = { } 
  
local win = guiCreateWindow ( 0.0135, 0.315, 0.275, 0.4065, "Create New 3D DirectX Text", true ) 
  
edit[1] = guiCreateEdit ( 0.0410, 0.0990, 0.7590, 0.115, "X",        true, win ) 
edit[2] = guiCreateEdit ( 0.0410, 0.2220, 0.7590, 0.115, "Y",        true, win ) 
edit[3] = guiCreateEdit ( 0.0410, 0.3490, 0.7590, 0.115, "Z",        true, win ) 
edit[4] = guiCreateEdit ( 0.0410, 0.475,  0.9130, 0.115, "Text",     true, win ) 
edit[5] = guiCreateEdit ( 0.0410, 0.5930, 0.9130, 0.115, "Scale",    true, win ) 
edit[6] = guiCreateEdit ( 0.0410, 0.715,  0.2045, 0.115, "R",        true, win ) 
edit[7] = guiCreateEdit ( 0.2590, 0.715,  0.2045, 0.115, "G",        true, win ) 
edit[8] = guiCreateEdit ( 0.4820, 0.715,  0.2045, 0.115, "B",        true, win ) 
edit[9] = guiCreateEdit ( 0.7,    0.715,  0.2045, 0.115, "A",        true, win ) 
  
local create  = guiCreateButton ( 0.0410, 0.8395, 0.45,   0.122, "Create!", true, win ) 
local getPos  = guiCreateButton ( 0.8275, 0.0955, 0.1320, 0.300, "Get XYZ", true, win ) 
local default = guiCreateButton ( 0.5135, 0.8395, 0.2225, 0.125, "Default", true, win ) 
local clear   = guiCreateButton ( 0.75,   0.8395, 0.2090, 0.125, "Clear",   true, win ) 
  
for i, gui in ipairs ( edit ) do deftext[i] = guiGetText ( gui ) end 
  
addEventHandler ( "onClientGUIClick", getPos,  
function ( )  
    local x, y, z = getElementPosition ( getLocalPlayer ( ) ) 
    guiSetText ( edit[1], tostring ( x ) ) 
    guiSetText ( edit[2], tostring ( y ) ) 
    guiSetText ( edit[3], tostring ( z ) ) 
end, false ) 
  
addEventHandler ( "onClientGUIClick", clear,  
function ( )  
    for i, gui in ipairs ( edit ) do 
        guiSetText ( gui, deftext[i] ) 
    end 
end, false ) 
  
addEventHandler ( "onClientGUIClick", default,  
function ( )  
    for i = 1, 3 do if guiGetText ( edit[i] ) == "" or guiGetText ( edit[i] ) == deftext[i] then guiSetText ( edit[i], deftext[i] ) end end 
    guiSetText ( edit[4],  "Text" ) 
    guiSetText ( edit[5],  "1" ) 
    guiSetText ( edit[6],  "0" ) 
    guiSetText ( edit[7],  "255" ) 
    guiSetText ( edit[8],  "0" ) 
    guiSetText ( edit[9],  "255" ) 
end, false ) 
  
addEventHandler ( "onClientGUIClick", create,  
function ( ) 
  
    --Check if the values are OK 
    for i = 1, 3 do if tonumber ( guiGetText ( edit[i] ) ) == nil then outputChatBox ( "The 3D Texts need the position and the text to be created!", 255, 0, 0 ) return end end  
     
    --Create the text 
    local text = createElement ( "text" ) 
    if not text then return end 
     
    --The required arguments 
    local x = tonumber ( guiGetText ( edit[1] ) ) 
    local y = tonumber ( guiGetText ( edit[2] ) ) 
    local z = tonumber ( guiGetText ( edit[3] ) ) 
    local t = guiGetText ( edit[4] ) 
     
    setElementPosition ( text, x,      y, z    ) 
    setElementData     ( text, "text", t, true ) 
     
    --Now the optional 
    ----Color 
    local custom = true 
    for i = 6, 9 do if tonumber ( guiGetText ( edit[i] ) ) == nil then custom = false break end end 
    if custom == true then 
        outputChatBox ( "..." ) 
        local r = tonumber ( guiGetText ( edit[6]  ) ) 
        local g = tonumber ( guiGetText ( edit[7]  ) ) 
        local b = tonumber ( guiGetText ( edit[8]  ) ) 
        local a = tonumber ( guiGetText ( edit[9] ) ) 
        setElementData ( text, "rgba", { r, g, b, a }, true ) 
    end 
     
    ----Scale 
    local s = tonumber ( guiGetText ( edit[5] ) ) 
    if s ~= nil then setElementData ( text, "scale", s, true ) end 
     
    outputChatBox ( "3D DirectX Text sucessfully created!", 0, 255, 0 ) 
    return text 
end, false ) 
  
guiSetVisible ( win, false ) 
showCursor         ( false ) 
guiSetInputEnabled ( false ) 
guiWindowSetSizable ( win, false ) 
  
function dxtextitniga( )  
    guiSetVisible      ( win, not guiGetVisible ( win ) ) 
    showCursor         ( not isCursorShowing ( ) ) 
    guiSetInputEnabled ( not guiGetInputEnabled ( ) ) 
    for i = 1, 11 do guiSetText ( edit[i], deftext[i] ) end 
end ) 
addCommandHandler("createdx", dxtextitniga) 
  
--The 3D Text part 
addEventHandler ( "onClientRender", getRootElement ( ), 
function ( ) 
    --if dedfdd ~= nil then 
        local px, py, pz = getElementPosition ( getLocalPlayer ( ) ) 
        for i, t in ipairs ( getElementsByType ( "text" ) ) do 
         local cx, cy, cz = getElementPosition ( t ) 
            local dist = getDistanceBetweenPoints3D ( px, py, pz, cx, cy, cz ) 
             
            --Check if the distance between player and text drawing distance is same or less 
            if dist <= defdd then 
                local scx, scy = getScreenFromWorldPosition ( cx, cy, cz, -50, true ) 
                local scx2, scy2 = getScreenFromWorldPosition ( cx2, cy2, cz2, -40, true ) 
                if isLineOfSightClear ( px, py, pz, cx, cy, cz, true, false, false, false ) and scx and scy then 
                     
                    --The text default parameters 
                    local alpha   = defa 
                    local r       = defr 
                    local g       = defg 
                    local b       = defb 
                    local scale   = defscale 
                    local scale3d = defscale3d 
                    local font    = deffont 
                     
                    --Custom scale config 
                    if getElementData ( t, "scale", false ) then scale = getElementData ( t, "scale", false ) end 
                     
                    --Scale 3D config 
                    if scale3d == true then scale = scale * ( ( defdd - dist ) / defdd ) end 
                     
                    --Loads the text and stops function if there is no text loaded 
                    local text  = getElementData ( t, "text" ) 
                    if not text or text == "" then return end 
                     
                    --If the text has custom colors, load them 
                    local c     = getElementData ( t, "rgba" ) 
                    if c and type ( c ) == "table" then r = c[1] g = c[2] b = c[3] alpha = c[4] end 
                     
                    --Also the font 
                    local f     = getElementData ( t, "font" ) 
                    if f and type ( f ) == "string" then font = f end 
                     
                    --Draw the text 
                    dxDrawText ( text, scx, scy, scx, scy, tocolor ( r, g, b, alpha ), scale, font, "center", "center" ) 
                     
                else alpha = 0  
                end 
            else alpha = 0 
            end 
        end 
    --end 
end ) 
  
--Exported function 
function create3DText ( x, y, z, t, c, f, id ) 
    --Check arguments 
    if not x or not y or not z or not t then return false end 
     
    --Create the text 
    local text = createElement ( "text" ) 
    setElementPosition         ( text, x,      y, z, false ) 
    setElementData             ( text, "text", t, true     ) 
     
    --RGBA Colors 
    if c and type ( c ) == "table" then setElementData ( text, "rgba", { c[1], c[2], c[3], c[4] }, true ) end 
    --Font 
    if f and type ( f ) == "string" then setElementData ( text, "font", f ) end 
    --ID 
    if id and type ( id ) == "string" then setElementID ( text, id ) end 
     
    --If all was OK, returns the text element 
    return text 
end 
  
function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
    dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black 
    dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
end 

Link to comment
You can use this function:
function dxDrawBorderedText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
    dxDrawText ( text, x - 1, y - 1, w - 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) -- black 
    dxDrawText ( text, x + 1, y - 1, w + 1, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y + 1, w - 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y + 1, w + 1, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x - 1, y, w - 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x + 1, y, w + 1, h, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y - 1, w, h - 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y + 1, w, h + 1, tocolor ( 0, 0, 0, 255 ), scale, font, alignX, alignY, clip, wordBreak, false ) 
    dxDrawText ( text, x, y, w, h, color, scale, font, alignX, alignY, clip, wordBreak, postGUI ) 
end 

oh, okey. I figured somthing out, not exacly what i wanted but it works :D

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