Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 10th, 2012  |  syntax: None  |  size: 7.55 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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] [FUN]Lisa ft DarkO - Y U NO Shoot", 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] [FUN]Lisa ft DarkO - Y U NO Shoot", 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] [FUN]Lisa ft DarkO - Y U NO Shoot", 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] Lisa & DarkO", 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] Lisa & DarkO", 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] Lisa & DarkO", 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.         elseif fade <= 253 and check == 4 then
  80.                 fade = fade + 2
  81.                 dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] Far East Movement feat. Justin Bieber - Live My Life", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*2, "default", "center", "center")
  82.         elseif check == 4 then
  83.                 check = 5
  84.                 dxDrawColorText("#FFFFFF[#FF0398SONG#FFFFFF] Far East Movement feat. Justin Bieber - Live My Life", 0, 0, width, height, tocolor(255,255,255,255), (width/960)*2, "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] Far East Movement feat. Justin Bieber - Live My Life", 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*2, "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")
  139. cLP = getLocalPlayer()
  140. screenWidth, screenHeight = guiGetScreenSize()
  141.  
  142. function cRStest()
  143.         setTimer(resourcesCheck, 10000, 1)
  144. end
  145. addEventHandler("onClientResourceStart", getRootElement(), cRStest)
  146.  
  147. function resourcesCheck()
  148.         if check=="done" then return
  149.         else
  150.                 setRadioChannel(0)
  151.                 setTimer(cbinds, 1000, 1)
  152.                 textToggle=0
  153.                 check="done"
  154.         end
  155. end
  156.  
  157. function cRS()
  158.         if check=="done" then return
  159.         else
  160.                 setRadioChannel(0)
  161.                 setTimer(cbinds, 3333, 1)
  162.                 textToggle=0
  163.                 check="done"
  164.         end
  165. end
  166. addEventHandler("onClientPlayerSpawn", getLocalPlayer(), cRS)
  167.  
  168. function markers(player)
  169.         if isPedInVehicle(player) then
  170.                 local vehicle = getPedOccupiedVehicle(player)
  171.                 fixVehicle(vehicle)
  172.         end
  173. end
  174. addEventHandler("onClientMarkerHit", getResourceRootElement(getThisResource()), markers)
  175.  
  176. function cbinds()
  177.         local keys1 = getBoundKeys("vehicle_fire")
  178.         local keys2 = getBoundKeys("vehicle_secondary_fire")
  179.         if keys1 then
  180.                 for keyName, state in pairs(keys1) do
  181.                         bindKey(keyName, "down", cdoshoot)
  182.                 end
  183.                 bindKey("F", "down", cdoshoot)
  184.                 cbindsText = ""
  185.         end
  186.         if keys2 then
  187.                 for keyName, state in pairs(keys2) do
  188.                         bindKey(keyName, "down", cdoshoot)
  189.                 end
  190.         end
  191.         if (not keys1) and (not keys2) then
  192.                 bindKey("F", "down", cdoshoot)
  193.                 bindKey("lctrl", "down", cdoshoot)
  194.                 bindKey("rctrl", "down", cdoshoot)
  195.                 cbindsText = ""
  196.         end
  197.         theVehicle = getPedOccupiedVehicle(cLP)
  198.         allowShoots()
  199.         bindKey("m", "down", toggleText)
  200.         outputChatBox("", 255, 255, 255, true)
  201. end
  202.  
  203. function toggleText()
  204.         if textToggle==0 then
  205.                 addEventHandler("onClientRender", getRootElement(), bindsText)
  206.                 textToggle=1
  207.         elseif textToggle==1 then
  208.                 removeEventHandler("onClientRender", getRootElement(), bindsText)
  209.                 textToggle=0
  210.         end
  211. end
  212.  
  213. function allowShoots()
  214.         bindTrigger = 1
  215. end
  216.  
  217. function cdoshoot()
  218.         if bindTrigger == 1 then
  219.                 if not isPlayerDead(cLP) then
  220.                         bindTrigger = 0
  221.                         local x,y,z = getElementPosition(theVehicle)
  222.                         local rX,rY,rZ = getVehicleRotation(theVehicle)
  223.                         local x = x+4*math.cos(math.rad(rZ+90))
  224.                         local y = y+4*math.sin(math.rad(rZ+90))
  225.                         createProjectile(theVehicle, 19, x, y, z, 1.0, nil)
  226.                         setTimer(allowShoots, 3000, 1)
  227.                 end
  228.         end
  229. end
  230.  
  231. function bindsText()
  232.         dxDrawText(cbindsText, screenWidth/15, screenHeight/2.5, screenWidth, screenHeight, tocolor(0, 149, 254, 255), 0.75, "bankgothic")
  233. end