Advertisement
Guest User

Untitled

a guest
Jan 25th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.93 KB | None | 0 0
  1. if getElementData(localPlayer, "player:sid") then return end
  2.  
  3. local root = getRootElement()
  4. local resourceRoot = getResourceRootElement(getThisResource())
  5. local screenWidth, screenHeight = guiGetScreenSize()
  6.  
  7. intro_step=math.random(0,850)
  8. setElementDimension(localPlayer, 0)
  9.  
  10. local blurStrength = 20
  11. local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
  12. blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")
  13.  
  14.  
  15. function math.round(number, decimals, method)
  16.     decimals = decimals or 0
  17.     local factor = 10 ^ decimals
  18.     if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
  19.     else return tonumber(("%."..decimals.."f"):format(number)) end
  20. end
  21.  
  22.  
  23. function renderblur()
  24.     if blur == true then
  25.         dxUpdateScreenSource(myScreenSource)
  26.        
  27.         dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
  28.         dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
  29.         dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);
  30.  
  31.         dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
  32.     end
  33. end
  34. addEventHandler("onClientRender", root, renderblur)
  35.  
  36. addEventHandler("onClientResourceStop", resourceRoot,
  37. function()
  38.     if (blurShader) then
  39.         destroyElement(blurShader)
  40.         blurShader = nil
  41.     end
  42. end)
  43.  
  44. x,y=2513.58, 1282.80-- my width
  45. intro_step=math.random(0,850)
  46.  
  47. local sx,sy=guiGetScreenSize()
  48. local data={ showed=nil, button={}, info=nil, misc=nil, }
  49.  
  50. function isMouseIn(psx,psy,pssx,pssy,abx,aby)
  51.     if not isCursorShowing() then return end
  52.     cx,cy=getCursorPosition()
  53.     cx,cy=cx*sx,cy*sy
  54.     if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
  55.         return true,cx,cy
  56.     else
  57.         return false
  58.     end
  59. end
  60. local dist = 100
  61. local angler = 0
  62. function getPointFromDistanceRotation(x, y, dist, angler)
  63.     local a = math.rad(90 - angler)
  64.     local dx = math.cos(a) * dist;
  65.     local dy = math.sin(a) * dist;
  66.     return x+dx, y+dy;
  67. end
  68.  
  69. function renderLoginBox()
  70.     --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
  71.     dxDrawRectangle(sx*357/1025, sy*0/769, sx*320/1025, sy*958/767, tocolor(25, 25, 25, 220), false)
  72.     --dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
  73.     if data.info then dxDrawText(data.info, sx*515/1024, sy*530/768, sx*515/1024, sy*530/768, tocolor(255, 80, 80, 255), 1.8, "bold", "center", "center", false) end
  74.     --dxDrawLine(sx*0/1024, sy*199/768, sx*1022/1024, sy*200/768, tocolor(31, 111, 193, 255), 5, false)
  75.     --dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(31, 111, 193, 255), 5, false)
  76.     dxDrawText("Nazwa użytkownika", sx*460/1024, sy*410/768, sx*565/1024, sy*325/768, white, 1.50, "default-bold", "center", "center", false)
  77.     dxDrawText("Hasło", sx*460/1024, sy*590/768, sx*565/1024, sy*302/768, white, 1.50, "default-bold", "center", "center", false)
  78.     if not isMouseIn(sx*416/1024, sy*565/768, sx*200/1024, sy*35/768) then dxDrawRectangle(sx*416/1024, sy*565/768, sx*200/1024, sy*35/768, tocolor(255,255,255, 170), false)
  79.     else dxDrawRectangle(sx*411/1024, sy*565/768, sx*208/1024, sy*35/768, tocolor(255,255,255, 230), false) end
  80.     if not isMouseIn(sx*416/1024, sy*615/768, sx*200/1024, sy*35/768) then dxDrawRectangle(sx*416/1024, sy*615/768, sx*200/1024, sy*35/768, tocolor(255,255,255, 170), false)
  81.     else dxDrawRectangle(sx*411/1024, sy*615/768, sx*208/1024, sy*35/768, tocolor(255,255,255, 230), false) end
  82.     dxDrawText("Z a l o g u j  s i ę", sx*460/1024, sy*1120/768, sx*565/1024, sy*45/768, tocolor(0,0,0,255), 1.7, "default-bold", "center", "center", false)
  83.     dxDrawText("Z a r e j e s t r u j  s i ę", sx*460/1024, sy*1220/768, sx*565/1024, sy*45/768, tocolor(0,0,0,255), 1.7, "default-bold", "center", "center", false)
  84.     --dxDrawImage(sx * 0.016, sy * 0.0413, sx * 0.2838, sy * 0.2749, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
  85.     --dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png", angle, 0, -120 )
  86.     --local x,y=getPointFromDistanceRotation(-2648.46, -5.59, dist, angler)
  87.     --setCameraMatrix(x,y,80.72+0.9,1100.69, -3500.66, -2600+0.9)
  88.     --angler=(angler+0.1)
  89.     local abckamera1=math.sin(intro_step/-500)*9000
  90.     local abckamera2=math.cos(intro_step/-500)*9000
  91.     setCameraMatrix (-2648.48, -5.48, 20.29, abckamera1, abckamera2, -1500)
  92.     --setCameraMatrix(zone1, zone2, 120, zone1, zone2, 120)
  93.     intro_step=intro_step-1.8
  94.     dxDrawImage(sx*315/1024, sy*10/768, sx*400/1024, sy*400/768, "image/logo.png")
  95. end
  96.  
  97.  
  98. ---2648.46,-5.59,45.29
  99.  
  100.  
  101. addEventHandler("onClientClick", root, function(btn,state)
  102.     if btn=="left" and state=="down" then
  103.         if isMouseIn(sx*416/1024, sy*565/768, sx*200/1024, sy*35/768) and data.showed then
  104.             local login=guiGetText(data.button[1])
  105.             local pass=guiGetText(data.button[2])
  106.             if string.len(login) < 2 or string.len(pass) < 2 then
  107.                 data.info="Należy wypełnić wszystkie pola."
  108.                 return
  109.             end
  110.             triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
  111.         end
  112.         if isMouseIn(sx*416/1024, sy*615/768, sx*200/1024, sy*35/768) and data.showed then
  113.             local login=guiGetText(data.button[1])
  114.             local pass=guiGetText(data.button[2])
  115.             if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
  116.                 data.info="Login i hasło powinno zawierać od 3 do 22 znaków."
  117.                 return
  118.             end
  119.             triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
  120.         end
  121.     end
  122. end)
  123.  
  124. addEvent("logging:result", true)
  125. addEventHandler("logging:result", resourceRoot, function(value,info)
  126.     if not info then info="" end
  127.     if value then
  128.         data.showed=false
  129.         showZones(data.misc)
  130.        
  131.         -- Usuwamy elementy
  132.         destroyElement(data.button[1])
  133.         destroyElement(data.button[2])
  134.         removeEventHandler("onClientRender", root, renderLoginBox)
  135.     else
  136.         data.info=tostring(info)
  137.         setTimer(function() data.info=nil end, 3000, 1)
  138.     end
  139. end)
  140.  
  141. local components = { "weapon", "ammo", "health", "clock", "money", "breath", "armour", "wanted" }
  142.  
  143. addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
  144. function ()
  145.     showChat(false)
  146.     showCursor(true)
  147.     fadeCamera(true)
  148.     data.showed=true
  149.     setElementAlpha(localPlayer,0)
  150.     data.misc=playSound("music/music.mp3",true)
  151.     --setPlayerHudComponentVisible("radar", false)
  152.     setSoundVolume(data.misc, 1.0)
  153.     setPlayerHudComponentVisible( components, false )
  154.     guiSetInputMode("no_binds_when_editing")
  155.     setElementData(localPlayer,"status","Loguje się")
  156.     --setElementData(localPlayer,"player:logged",false)
  157.     addEventHandler("onClientRender", root, renderLoginBox)
  158.     local nick = getPlayerName( localPlayer )
  159.     data.button[1]=guiCreateEdit(0.395, 0.50, 0.22, 0.04, ""..nick.."", true)
  160.     data.button[2]=guiCreateEdit(0.395, 0.60, 0.22, 0.04, "", true)  
  161.     guiEditSetMasked(data.button[2],true)
  162. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement