Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.10 KB | None | 0 0
  1. local sx,sy = guiGetScreenSize()
  2. local playerName = getPlayerName ( localPlayer )
  3. local ped = createPed(242, 2432.24609375, -2095.853515625, 13.546875)
  4. local sx,sy = guiGetScreenSize()
  5.  
  6.  
  7. PanelOption = {}
  8. PanelOption["ShowingPanel"] = false
  9. function onPedClick(button, state, absX, absY, wx, wy, wz, element)
  10. if element and getElementType(element) == "ped" and state=="down" and not PanelOption["ShowingPanel"] then
  11. local x, y, z = getElementPosition(getLocalPlayer())
  12. if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then
  13. PanelOption["ShowingPanel"] = true
  14. PanelOption["ShowedPanel"] = 1
  15. removeEventHandler("onClientRender", root, drawPanel)
  16. addEventHandler("onClientRender", root, drawPanel)
  17. end
  18. end
  19. end
  20. addEventHandler("onClientClick", getRootElement(), onPedClick)
  21.  
  22. function drawPanel()
  23. if PanelOption["ShowedPanel"] == 1 and PanelOption["ShowingPanel"] then
  24. dxDrawRectangle ( sx/2-175, sy/2-200, sx/5, sy/2.5, tocolor ( 0, 0, 0, 230 ) )
  25. dxDrawRectangle ( sx/2-179, sy/2-205, sx/4.9, sy/2.445, tocolor ( 0, 0, 0, 155 ) )
  26. dxDrawText("Válaszd ki melyik járművet szeretnéd.", sx/2-160, sy/2-195, _, _, tocolor(255, 255, 255, 255), 1.5, 1.5, "clear-normal")
  27. dxDrawRectangle(sx/2-165, sy/2-160, 315, 40, tocolor(255, 255, 255, 150))
  28. dxDrawRectangle(sx/2-165, sy/2-125, 315, 8, tocolor(67, 158, 211, 255))
  29. dxDrawText("Jármű 1", sx/2-50, sy/2-160, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  30. dxDrawRectangle(sx/2-165, sy/2-100, 315, 40, tocolor(255, 255, 255, 150))
  31. dxDrawRectangle(sx/2-165, sy/2-65, 315, 8, tocolor(67, 158, 211, 255))
  32. dxDrawText("Jármű 2", sx/2-50, sy/2-100, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  33. dxDrawRectangle(sx/2-165, sy/2-40, 315, 40, tocolor(255, 255, 255, 150))
  34. dxDrawRectangle(sx/2-165, sy/2-5, 315, 8, tocolor(67, 158, 211, 255))
  35. dxDrawText("Mégse", sx/2-50, sy/2-40, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  36. end
  37. end
  38.  
  39. function clickFunction(button,state,x,y)
  40. if button == "left" and state == "down" then
  41. if PanelOption["ShowedPanel"] == 1 then
  42. if box(sx/2-165,sy/2-160,315,40,x,y) then
  43. PanelOption["ShowingPanel"] = false
  44. outputChatBox("mennyé be a markerbe!")
  45. car1 = createMarker(2438.1162109375, -2096.0439453125, 12.546875, "cylinder", 1)
  46. removeEventHandler("onClientRender", root, drawPanel)
  47. end
  48. addEventHandler("onClientMarkerHit", root,
  49. function ()
  50. if isElementWithinMarker(localPlayer, car1) then
  51. outputChatBox("asdasd")
  52. triggerServerEvent ( "giveVehicle", localPlayer, localPlayer )
  53. destroyElement(car1)
  54. boxPickUp = createMarker(2459.8974609375, -2114.5537109375, 12.546875, "cylinder", 1)
  55. elseif isElementWithinMarker(localPlayer, boxPickUp) then
  56. outputChatBox("belemnté")
  57. triggerServerEvent( "objectMoves", localPlayer, localPlayer )
  58. end
  59. end)
  60. elseif box(sx/2-165,sy/2-100, 315, 40, x,y) then
  61. end
  62. elseif PanelOption["ShowedPanel"] == 2 then
  63. end
  64. end
  65. addEventHandler("onClientClick", root, clickFunction)
  66.  
  67. function boxVehicleAdd(button, state, absX, absY, wx, wy, wz, element)
  68. if button == "left" and state == "down" then
  69. local x, y, z = getElementPosition(getLocalPlayer())
  70. if element and isElement(element) and getElementType(element) == "vehicle" and getElementModel(element) == 499 then
  71. if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then
  72. toggleControl("jump", false)
  73. triggerServerEvent("clickVehicle", localPlayer, localPlayer)
  74. end
  75. end
  76. end
  77. end
  78. addEventHandler("onClientClick", getRootElement(), boxVehicleAdd)
  79.  
  80. function isInRectangle(x,y,w,h)
  81. if isCursorShowing() then
  82. local mx,my = getCursorPosition()
  83. local cursorx, cursory = mx*sx,my*sy
  84. if cursorx > x and cursorx < x + w and cursory > y and cursory < y+h then
  85. return true
  86. else
  87. return false
  88. end
  89. end
  90. end
  91.  
  92. function box(dx, dy, dsz, dm, ex, ey)
  93. if (ex >= dx and ex <= dx + dsz and ey >= dy and ey <= dy + dm) then
  94. return true
  95. else
  96. return false
  97. end
  98. end
  99.  
  100.  
  101. local sx,sy = guiGetScreenSize()
  102. local playerName = getPlayerName ( localPlayer )
  103. local ped = createPed(242, 2432.24609375, -2095.853515625, 13.546875)
  104. local sx,sy = guiGetScreenSize()
  105.  
  106.  
  107. PanelOption = {}
  108. PanelOption["ShowingPanel"] = false
  109. function onPedClick(button, state, absX, absY, wx, wy, wz, element)
  110. if element and getElementType(element) == "ped" and state=="down" and not PanelOption["ShowingPanel"] then
  111. local x, y, z = getElementPosition(getLocalPlayer())
  112. if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then
  113. PanelOption["ShowingPanel"] = true
  114. PanelOption["ShowedPanel"] = 1
  115. removeEventHandler("onClientRender", root, drawPanel)
  116. addEventHandler("onClientRender", root, drawPanel)
  117. end
  118. end
  119. end
  120. addEventHandler("onClientClick", getRootElement(), onPedClick)
  121.  
  122. function drawPanel()
  123. if PanelOption["ShowedPanel"] == 1 and PanelOption["ShowingPanel"] then
  124. dxDrawRectangle ( sx/2-175, sy/2-200, sx/5, sy/2.5, tocolor ( 0, 0, 0, 230 ) )
  125. dxDrawRectangle ( sx/2-179, sy/2-205, sx/4.9, sy/2.445, tocolor ( 0, 0, 0, 155 ) )
  126. dxDrawText("Válaszd ki melyik járművet szeretnéd.", sx/2-160, sy/2-195, _, _, tocolor(255, 255, 255, 255), 1.5, 1.5, "clear-normal")
  127. dxDrawRectangle(sx/2-165, sy/2-160, 315, 40, tocolor(255, 255, 255, 150))
  128. dxDrawRectangle(sx/2-165, sy/2-125, 315, 8, tocolor(67, 158, 211, 255))
  129. dxDrawText("Jármű 1", sx/2-50, sy/2-160, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  130. dxDrawRectangle(sx/2-165, sy/2-100, 315, 40, tocolor(255, 255, 255, 150))
  131. dxDrawRectangle(sx/2-165, sy/2-65, 315, 8, tocolor(67, 158, 211, 255))
  132. dxDrawText("Jármű 2", sx/2-50, sy/2-100, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  133. dxDrawRectangle(sx/2-165, sy/2-40, 315, 40, tocolor(255, 255, 255, 150))
  134. dxDrawRectangle(sx/2-165, sy/2-5, 315, 8, tocolor(67, 158, 211, 255))
  135. dxDrawText("Mégse", sx/2-50, sy/2-40, _, _, tocolor(0, 0, 0, 255), 2, 2, "clear-normal")
  136. end
  137. end
  138.  
  139. function clickFunction(button,state,x,y)
  140. if button == "left" and state == "down" then
  141. if PanelOption["ShowedPanel"] == 1 then
  142. if box(sx/2-165,sy/2-160,315,40,x,y) then
  143. PanelOption["ShowingPanel"] = false
  144. outputChatBox("mennyé be a markerbe!")
  145. car1 = createMarker(2438.1162109375, -2096.0439453125, 12.546875, "cylinder", 1)
  146. removeEventHandler("onClientRender", root, drawPanel)
  147. end
  148. addEventHandler("onClientMarkerHit", root,
  149. function ()
  150. if isElementWithinMarker(localPlayer, car1) then
  151. outputChatBox("asdasd")
  152. triggerServerEvent ( "giveVehicle", localPlayer, localPlayer )
  153. destroyElement(car1)
  154. boxPickUp = createMarker(2459.8974609375, -2114.5537109375, 12.546875, "cylinder", 1)
  155. elseif isElementWithinMarker(localPlayer, boxPickUp) then
  156. outputChatBox("belemnté")
  157. triggerServerEvent( "objectMoves", localPlayer, localPlayer )
  158. end
  159. end)
  160. elseif box(sx/2-165,sy/2-100, 315, 40, x,y) then
  161. end
  162. elseif PanelOption["ShowedPanel"] == 2 then
  163. end
  164. end
  165. addEventHandler("onClientClick", root, clickFunction)
  166.  
  167. function boxVehicleAdd(button, state, absX, absY, wx, wy, wz, element)
  168. if button == "left" and state == "down" then
  169. local x, y, z = getElementPosition(getLocalPlayer())
  170. if element and isElement(element) and getElementType(element) == "vehicle" and getElementModel(element) == 499 then
  171. if getDistanceBetweenPoints3D(x, y, z, wx, wy, wz)<=3 then
  172. toggleControl("jump", false)
  173. triggerServerEvent("clickVehicle", localPlayer, localPlayer)
  174. end
  175. end
  176. end
  177. end
  178. addEventHandler("onClientClick", getRootElement(), boxVehicleAdd)
  179.  
  180. function isInRectangle(x,y,w,h)
  181. if isCursorShowing() then
  182. local mx,my = getCursorPosition()
  183. local cursorx, cursory = mx*sx,my*sy
  184. if cursorx > x and cursorx < x + w and cursory > y and cursory < y+h then
  185. return true
  186. else
  187. return false
  188. end
  189. end
  190. end
  191.  
  192. function box(dx, dy, dsz, dm, ex, ey)
  193. if (ex >= dx and ex <= dx + dsz and ey >= dy and ey <= dy + dm) then
  194. return true
  195. else
  196. return false
  197. end
  198. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement