csmit195

Lisa's Client - DDBelowUs - MTASA

Jul 4th, 2012
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 5.11 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] [DD] Below Us", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*4, "default", "center", "center")
  55.     elseif check == 0 then
  56.         check = 1
  57.         dxDrawColorText("#FFFFFF[#FF0398MAP#FFFFFF] [DD] Below Us", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*4, "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] [DD] Below Us", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*4, "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] Lisa", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*4, "default", "center", "center")
  69.     elseif check == 2 then
  70.         check = 3
  71.         dxDrawColorText("#FFFFFF[#FF0398AUTHOR#FFFFFF] Lisa", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*4, "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] Lisa", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*4, "default", "center", "center")
  76.     elseif fade == 0 and check == 3 then
  77.         check = 4
  78.    
  79.     elseif fade <= 253 and check == 4 then
  80.         fade = fade + 2
  81.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] Seven Lions - Below us (Feat. Shaz Sparks)", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  82.     elseif check == 4 then
  83.         check = 5
  84.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] Seven Lions - Below us (Feat. Shaz Sparks)", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*3, "default", "center", "center")
  85.         fade = 254
  86.     elseif fade <= 254 and check == 5 and fade ~= 0 then
  87.         fade = fade - 2
  88.         dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] Seven Lions - Below us (Feat. Shaz Sparks)", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*3, "default", "center", "center")
  89.     elseif fade == 0 and check == 5 then
  90.         check = 6
  91.     end
  92. end
  93.  
  94. addEventHandler("onClientResourceStart",getRootElement(),
  95. function(res)
  96.  if res == getThisResource() then
  97.   txd = engineLoadTXD("textures/palm3.txd")
  98.   engineImportTXD(txd, 622)
  99.   dff = engineLoadDFF("textures/palm3.dff", 622)
  100.   engineReplaceModel(dff, 622)
  101.  
  102.   txd1 = engineLoadTXD("textures/palm2.txd")
  103.   engineImportTXD(txd1, 621)  
  104.   dff1 = engineLoadDFF("textures/palm2.dff", 621)
  105.   engineReplaceModel(dff1, 621)
  106.  
  107.   setWaterColor(112,147,219,230)
  108. end
  109. end )
  110.  
  111. function startMusic()
  112.     setRadioChannel(0)
  113.     song = playSound("song.mp3",true)
  114. end
  115.  
  116. function makeRadioStayOff()
  117.     setRadioChannel(0)
  118.     cancelEvent()
  119. end
  120.  
  121. function toggleSong()
  122.     if not songOff then
  123.      setSoundVolume(song,0)
  124.   songOff = true
  125.   removeEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
  126.  else
  127.      setSoundVolume(song,1)
  128.   songOff = false
  129.   setRadioChannel(o)
  130.   addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
  131.  end
  132. end
  133.  
  134. addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),startMusic)
  135. addEventHandler("onClientPlayerRadioSwitch",getRootElement(),makeRadioStayOff)
  136. addEventHandler("onClientPlayerVehicleEnter",getRootElement(),makeRadioStayOff)
  137. addCommandHandler("music",toggleSong)
  138. bindKey("m","down","music")
Advertisement
Add Comment
Please, Sign In to add comment