Advertisement
Kezoto

Untitled

Aug 6th, 2020
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1.  
  2. x,y=36.63,82.19 -- my width
  3. intro_step=math.random(0,850)
  4.  
  5. local muzyka = false
  6. local tick2 = getTickCount()
  7. local sx,sy=guiGetScreenSize()
  8.  
  9. local data={ showed=nil, button={}, info=nil, misc=nil, }
  10.  
  11. local sw,sh = guiGetScreenSize()
  12. local zoom = 1
  13. if sw < 1920 then
  14. zoom = math.min(2, 1920 / sw)
  15. end
  16.  
  17. function getCenter(x, y)
  18. x,y = x / zoom, y / zoom
  19. return (sw / 2) - (x / 2), (sh / 2) - (y / 2)
  20. end
  21.  
  22. local sm = {}
  23. sm.moov = 0
  24. sm.object1,sm.object2 = nil,nil
  25.  
  26. local function removeCamHandler()
  27. if(sm.moov == 1)then
  28. sm.moov = 0
  29. end
  30. end
  31.  
  32. local function camRender2()
  33. if (sm.moov == 1) then
  34. local x1,y1,z1 = getElementPosition(sm.object1)
  35. local x2,y2,z2 = getElementPosition(sm.object2)
  36. setCameraMatrix(x1,y1,z1,x2,y2,z2)
  37. end
  38. end
  39. addEventHandler("onClientPreRender",root,camRender2)
  40.  
  41. function smoothMoveCamera2(x1,y1,z1,x1t,y1t,z1t,x2,y2,z2,x2t,y2t,z2t,time)
  42. if(sm.moov == 1)then return false end
  43. sm.object1 = createObject(1337,x1,y1,z1)
  44. sm.object2 = createObject(1337,x1t,y1t,z1t)
  45. setElementAlpha(sm.object1,0)
  46. setElementAlpha(sm.object2,0)
  47. setObjectScale(sm.object1,0.01)
  48. setObjectScale(sm.object2,0.01)
  49. moveObject(sm.object1,time,x2,y2,z2,0,0,0,"InOutQuad")
  50. moveObject(sm.object2,time,x2t,y2t,z2t,0,0,0,"InOutQuad")
  51. sm.moov = 1
  52. setTimer(removeCamHandler,time,1)
  53. setTimer(destroyElement,time,1,sm.object1)
  54. setTimer(destroyElement,time,1,sm.object2)
  55. return true
  56. end
  57.  
  58. function isMouseIn ( x, y, width, height )
  59. if ( not isCursorShowing( ) ) then
  60. return false
  61. end
  62. local sx, sy = guiGetScreenSize ( )
  63. local cx, cy = getCursorPosition ( )
  64. local cx, cy = ( cx * sx ), ( cy * sy )
  65.  
  66. return ( ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) )
  67. end
  68.  
  69. local dist = 200
  70. local angler = 0
  71. function getPointFromDistanceRotation(x, y, dist, angler)
  72. local a = math.rad(270 - angler)
  73. local dx = math.cos(a) * dist;
  74. local dy = math.sin(a) * dist;
  75. return x+dx, y+dy;
  76. end
  77.  
  78. local texture_choose = dxCreateTexture('img/choosepanel.png','argb',true,'clamp')
  79.  
  80. function renderZoneBox()
  81. local x_1, y_1 = getCenter(400,500)
  82. dxDrawImage(x_1, y_1, 400/zoom, 500/zoom, texture_choose, 0, 0, 0, tocolor(255, 255, 255, 255), false)
  83.  
  84. smoothMoveCamera2(-1490.93, 926.77, 57.32, -1490.93, 926.77, 57.32, -2001.11, 926.00, 65.32, -2001.11, 926.00, 65.32, 45000)
  85. end
  86.  
  87. function math.round(number, decimals, method)
  88. decimals = decimals or 0
  89. local factor = 10 ^ decimals
  90. if (method == "ceil" or method == "floor") then return math[method](number * factor) / factor
  91. else return tonumber(("%."..decimals.."f"):format(number)) end
  92. end
  93.  
  94. function onClick(btn,state)
  95. if btn=="left" and state=="down" then
  96. local x_2, y_2 = getCenter(328,-122)
  97. local _, y_3 = getCenter(328,40)
  98. local _, y_4 = getCenter(328,200)
  99. local _, y_5 = getCenter(328,355)
  100.  
  101. if isMouseIn(x_2, y_5, 328/zoom, 65/zoom) and data.showed then
  102. setElementData(localPlayer,"player:spawn",{-2673.64, -5.47, 6.13+0.1})
  103. closeZones()
  104. elseif isMouseIn(x_2, y_4, 328/zoom, 65/zoom) and data.showed then
  105. setElementData(localPlayer,"player:spawn",{2182.57, 1115.87, 12.65+0.1})
  106. closeZones()
  107. elseif isMouseIn(638, 318, 77, 16) and data.showed then
  108. setElementData(localPlayer,"player:spawn",{1012.77, -1441.49, 13.55+0.1})
  109. closeZones()
  110. elseif isMouseIn(x_2, y_2, 328/zoom, 65/zoom) and data.showed then
  111. setElementData(localPlayer,"player:spawn",{-2015.83, -97.76, 35.39+0.1})
  112. closeZones()
  113. elseif isMouseIn(x_2, y_3, 328/zoom, 65/zoom) and data.showed then
  114. local domek=getElementData(localPlayer,"player:house")
  115. if not domek then
  116. setElementData(localPlayer,"player:spawn",{-1915.49, 881.90, 35.41+0.1})
  117. outputChatBox("Nie posiadasz domku!")
  118. end
  119. closeZones()
  120. end
  121. end
  122. end
  123.  
  124.  
  125. function closeZones()
  126. showChat(true)
  127. showCursor(false)
  128. fadeCamera(false)
  129. setElementAlpha(localPlayer,255)
  130. stopSound(muzyka)
  131. showPlayerHudComponent("all",false)
  132. showPlayerHudComponent("radar",true)
  133. showPlayerHudComponent("crosshair",true)
  134. showPlayerHudComponent("weapon",false)
  135. showPlayerHudComponent("health",false)
  136. showPlayerHudComponent("breath",false)
  137. showPlayerHudComponent("ammo",true)
  138. data.showed=false
  139. local tick2 = getTickCount()
  140. triggerServerEvent("core:spawnPlayer", localPlayer)
  141. setTimer(triggerEvent, 250, 1, "gui:start", localPlayer)
  142. removeEventHandler("onClientRender", root, renderZoneBox)
  143. removeEventHandler("onClientPreRender",root,camRender2)
  144. blur = false
  145. end
  146.  
  147. function showZones(misc)
  148. muzyka=misc
  149. data.showed=true
  150. showPlayerHudComponent("all",false)
  151. guiSetInputMode("no_binds_when_editing")
  152. local tick2 = getTickCount()
  153. addEventHandler("onClientRender", root, renderZoneBox)
  154. addEventHandler("onClientClick", root, onClick)
  155. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement