Advertisement
Kezoto

Untitled

Aug 6th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.38 KB | None | 0 0
  1. if getElementData(localPlayer, "player:sid") then return end
  2.  
  3. local sx, sy = guiGetScreenSize()
  4.  
  5. local actual = false
  6. local root = getRootElement()
  7. local tick = getTickCount()
  8. local resourceRoot = getResourceRootElement(getThisResource())
  9. local screenWidth, screenHeight = guiGetScreenSize()
  10.  
  11. addEventHandler("onClientResourceStop", resourceRoot,
  12. function()
  13. if (blurShader) then
  14. destroyElement(blurShader)
  15. blurShader = nil
  16. end
  17. end)
  18.  
  19. local sm = {}
  20. sm.moov = 0
  21. sm.object1,sm.object2 = nil,nil
  22.  
  23. local function removeCamHandler()
  24. if(sm.moov == 1)then
  25. sm.moov = 0
  26. end
  27. end
  28.  
  29. local function camRender()
  30. if (sm.moov == 1) then
  31. local x1,y1,z1 = getElementPosition(sm.object1)
  32. local x2,y2,z2 = getElementPosition(sm.object2)
  33. setCameraMatrix(x1,y1,z1,x2,y2,z2)
  34. end
  35. end
  36. addEventHandler("onClientPreRender",root,camRender)
  37.  
  38. function smoothMoveCamera(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time)
  39. if(sm.moov == 1)then return false end
  40. sm.object1 = createObject(1337,x1,y1,z1)
  41. sm.object2 = createObject(1337,x1t,y1t,z1t)
  42. setElementAlpha(sm.object1,0)
  43. setElementAlpha(sm.object2,0)
  44. setObjectScale(sm.object1,0.01)
  45. setObjectScale(sm.object2,0.01)
  46. moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad")
  47. moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad")
  48. sm.moov = 1
  49. setTimer(removeCamHandler,time,1)
  50. setTimer(destroyElement,time,1,sm.object1)
  51. setTimer(destroyElement,time,1,sm.object2)
  52. return true
  53. end
  54.  
  55. x,y=2313.58, 1282.80-- my width
  56. intro_step=math.random(0,850)
  57.  
  58. local muzyka = false
  59.  
  60. local sw,sh = guiGetScreenSize()
  61. local zoom = 1
  62. if sw < 1920 then
  63. zoom = math.min(2, 1920 / sw)
  64. end
  65.  
  66. function getCenter(x, y)
  67. x,y = x / zoom, y / zoom
  68. return (sw / 2) - (x / 2), (sh / 2) - (y / 2)
  69. end
  70. local data={ showed=nil, button={}, info=nil, misc=nil, }
  71.  
  72. function isMouseIn(psx,psy,pssx,pssy,abx,aby)
  73. if not isCursorShowing() then return end
  74. cx,cy=getCursorPosition()
  75. cx,cy=cx*sx,cy*sy
  76. if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
  77. return true,cx,cy
  78. else
  79. return false
  80. end
  81. end
  82. local dist = 200
  83. local angler = 0
  84. function getPointFromDistanceRotation(x, y, dist, angler)
  85. local a = math.rad(270 - angler)
  86. local dx = math.cos(a) * dist;
  87. local dy = math.sin(a) * dist;
  88. return x+dx, y+dy;
  89. end
  90.  
  91. local dxfont0_font = dxCreateFont("font.ttf", 15)
  92. local texture_1 = dxCreateTexture('img/login-psrpg.png','argb',true,'clamp')
  93. local texture_4 = dxCreateTexture('img/registericon-psrpg.png','argb',true,'clamp')
  94. local texture_3 = dxCreateTexture('img/register-psrpg.png','argb',true,'clamp')
  95. local texture_2 = dxCreateTexture('img/loginicon-psrpg.png','argb',true,'clamp')
  96.  
  97. function renderLoginBox()
  98. if sy < 1049 then
  99. x_3, y_3 = getCenter(400,-900)
  100. else
  101. x_3, y_3 = getCenter(400,-550)
  102. end
  103.  
  104. if actual == 'login' then
  105. local x_1, y_1 = getCenter(400,550); local x_4, y_4 = getCenter(-850,300)
  106. dxDrawImage(x_1, y_1, 400/zoom, 550/zoom, texture_1, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  107. dxDrawImage(x_4, y_4, 300/zoom, 300/zoom, texture_2, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  108. elseif actual == 'register' then
  109. local x_1, y_1 = getCenter(400,550); local x_4, y_4 = getCenter(1450,300)
  110. dxDrawImage(x_1, y_1, 400/zoom, 550/zoom, texture_3, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  111. dxDrawImage(x_4, y_4, 300/zoom, 300/zoom, texture_4, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  112. end
  113. if data.info then
  114. dxDrawText("INFO:\n"..data.info, x_3 + 1, y_3 + 1, (1161 + 1)/zoom, (890 + 1)/zoom, tocolor(0, 0, 0, 255), 1, dxfont0_font, "center", "center", false, false, false, false, false)
  115. dxDrawText("INFO:\n"..data.info, x_3, y_3, 1161/zoom, 890/zoom, tocolor(255, 255, 255, 255), 1, dxfont0_font, "center", "center", false, false, false, false, false)
  116. end
  117.  
  118. smoothMoveCamera(1352.95, -1784.73, 57.37, 1426.97, -1749.14, 57.37, 1517.11, -1753.13, 57.37, 1744.15, -1746.72, 57.37, 45000)
  119. end
  120.  
  121. function math.round(number, decimals, method)
  122. decimals = decimals or 0
  123. local factor = 10 ^ decimals
  124. if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
  125. else return tonumber(("%."..decimals.."f"):format(number)) end
  126. end
  127.  
  128. addEventHandler("onClientClick", root, function(btn,state)
  129. if btn=="left" and state=="down" then
  130. local x_2, y_2 = getCenter(285,-302)
  131. local x_4, y_4 = getCenter(-850,300)
  132. local x1_4, y1_4 = getCenter(1450,300)
  133. if isMouseIn(x_2, y_2, 285/zoom, 65/zoom) and data.showed and actual == 'login' then
  134. local login=guiGetText(zaloguj)
  135. local pass=guiGetText(zarejestruj)
  136. if string.len(login) < 2 or string.len(pass) < 2 then
  137. data.info="Aby się zalogować należy wypełnić wszystkie pola."
  138. return
  139. end
  140. triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
  141. elseif isMouseIn(x_2, y_2, 285/zoom, 65/zoom) and data.showed and actual == 'register' then
  142. local login=guiGetText(zaloguj)
  143. local pass=guiGetText(zarejestruj)
  144. if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
  145. data.info="Nazwa/Hasło Użytkownika musi zawierać od 3 do 22 znaków"
  146. return
  147. end
  148. triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
  149. elseif isMouseIn(x_4,y_4,300/zoom,300/zoom) and data.showed and actual == 'login' then
  150. actual = 'register'
  151. elseif isMouseIn(x1_4,y1_4,300/zoom,300/zoom) and data.showed and actual == 'register' then
  152. actual = 'login'
  153. end
  154. end
  155. end)
  156.  
  157. addEvent("logging:result", true)
  158. addEventHandler("logging:result", resourceRoot, function(value,info)
  159. if not info then info="" end
  160. if value then
  161. data.showed=false
  162. showZones(muzyka)
  163.  
  164. destroyElement(zaloguj)
  165. destroyElement(zarejestruj)
  166. removeEventHandler("onClientRender", root, renderLoginBox)
  167. removeEventHandler("onClientPreRender",root,camRender)
  168.  
  169. local tick = getTickCount()
  170. else
  171. data.info=tostring(info)
  172. setTimer(function() data.info=nil end, 3000, 1)
  173. end
  174. end)
  175.  
  176.  
  177. addEventHandler("onClientResourceStart", resourceRoot, function()
  178. showChat(false)
  179. showCursor(true)
  180. fadeCamera(true)
  181. data.showed=true
  182. setElementAlpha(localPlayer,0)
  183. local tick = getTickCount()
  184. muzyka=playSound("misc/intro.mp3",true)
  185. actual = 'login'
  186. setSoundVolume(muzyka, 1.0)
  187. showPlayerHudComponent("all",false)
  188. guiSetInputMode("no_binds_when_editing")
  189. setElementData(localPlayer,"status","Loguje siÄ™")
  190. addEventHandler("onClientRender", root, renderLoginBox)
  191. local x_edit, y_edit = getCenter(304,190)
  192. zaloguj=guiCreateEdit(x_edit, y_edit, 304/zoom, 35/zoom, "", false)
  193. local x_edit_2, y_edit_2 = getCenter(304,-100)
  194. zarejestruj=guiCreateEdit(x_edit_2, y_edit_2, 304/zoom, 35/zoom, "", false)
  195. guiEditSetMasked(zarejestruj,true)
  196. guiEditSetMaxLength(zaloguj, 22)
  197. guiEditSetMaxLength(zarejestruj, 22)
  198. guiSetAlpha(zaloguj,0.60)
  199. guiSetAlpha(zarejestruj,0.60)
  200. guiSetVisible(zaloguj,true)
  201. guiSetVisible(zarejestruj,true)
  202. end)
  203.  
  204. addCommandHandler('matrix',function()
  205. local one,two,three,four,five,six,seven,eight = getCameraMatrix()
  206. outputChatBox((one)..','..(two)..','..(three)..','..(four)..','..(five)..','..(six)..','..(seven)..','..(eight))
  207. end)
  208.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement