csmit195

LUA Text Code - Edit for ToasT

Jul 19th, 2012
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.81 KB | None | 0 0
  1. function dxDrawColorText(str, ax, ay, bx, by, color, scale, font, alignX, alignY)
  2.   bx, by, color, scale, font = bx or ax, by or ay, color or tocolor(255,255,255,255), scale or 1, font or "default"
  3.   if alignX then
  4.     if alignX == "center" then
  5.       ax = ax + (bx - ax - dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font))/2
  6.     elseif alignX == "right" then
  7.       ax = bx - dxGetTextWidth(str:gsub("#%x%x%x%x%x%x",""), scale, font)
  8.     end
  9.   end
  10.   if alignY then
  11.     if alignY == "center" then
  12.       ay = ay + (by - ay - dxGetFontHeight(scale, font))/2
  13.     elseif alignY == "bottom" then
  14.       ay = by - dxGetFontHeight(scale, font)
  15.     end
  16.   end
  17.   local alpha = string.format("%08X", color):sub(1,2)
  18.   local pat = "(.-)#(%x%x%x%x%x%x)"
  19.   local s, e, cap, col = str:find(pat, 1)
  20.   local last = 1
  21.   while s do
  22.     if cap == "" and col then color = tocolor(getColorFromString("#"..col..alpha)) end
  23.     if s ~= 1 or cap ~= "" then
  24.       local w = dxGetTextWidth(cap, scale, font)
  25.       dxDrawText(cap, ax, ay, ax + w, by, color, scale, font)
  26.       ax = ax + w
  27.       color = tocolor(getColorFromString("#"..col..alpha))
  28.     end
  29.     last = e + 1
  30.     s, e, cap, col = str:find(pat, last)
  31.   end
  32.   if last <= #str then
  33.     cap = str:sub(last)
  34.     dxDrawText(cap, ax, ay, ax + dxGetTextWidth(cap, scale, font), by, color, scale, font)
  35.   end
  36. end
  37.  
  38. addEvent("onClientMapStarting",true)
  39. addEventHandler("onClientMapStarting",getRootElement(),
  40. function()
  41.     fade = 0
  42.     width, height = guiGetScreenSize()
  43.     setTimer(function()
  44.     check = 0
  45.     end,2000,1)
  46.     addEventHandler("onClientRender",getRootElement(),renderText)
  47. end )
  48.  
  49.  
  50.  
  51. function renderText()
  52.     if fade <= 253 and check == 0 then
  53.         fade = fade + 2
  54.         dxDrawColorText("#FFFFFF[#FF0398MAP#FFFFFF] EvolutioN staRted", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  55.     elseif check == 0 then
  56.         check = 1
  57.         dxDrawColorText("#FFFFFF[#FF0398MAP#FFFFFF] EvolutioN staRted", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*3, "default", "center", "center")
  58.         fade = 254
  59.     elseif fade <= 254 and check == 1 and fade ~= 0 then
  60.         fade = fade - 2
  61.         dxDrawColorText("#FFFFFF[#FF0398MAP#FFFFFF] EvolutioN staRted", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  62.     elseif fade == 0 and check == 1 then
  63.         check = 2
  64.        
  65.        
  66.     elseif fade <= 253 and check == 2 then
  67.         fade = fade + 2
  68.         dxDrawColorText("#FFFFFF[#FF0398AUTHOR#FFFFFF] ToasT*_*", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  69.     elseif check == 2 then
  70.         check = 3
  71.         dxDrawColorText("#FFFFFF[#FF0398AUTHOR#FFFFFF] ToasT*_*", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*3, "default", "center", "center")
  72.         fade = 254
  73.     elseif fade <= 254 and check == 3 and fade ~= 0 then
  74.         fade = fade - 2
  75.         dxDrawColorText("#FFFFFF[#FF0398AUTHOR#FFFFFF] ToasT*_*", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  76.     elseif fade == 0 and check == 3 then
  77.         check = 4
  78.    
  79.    
  80.     elseif fade <= 253 and check == 4 then
  81.         fade = fade + 2
  82.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] BenniB - Uncharted (Prod. Joey C)", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*2, "default", "center", "center")
  83.     elseif check == 4 then
  84.         check = 5
  85.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] BenniB - Uncharted (Prod. Joey C)", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*2, "default", "center", "center")
  86.         fade = 254
  87.     elseif fade <= 254 and check == 5 and fade ~= 0 then
  88.         fade = fade - 2
  89.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] BenniB - Uncharted (Prod. Joey C)", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*2, "default", "center", "center")
  90.     elseif fade == 0 and check == 5 then
  91.         check = 6
  92.     end
  93. end
Advertisement
Add Comment
Please, Sign In to add comment