Advertisement
Guest User

Untitled

a guest
Oct 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.00 KB | None | 0 0
  1. --[[
  2.     Developers:
  3.         • .WhiteBlue (szymon.lua@gmail.com)
  4.  
  5.     Copyright (c) 2018 .WhiteBlue (szymon.lua@gmail.com)
  6.  
  7.     Note (EN): You can not copy and share this code without my permission.
  8.     Note (PL): Nie możesz kopiować i udostępniać tego kodu bez mojej zgody.
  9. ]]
  10.  
  11. -- Variables
  12. local map = { ['player'] = {} }
  13.  
  14. map['settings'] = {
  15.     ['world_size'] = { ['w'] = 1536, ['h'] = 1536, },
  16. }
  17.  
  18. local rt = dxCreateRenderTarget(1536, 1536)
  19.  
  20. -- Functions
  21. map['render'] = function()
  22.     if not move_x then move_x = 0 end
  23.     if not move_y then move_y = 0 end
  24.  
  25.     if not last_move_x then last_move_x = 0 end
  26.     if not last_move_y then last_move_y = 0 end
  27.  
  28.     local cursor_x, cursor_y = getCursorPosition()
  29.  
  30.     if getKeyState('num_4') then
  31.         if scale_x(move_x - map['player']['scale']) < 0 then
  32.             move_x = move_x + 20
  33.         end
  34.  
  35.     elseif getKeyState('num_6') then
  36.         if scale_x(move_x) < scale_x(move_x + map['player']['scale']) then
  37.             move_x = move_x - 20
  38.         end
  39.     end
  40.  
  41.     iprint(move_x - map['player']['scale'], move_x + map['player']['scale'])
  42.  
  43.     if getKeyState('num_8') then
  44.         if scale_y(move_y - map['player']['scale']) < 0 then
  45.             move_y = move_y + 10
  46.         end
  47.  
  48.     elseif getKeyState('num_2') then
  49.         if scale_y(move_y - map['player']['scale']) < 0 then
  50.             move_y = move_y - 10
  51.             iprint(move_y)
  52.         end
  53.     end
  54.  
  55.     -- F11
  56.  
  57.     local position_player = Vector3(getElementPosition(localPlayer))
  58.  
  59.     local material_x, material_y = (position_player['x'] / (6000 / map['settings']['world_size']['w'])), (position_player['y'] / (6000 / map['settings']['world_size']['h']))
  60.     local material_w, material_h = dxGetMaterialSize(rt)
  61.  
  62.     dxSetRenderTarget(rt, true)
  63.  
  64.     dxDrawRectangle(0, 0, material_w, material_h, 0xFF54707e)
  65.     dxDrawImage(scale_x(move_x - map['player']['scale']), scale_y(move_y - map['player']['scale']), material_w + map['player']['scale'], material_h + map['player']['scale'], 'i/map.png', 0, 0, 0)
  66.  
  67.     dxSetRenderTarget()
  68.  
  69.     dxDrawImage(scale_x(510), scale_y(140), scale_x(900), scale_y(800), rt, 0, 0, 0, tocolor(255, 255, 255, 200))
  70. end
  71.  
  72. map['show'] = function()
  73.     map['player'] = {
  74.         ['toggled'] = true,
  75.        
  76.         ['scale'] = 1,
  77.     },
  78.  
  79.     showCursor(true, false)
  80.  
  81.     addEventHandler('onClientRender', root, map['render'])
  82. end
  83.  
  84. map['hide'] = function()
  85.     map['player'] = {}
  86.  
  87.     showCursor(false)
  88.    
  89.     removeEventHandler('onClientRender', root, map['render'])
  90. end
  91.  
  92.  
  93. bindKey('mouse_wheel_up', 'down', function()
  94.     if not map['player']['scale'] then map['player']['scale'] = 1 end
  95.     if map['player']['scale'] < 2000 then
  96.         map['player']['scale'] = map['player']['scale'] + 100
  97.     end
  98. end)
  99.  
  100. bindKey('mouse_wheel_down', 'down', function()
  101.     if not map['player']['scale'] then map['player']['scale'] = 1 end
  102.     if map['player']['scale'] > 1 then
  103.         map['player']['scale'] = map['player']['scale'] - 100
  104.     end
  105. end)
  106.  
  107. bindKey('F11', 'down', function()
  108.     if map['player']['toggled'] then
  109.         map['hide']()
  110.     else
  111.         map['show']()
  112.     end
  113. end)
  114.  
  115. addEventHandler('onClientResourceStart', resourceRoot, function() toggleControl('radar', false) end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement