Guest User

login_window.lua

a guest
Sep 9th, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.03 KB | None | 0 0
  1. -------------------------
  2. ------- (c) 2010 --------
  3. ------- by Zipper -------
  4. -- and Vio MTA:RL Crew --
  5. -------------------------
  6.  
  7. addEvent('ShowLoginWindow', true )
  8. addEvent ( "aktualisiereMemberTabelle", true )
  9.  
  10. -- preliminary
  11. local resX, resY = guiGetScreenSize()
  12. local segoeui = dxCreateFont('fonts/segoeui.ttf', 20)
  13. local selected = 'username'
  14. local username = ''
  15. local password = ''
  16. local showPassword = false
  17. local inService = false
  18. local hatPasswortDrin = true
  19. local einloggsound
  20. local limits = {
  21. username = 241,
  22. password = 195
  23. }
  24.  
  25. -- animation
  26. local state = 'starting'
  27. local phase = 0
  28. local alpha = 0
  29. local lastTick = getTickCount()
  30.  
  31. -- recognizable
  32. showChat( false )
  33. showCursor( true )
  34. showPlayerHudComponent('all', false)
  35. showPlayerHudComponent('crosshair', true)
  36.  
  37. -- utilities
  38. local function convertingUserdata()
  39. local pass = password
  40. if not showPassword then
  41. pass = pass:gsub(".","*")
  42. end
  43. if #pass == 0 then
  44. pass = 'Password'
  45. end
  46. local user = username
  47. if #user == 0 then
  48. user = 'Username'
  49. end
  50. return user, pass
  51. end
  52.  
  53. local function setSettings( s, p )
  54. state = s or 'starting'
  55. phase = p or 0
  56. lastTick = getTickCount()
  57. end
  58.  
  59. local function getProgress( addtick )
  60. local now = getTickCount()
  61. local elapsedTime = now - lastTick
  62. local duration = lastTick+addtick - lastTick
  63. local progress = elapsedTime / duration
  64. return progress
  65. end
  66.  
  67. local function sendUserdata()
  68. if #username > 0 and #password > 0 then
  69. triggerServerEvent ( "einloggen", lp, lp, password, hatPasswortDrin )
  70. inService = true
  71. end
  72. end
  73.  
  74. local function removeLetter(button, press)
  75. if ( state ~= 'ready' or isChatBoxInputActive() or isConsoleActive() or isMainMenuActive() ) then
  76. return
  77. end
  78. if press then
  79. if button == 'backspace' then
  80. local text = ( selected == 'username' and username or password )
  81. if #text > 0 then
  82. text = string.sub(text, 1, #text - 1)
  83. end
  84. if selected ~= 'username' then
  85. password = text
  86. end
  87. end
  88. end
  89. end
  90.  
  91. local function mainClick(button, _state, x, y)
  92. if state ~= 'ready' then
  93. return
  94. end
  95. if ( button == 'left' and _state == 'down' ) then
  96. -- username
  97. local checkX = ( x > resX/2-20 and x < resX/2-20+250 )
  98. local checkY = ( y > resY/2-12.5 and y < resY/2-12.5+25 )
  99. if ( checkX and checkY ) then
  100. selected = 'username'
  101. if ( not inService ) then
  102. lastTick = getTickCount()
  103. end
  104. end
  105. -- password
  106. local checkX = ( x > resX/2-20 and x < resX/2-20+250 )
  107. local checkY = ( y > resY/2-12.5+37.5 and y < resY/2-12.5+25+37.5 )
  108. if ( checkX and checkY ) then
  109. selected = 'password'
  110. if ( not inService ) then
  111. lastTick = getTickCount()
  112. end
  113. end
  114. -- login
  115. local checkX = ( x > resX/2-45+250 and x < resX/2-20+250 )
  116. local checkY = ( y > resY/2-12.5+37.5 and y < resY/2-12.5+25+37.5 )
  117. if ( checkX and checkY ) then
  118. sendUserdata()
  119. end
  120. end
  121. -- showPassword
  122. local checkX = ( x > resX/2-70+250 and x < resX/2-70+275 )
  123. local checkY = ( y > resY/2-11.25+35 and y < resY/2-11.25+37.5+25 )
  124. if ( checkX and checkY ) then
  125. if _state == 'down' then
  126. showPassword = true
  127. else
  128. showPassword = false
  129. end
  130. end
  131. end
  132.  
  133. local function addLetter(button)
  134. if ( state ~= 'ready' or isChatBoxInputActive() or isConsoleActive() or isMainMenuActive() ) then
  135. return
  136. end
  137. local text = ( selected == 'username' and username or password )
  138. if dxGetTextWidth(text,0.5, segoeui ) >= limits[selected]-1 then
  139. return
  140. end
  141. text = text..button
  142. if ( button == 'space' ) then
  143. text = text .. ' '
  144. end
  145. if ( selected ~= 'username' ) then
  146. password = text
  147. end
  148. end
  149.  
  150. -- main
  151. local function mainRender()
  152. local user, pass = convertingUserdata()
  153. if ( state == 'starting' ) then
  154. dxDrawRectangle( resX/2-112.5, resY/2-112.5, 225, 225, tocolor( 255, 255, 255, 25) )
  155. dxDrawImage( resX/2-100, resY/2-100, 200, 200, 'images/profil.png' )
  156. if ( lastTick+1000 <= getTickCount() ) then
  157. setSettings( 'animation', 1 )
  158. end
  159. elseif ( state == 'animation' ) then
  160. if ( phase == 1 ) then
  161. local fringeX, imageX, _ = interpolateBetween( resX/2-112.5, resX/2-100, 0, resX/2-243.75, resX/2-231.25, 0, getProgress( 900 ), 'Linear' )
  162. dxDrawRectangle( fringeX, resY/2-112.5, 225, 225, tocolor( 255, 255, 255, 25) )
  163. dxDrawImage( imageX, resY/2-100, 200, 200, 'images/profil.png' )
  164. if ( lastTick+925 <= getTickCount() ) then
  165. setSettings( 'animation', 2 )
  166. end
  167. elseif ( phase == 2 ) then
  168. local posX, alpha, size = interpolateBetween( resX/2-300, 0, 225, resX/2-20, 255, 487.5, getProgress( 1500 ), 'OutBack' )
  169. local alpha = (alpha > 255 and 255 or alpha)
  170. dxDrawText('Rise-Reallife', posX, resY/2-55, left, top, tocolor(0,187,0,alpha), 1, segoeui, 'left', 'center')
  171. dxDrawRectangle( posX, resY / 2 - 12.5 , 250, 25, tocolor(255, 255, 255, alpha))
  172. dxDrawRectangle( posX, resY / 2 - 12.5+37.5 , 250, 25, tocolor(255, 255, 255, alpha))
  173. dxDrawRectangle( posX+225, resY / 2 - 12.5+37.5 , 25, 25, tocolor(255, 64, 0, alpha))
  174. dxDrawImage(posX+225+6.25, resY / 2 - 12.5+37.5+6.25, 12.5, 12.5, 'images/arrow.png')
  175. dxDrawText( user, posX+5, resY / 2 , left, top,(#username == 0 and tocolor(150, 150, 150, 255) or tocolor(0, 0, 0, 255)), 0.5, segoeui, 'left', 'center')
  176. dxDrawText( pass, posX+5, resY / 2+37.5 , left, top,(#username == 0 and tocolor(150, 150, 150, 255) or tocolor(0, 0, 0, 255)), 0.5, segoeui, 'left', 'center')
  177. dxDrawRectangle( resX/2-243.75, resY/2-112.5, size, 225, tocolor( 255, 255, 255, 25) )
  178. dxDrawImage( resX/2-231.25, resY/2-100, 200, 200, 'images/profil.png' )
  179. dxDrawText ( "Rise-Reallife", resX-375, resY-100, 375, screenheight, tocolor ( 0, 187, 0 ), 2, "pricedown", "left", "top" )
  180. if ( lastTick+1500 <= getTickCount() ) then
  181. setSettings( 'ready', 0 )
  182. end
  183. end
  184. elseif ( state == 'ready' ) then
  185. dxDrawText('Rise-Reallife', resX/2-20, resY/2-55, left, top, tocolor(0,187,0,255), 1, segoeui, 'left', 'center')
  186. dxDrawRectangle( resX/2-20, resY / 2 - 12.5 , 250, 25, tocolor(255, 255, 255, 255))
  187. dxDrawRectangle( resX/2-20, resY / 2 - 12.5+37.5 , 250, 25, tocolor(255, 255, 255, 255))
  188. dxDrawRectangle( resX/2-20+225, resY / 2 - 12.5+37.5 , 25, 25, tocolor(255, 64, 0, 255))
  189. dxDrawImage(resX/2-20+225+6.25, resY / 2 - 12.5+37.5+6.25, 12.5, 12.5, 'images/arrow.png')
  190. dxDrawText( user, resX/2-20+5, resY / 2 , left, top,(#username == 0 and tocolor(150, 150, 150, 255) or tocolor(0, 0, 0, 255)), 0.5, segoeui, 'left', 'center')
  191. dxDrawText( pass, resX/2-20+5, resY / 2+37.5 , left, top,(#password == 0 and tocolor(150, 150, 150, 255) or tocolor(0, 0, 0, 255)), 0.5, segoeui, 'left', 'center')
  192. dxDrawRectangle( resX/2-243.75, resY/2-112.5, 487.5, 225, tocolor( 255, 255, 255, 25) )
  193. dxDrawImage( resX/2-231.25, resY/2-100, 200, 200, 'images/profil.png' )
  194. dxDrawText ( "Rise-Reallife", resX-375, resY-100, 375, screenheight, tocolor ( 0, 187, 0 ), 2, "pricedown", "left", "top" )
  195. if #password > 0 then
  196. dxDrawImage( resX/2-70+250, resY/2-11.25+37.5 , 22.5, 22.5, 'images/show.png')
  197. end
  198. if ( getTickCount() - lastTick >= 750 ) then
  199. if ( getTickCount() - lastTick >= 1500 ) then
  200. lastTick = getTickCount()
  201. end
  202. if ( selected == 'username' ) then
  203. dxDrawRectangle( resX/2-20+5+dxGetTextWidth((#username == 0 and username) or user, 0.5,segoeui), resY / 2 - 10, 1, 20, tocolor(0, 0, 0, 255))
  204. elseif ( selected == 'password' ) then
  205. dxDrawRectangle( resX/2-20+5+dxGetTextWidth((#password == 0 and password) or pass, 0.5,segoeui), resY/2-10+37.5, 1, 20, tocolor(0, 0, 0, 255))
  206. end
  207. end
  208. -- hover
  209. showCursor( true )
  210. local cx, cy = getCursorPosition()
  211. local x, y = cx*resX, cy*resY
  212. setElementData(localPlayer, 'cursor', 'cursor')
  213. if ( ( x > resX/2-20 and x < resX/2-20+250 ) and ( y > resY/2-12.5 and y < resY/2-12.5+25 ) ) then
  214. setElementData(localPlayer, 'cursor', 'text_cursor')
  215. end
  216. if ( ( x > resX/2-20 and x < resX/2-70+250 ) and ( y > resY/2-12.5+37.5 and y < resY/2-11.25+37.5+25 ) ) then
  217. setElementData(localPlayer, 'cursor', 'text_cursor')
  218. end
  219. if ( ( x > resX/2-45+250 and x < resX/2-20+250 ) and ( y > resY/2-12.5+37.5 and y < resY/2-12.5+25+37.5 ) ) then
  220. setElementData(localPlayer, 'cursor', 'link_cursor')
  221. end
  222. if ( #password > 0 ) then
  223. if ( ( x > resX/2-70+250 and x < resX/2-70+275 ) and ( y > resY/2-11.25+35 and y < resY/2-11.25+37.5+25 ) ) then
  224. setElementData(localPlayer, 'cursor', 'link_cursor')
  225. end
  226. end
  227. if ( phase == 1 ) then
  228. alpha, _, _ = interpolateBetween( 0, 0, 0, 255, 0, 0, getProgress( 1500 ), 'Linear' )
  229. if ( lastTick+1475 <= getTickCount() ) then
  230. setSettings( 'ready', 0 )
  231. alpha = 255
  232. inService = false
  233. end
  234. end
  235. local msg = 'Wrong username or password!'
  236. dxDrawText(msg, resX/2-20+250/2-dxGetTextWidth(msg, 0.5, segoeui)/2 , resY/2+75, left, top, tocolor(255,0,0,alpha), 0.5, segoeui, 'left', 'center')
  237. elseif ( state == 'finished' ) then
  238. setPlayerHudComponentVisible("radar", false)
  239. local posX, alpha, alpha1 = interpolateBetween( resX/2-231.25, 255, 25, resX, 0, 0, getProgress( 950 ), 'Linear' )
  240.  
  241. dxDrawText('Rise-Reallife', posX+220, resY/2-55, left, top, tocolor(0,187,0,255), 1, segoeui, 'left', 'center')
  242. dxDrawRectangle( posX+220, resY / 2 - 12.5 , 250, 25, tocolor(255, 255, 255, alpha))
  243. dxDrawRectangle( posX+220, resY / 2 - 12.5+37.5 , 250, 25, tocolor(255, 255, 255, alpha))
  244. dxDrawRectangle( posX+220+225, resY / 2 - 12.5+37.5 , 25, 25, tocolor(255, 64, 0, alpha))
  245.  
  246. dxDrawImage(posX+220+225+6.25, resY / 2 - 12.5+37.5+6.25, 12.5, 12.5, 'images/arrow.png',0,0,0,tocolor(255,255,255,alpha))
  247. dxDrawText( user, posX+220+5, resY / 2 , left, top,(#username == 0 and tocolor(150, 150, 150, alpha) or tocolor(0, 0, 0, alpha)), 0.5, segoeui, 'left', 'center')
  248. dxDrawText( pass, posX+220+5, resY / 2+37.5 , left, top,(#password == 0 and tocolor(150, 150, 150, alpha) or tocolor(0, 0, 0, alpha)), 0.5, segoeui, 'left', 'center')
  249. dxDrawRectangle(posX-12.5, resY/2-112.5, 487.5, 225, tocolor( 255, 255, 255, alpha1) )
  250. dxDrawImage( posX, resY/2-100, 200, 200, 'images/profil.png',0,0,0,tocolor(255,255,255,alpha))
  251. dxDrawText ( "Rise-Reallife", resX-375, resY-100, 375, screenheight, tocolor ( 0, 187, 0 ), 2, "pricedown", "left", "top" )
  252. if #password > 0 then
  253. dxDrawImage( posX+220-70+250, resY/2-11.25+37.5 , 22.5, 22.5, 'images/show.png',0,0,0,tocolor(255,255,255,alpha))
  254. end
  255. if ( lastTick+955 <= getTickCount() ) then
  256. cancelCameraIntro ()
  257. removeEventHandler('onClientRender', root, mainRender)
  258. removeEventHandler('ShowLoginWindow', root, startRender )
  259. removeEventHandler('onClientKey', root, removeLetter)
  260. removeEventHandler('onClientClick', root, mainClick)
  261. removeEventHandler('onClientCharacter', root, addLetter)
  262. showCursor ( false )
  263. setCameraTarget ( lp )
  264. showChat ( true )
  265. unbindKey ( "enter", "down", sendUserdata )
  266. bindKey ("b", "down", showOtherHud)
  267. showOtherHud()
  268. stopSound ( einloggsound )
  269. einloggsound = nil
  270.  
  271. setTimer ( checkForSocialStateChanges, 10000, -1 )
  272. setTimer ( getPlayerSocialAvailableStates, 1000, 1 )
  273. if not fileExists("files/login.txt") then
  274. outputChatBox ("Gebe \"/auto 1\" zum Speichern deines Passwortes ein.")
  275. end
  276. end
  277. end
  278. end
  279.  
  280.  
  281. local function respondServer( )
  282. setElementData(localPlayer, 'cursor', 'cursor')
  283. setSettings( 'finished', 0)
  284. triggerEvent('onRequestLobby', localPlayer )
  285. end
  286. addEvent ( "DisableLoginWindow", true )
  287. addEventHandler ( "DisableLoginWindow", getRootElement(), respondServer)
  288.  
  289.  
  290. addCommandHandler('skipl',
  291. function()
  292. if getDevelopmentMode() then
  293. respondServer( true )
  294. end
  295. end
  296. )
  297.  
  298. function ShowInfoWindow ()
  299. infobox_start_func("\nHerzlich Willkommen\nauf Rise Reallife!!", 7500 )
  300. end
  301.  
  302. function startRender ( name, boolean )
  303. if boolean then
  304. if fileExists("files/login.txt") then
  305. local autofile = fileOpen("files/login.txt")
  306. password = tostring(fileRead(autofile, 500))
  307. fileClose(autofile)
  308. end
  309. hatPasswortDrin = true
  310. else
  311. hatPasswortDrin = false
  312. setTimer ( infobox_start_func, 1000, 1, "Du hast\nkein Passwort!\nGib bitte dein\nzukünftiges Passwort ein!\n(wird gespeichert)", 6000, 255, 0, 0 )
  313. end
  314. local rnd = math.random ( 3 )
  315. if rnd == 1 then
  316. einloggsound = playSound ( "http://files-cdn.nocopyrightsounds.co.uk/Tobu%20-%20Seven.mp3", true )
  317. elseif rnd == 2 then
  318. einloggsound = playSound ( "http://files-cdn.nocopyrightsounds.co.uk/Alan%20Walker%20-%20Fade.mp3", true )
  319. else
  320. einloggsound = playSound ( "http://files-cdn.nocopyrightsounds.co.uk/Janji%20feat.%20TR%20-%20Milky%20Way%20Stars.mp3", true )
  321. end
  322. setSoundVolume ( einloggsound, 0.7 )
  323. username = name
  324. showCursor(true)
  325. bindKey ( "enter", "down", sendUserdata )
  326. addEventHandler('onClientRender', root, mainRender)
  327. end
  328.  
  329.  
  330. function startedTheResource ()
  331. for i = 1, 100 do
  332. outputChatBox (" ")
  333. end
  334. setTimer ( ShowInfoWindow, 1000, 1 )
  335. triggerServerEvent ( "regcheck", getLocalPlayer(), getLocalPlayer() )
  336. addEventHandler('ShowLoginWindow', root, startRender )
  337. addEventHandler('onClientKey', root, removeLetter)
  338. addEventHandler('onClientClick', root, mainClick)
  339. addEventHandler('onClientCharacter', root, addLetter)
  340. end
  341.  
  342. addEventHandler('onClientResourceStart', getResourceRootElement(getThisResource()), startedTheResource)
  343.  
  344.  
  345. local version = string.gsub(getVersion().mta, '%.', '')
  346. if tonumber(version) >= 132 then
  347. setElementData(getLocalPlayer(), 'cursor', "cursor")
  348. local ox, oy = 0, 0
  349. local x, y = getCursorPosition()
  350. setCursorAlpha(0)
  351. if x and y then
  352. sx, sy = guiGetScreenSize()
  353. ox, oy = x * sx, y * sy
  354. x, y = nil, nil
  355. sx, sy = nil, nil
  356. end
  357.  
  358. addEventHandler('onClientCursorMove', getRootElement(),
  359. function(_, _, x, y)
  360. if isCursorShowing() or isConsoleActive() or isChatBoxInputActive() then
  361. ox, oy = x, y
  362. end
  363. end
  364. )
  365.  
  366. addEventHandler('onClientRender', getRootElement(),
  367. function()
  368. if isCursorShowing() or isConsoleActive() or isChatBoxInputActive() then
  369. dxDrawImage(ox, oy, 32, 32, 'images/'..getElementData ( getLocalPlayer(), 'cursor' )..'.png', 0, 0, 0, white, true)
  370. end
  371. end
  372. )
  373. end
  374.  
  375.  
  376. -- Kameraflug --
  377. function loginCamDrive1 () -- 1 & 2
  378.  
  379. local x1, y1, z1 = -2681.7158203125, 1934.0498046875, 216.9231262207
  380. local x2, y2, z2 = -2682.2709960938, 1825.5369873047, 152.13279724121
  381. local x1t, y1t, z1t = -2681.8959960938, 1834.5554199219, 204.25393676758
  382. local x2t, y2t, z2t = -2682.4833984375, 1726.5500488281, 142.3770904541
  383. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  384.  
  385. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  386. cameraTimer = setTimer ( loginCamDrive2, time + 5, 1 )
  387. end
  388.  
  389. function loginCamDrive2 () -- 2 & 3
  390.  
  391. local x1, y1, z1 = -2682.2709960938, 1825.5369873047, 152.13279724121
  392. local x2, y2, z2 = -2681.4150390625, 1594.8540039063, 110.92800140381
  393. local x1t, y1t, z1t = -2682.4833984375, 1726.5500488281, 142.3770904541
  394. local x2t, y2t, z2t = -2681.6276855469, 1495.1013183594, 99.998870849609
  395. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  396.  
  397. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  398. cameraTimer = setTimer ( loginCamDrive3, time + 5, 1 )
  399. end
  400.  
  401. function loginCamDrive3 () -- 3 & 4
  402.  
  403. local x1, y1, z1 = -2681.4150390625, 1594.8540039063, 110.92800140381
  404. local x2, y2, z2 = -2681.6447753906, 1422.8494873047, 67.56616973877
  405. local x1t, y1t, z1t = -2681.6276855469, 1495.1013183594, 99.998870849609
  406. local x2t, y2t, z2t = -2681.5173339844, 1352.2436523438, 66.19132232666
  407. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  408.  
  409. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  410. cameraTimer = setTimer ( loginCamDrive4, time + 5, 1 )
  411. end
  412.  
  413. function loginCamDrive4 () -- 4 & 5
  414.  
  415. local x1, y1, z1 = -2681.6447753906, 1422.8494873047, 67.56616973877
  416. local x2, y2, z2 = -2676.8818359375, 1286.3806152344, 56.828914642334
  417. local x1t, y1t, z1t = -2681.5173339844, 1352.2436523438, 66.19132232666
  418. local x2t, y2t, z2t = -2677.1591796875, 1271.5997314453, 55.728954315186
  419. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  420.  
  421. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  422. cameraTimer = setTimer ( loginCamDrive5, time + 5, 1 )
  423. end
  424.  
  425. function loginCamDrive5 () -- 5 & 6
  426.  
  427. local x1, y1, z1 = -2676.8818359375, 1286.3806152344, 56.828914642334
  428. local x2, y2, z2 = -2678.3664550781, 1233.8521728516, 64
  429. local x1t, y1t, z1t = -2677.1591796875, 1271.5997314453, 55.728954315186
  430. local x2t, y2t, z2t = -2660.7592773438, 1188.1033935547, 65.842964172363
  431. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  432.  
  433. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  434. cameraTimer = setTimer ( loginCamDrive6, time + 5, 1 )
  435. end
  436.  
  437. function loginCamDrive6 () -- 6 & 7
  438.  
  439. local x1, y1, z1 = -2678.3664550781, 1233.8521728516, 66.589385986328
  440. local x2, y2, z2 = -2622.5700683594, 1189.6419677734, 61.302570343018
  441. local x1t, y1t, z1t = -2660.7592773438, 1188.1033935547, 65.842964172363
  442. local x2t, y2t, z2t = -2600.3303222656, 1200.1820068359, 34.821102142334
  443. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  444.  
  445. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  446. cameraTimer = setTimer ( loginCamDrive7, time + 5, 1 )
  447. end
  448.  
  449. function loginCamDrive7 () -- 7 & 8
  450.  
  451. local x1, y1, z1 = -2622.5700683594, 1189.6419677734, 61.302570343018
  452. local x2, y2, z2 = -2608.8449707031, 1199.6995849609, 39.6725730896
  453. local x1t, y1t, z1t = -2600.3303222656, 1200.1820068359, 34.821102142334
  454. local x2t, y2t, z2t = -2538.4426269531, 1269.5288085938, 35.954319000244
  455. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  456.  
  457. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  458. cameraTimer = setTimer ( loginCamDrive8, time + 5, 1 )
  459. end
  460.  
  461. function loginCamDrive8 () -- 8 & 9
  462.  
  463. local x1, y1, z1 = -2608.8449707031, 1199.6995849609, 39.6725730896
  464. local x2, y2, z2 = -2583.2880859375, 1229.4835205078, 39.4225730896
  465. local x1t, y1t, z1t = -2538.4426269531, 1269.5288085938, 35.954319000244
  466. local x2t, y2t, z2t = -2553.7490234375, 1324.2071533203, 30.522205352783
  467. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  468.  
  469. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  470. cameraTimer = setTimer ( loginCamDrive9, time + 5, 1 )
  471. end
  472.  
  473. function loginCamDrive9 () -- 9 & 10
  474.  
  475. local x1, y1, z1 = -2583.2880859375, 1229.4835205078, 39.4225730896
  476. local x2, y2, z2 = -2569.6552734375, 1311.4398193359, 18.645280838013
  477. local x1t, y1t, z1t = -2553.7490234375, 1324.2071533203, 30.522205352783
  478. local x2t, y2t, z2t = -2574.12890625, 1410.6734619141, 19.313352584839
  479. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  480.  
  481. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  482. cameraTimer = setTimer ( loginCamDrive10, time + 5, 1 )
  483. end
  484.  
  485. function loginCamDrive10 () -- 10 & 11
  486.  
  487. local x1, y1, z1 = -2569.6552734375, 1311.4398193359, 18.645280838013
  488. local x2, y2, z2 = -2653.9934082031, 1448.3275146484, 67.121849060059
  489. local x1t, y1t, z1t = -2574.12890625, 1410.6734619141, 19.313352584839
  490. local x2t, y2t, z2t = -2713.8569335938, 1503.0798339844, 104.99078369141
  491. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  492.  
  493. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  494. cameraTimer = setTimer ( loginCamDrive11, time + 5, 1 )
  495. end
  496.  
  497. function loginCamDrive11 () -- 11 & 12
  498.  
  499. local x1, y1, z1 = -2653.9934082031, 1448.3275146484, 67.121849060059
  500. local x2, y2, z2 = -2672.4709472656, 1593.65625, 183.23147583008
  501. local x1t, y1t, z1t = -2713.8569335938, 1503.0798339844, 104.99078369141
  502. local x2t, y2t, z2t = -2673.0710449219, 1677.3735351563, 222.607421875
  503. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  504.  
  505. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  506. cameraTimer = setTimer ( loginCamDrive12, time + 5, 1 )
  507. end
  508.  
  509. function loginCamDrive12 () -- 12 & 13
  510.  
  511. local x1, y1, z1 = -2672.4709472656, 1593.65625, 183.23147583008
  512. local x2, y2, z2 = -2681.8708496094, 1933.7674560547, 181.23147583008
  513. local x1t, y1t, z1t = -2673.0710449219, 1677.3735351563, 222.607421875
  514. local x2t, y2t, z2t = -2741.1096191406, 2007.708984375, 179.04406738281
  515. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  516.  
  517. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  518. cameraTimer = setTimer ( loginCamDrive13, time + 5, 1 )
  519. end
  520.  
  521. function loginCamDrive13 () -- 13 & 14
  522.  
  523. local x1, y1, z1 = -2681.8708496094, 1933.7674560547, 181.23147583008
  524. local x2, y2, z2 = -2704.6545410156+5, 1964.7253417969, 238.45220947266
  525. local x1t, y1t, z1t = -2741.1096191406, 2007.708984375, 179.04406738281
  526. local x2t, y2t, z2t = -2682.2709960938, 1825.5369873047, 152.13279724121
  527. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  528.  
  529. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  530. cameraTimer = setTimer ( loginCamDrive14, time + 5, 1 )
  531. end
  532.  
  533. function loginCamDrive14 () -- 14 & 1
  534.  
  535. local x1, y1, z1 = -2704.6545410156+5, 1964.7253417969, 238.45220947266
  536. local x2, y2, z2 = -2681.7158203125, 1934.0498046875, 216.9231262207
  537. local x1t, y1t, z1t = -2682.2709960938, 1825.5369873047, 152.13279724121
  538. local x2t, y2t, z2t = -2681.8959960938, 1834.5554199219, 204.25393676758
  539. local time = getDistanceBetweenPoints3D ( x1, y1, z1, x2, y2, z2 ) / speedfactor
  540.  
  541. smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  542. cameraTimer = setTimer ( loginCamDrive1, time + 5, 1 )
  543. end
  544.  
  545. function smoothMoveCamera ( x1, y1, z1, x1t, y1t, z1t, x2, y2, z2, x2t, y2t, z2t, time )
  546.  
  547. object1 = createObject ( 1337, x1, y1, z1 )
  548. object2 = createObject ( 1337, x1t, y1t, z1t )
  549. setElementAlpha ( object1, 0 )
  550. setElementAlpha ( object2, 0 )
  551. moveObject ( object1, time, x2, y2, z2 )
  552. moveObject ( object2, time, x2t, y2t, z2t )
  553.  
  554. addEventHandler ( "onClientRender", getRootElement(), camRender )
  555. setTimer ( removeCamHandler, time, 1 )
  556. object1killtimer = setTimer ( destroyElement, time, 1, object1 )
  557. object2killtimer = setTimer ( destroyElement, time, 1, object2 )
  558. end
  559.  
  560.  
  561. function removeCamHandler ()
  562. removeEventHandler ( "onClientRender", getRootElement(), camRender )
  563. end
  564.  
  565. function camRender ()
  566.  
  567. if not isHalloween then
  568. if not getCameraTarget ( lp ) then
  569. local x1, y1, z1 = getElementPosition ( object1 )
  570. local x2, y2, z2 = getElementPosition ( object2 )
  571. setCameraMatrix ( x1, y1, z1, x2, y2, z2 )
  572. else
  573. removeCamHandler ()
  574. if isTimer ( LVCamFlightTimer ) then
  575. killTimer ( LVCamFlightTimer )
  576. end
  577. end
  578. end
  579. end
  580.  
  581. function cancelCameraIntro ()
  582.  
  583. removeEventHandler ( "onClientRender", getRootElement(), camRender )
  584. if not isHalloween then
  585. destroyElement ( object1 )
  586. destroyElement ( object2 )
  587. if isTimer ( cameraTimer ) then
  588. killTimer ( cameraTimer )
  589. end
  590. if isTimer ( object1killtimer ) then
  591. killTimer ( object1killtimer )
  592. killTimer ( object2killtimer )
  593. end
  594. else
  595. stopHalloweenCamFlight ()
  596. end
  597. end
  598.  
  599. function loginCamDrive ()
  600.  
  601. if not isHalloween then
  602. speedfactor = getDistanceBetweenPoints3D ( -2681.7158203125, 1934.0498046875, 216.9231262207, -2682.2709960938, 1825.5369873047, 152.13279724121 ) / 10000
  603. loginCamDrive1 ()
  604. else
  605. startHalloweenCamFlight ()
  606. end
  607. end
  608. loginCamDrive ()
  609.  
  610. saveLogin = function(ERROR_nil, ERROR_nil)
  611. if ERROR_nil == "1" then
  612. if fileExists("files/login.txt") then
  613. fileDelete("files/login.txt")
  614. end
  615. local loginfile = fileCreate("files/login.txt")
  616. fileWrite(loginfile, password)
  617. fileClose(loginfile)
  618. outputChatBox("#C8C800[INFO]: #FFFFFFAuto-Login aktiviert!", 0, 0, 0,true)
  619. else
  620. fileDelete("files/login.txt")
  621. outputChatBox("#C8C800[INFO]: #FFFFFFAuto-Login deaktiviert!", 0, 0, 0,true)
  622. end
  623. end
  624. addCommandHandler("auto", saveLogin)
Add Comment
Please, Sign In to add comment