Advertisement
Guest User

Инвентарь. Попытка 2

a guest
Jun 2nd, 2015
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.38 KB | None | 0 0
  1. GUIEditor = {
  2.     gridlist = {},
  3.     window = {},
  4.     button = {},
  5.     label = {}
  6. }
  7.  
  8. addEventHandler("onClientResourceStart", localPlayer,
  9.     function()
  10.         local screenW, screenH = guiGetScreenSize()
  11.         GUIEditor.window[1] = guiCreateWindow((screenW - 528) / 2, (screenH - 600) / 2, 528, 600, "Статистика", false)
  12.         guiWindowSetSizable(GUIEditor.window[1], false)
  13.         guiSetAlpha(GUIEditor.window[1], 0.59)
  14.  
  15.         GUIEditor.gridlist[1] = guiCreateGridList(232, 24, 286, 552, false, GUIEditor.window[1])
  16.         guiGridListAddColumn(GUIEditor.gridlist[1], "название", 0.3)
  17.         guiGridListAddColumn(GUIEditor.gridlist[1], "количество", 0.3)
  18.         guiGridListAddColumn(GUIEditor.gridlist[1], "вес", 0.3)
  19.         guiGridListAddRow(GUIEditor.gridlist[1])
  20.         guiGridListSetItemText(GUIEditor.gridlist[1], 0, 1, "AK47", false, false)
  21.         guiGridListSetItemText(GUIEditor.gridlist[1], 0, 2, "1", false, false)
  22.         guiGridListSetItemText(GUIEditor.gridlist[1], 0, 3, "4.8", false, false)
  23.  
  24.         GUIEditor.button[1] = guiCreateButton(-230, 7, 107, 97, "", false, GUIEditor.gridlist[1])
  25.  
  26.         GUIEditor.label[1] = guiCreateLabel(232, 576, 286, 14, "Слоты: 1/8шт. Вес 4.8/50 кг", false, GUIEditor.window[1])
  27.         guiLabelSetHorizontalAlign(GUIEditor.label[1], "center", false)
  28.         GUIEditor.button[2] = guiCreateButton(84, 98, 64, 138, "armor", false, GUIEditor.window[1])
  29.         GUIEditor.button[3] = guiCreateButton(10, 24, 64, 286, "second weapon", false, GUIEditor.window[1])
  30.         GUIEditor.button[4] = guiCreateButton(84, 24, 64, 64, "mask", false, GUIEditor.window[1])
  31.         GUIEditor.button[5] = guiCreateButton(158, 24, 64, 286, "primary weapon", false, GUIEditor.window[1])
  32.         GUIEditor.button[6] = guiCreateButton(84, 246, 64, 64, "special", false, GUIEditor.window[1])
  33.         GUIEditor.button[7] = guiCreateButton(10, 320, 64, 64, "F1", false, GUIEditor.window[1])
  34.         GUIEditor.button[8] = guiCreateButton(84, 320, 64, 64, "F2", false, GUIEditor.window[1])
  35.         GUIEditor.button[9] = guiCreateButton(158, 320, 64, 64, "F3", false, GUIEditor.window[1])  
  36.         GUIEditor.button[10] = guiCreateButton(10, 572, 212, 18, "Получить стартовый набор", false, GUIEditor.window[1])
  37.         guiSetVisible ( GUIEditor.window[1], false )
  38.     end
  39. )
  40.  
  41. function refreshInventory ()
  42.         local weight = 0
  43.         outputChatBox ( "Инвентарь: вывод имени", localPlayer )
  44.         guiSetText ( GUIEditor.window[1], "Инвентарь: " .. getPlayerName(localPlayer))
  45.         --[[
  46.         outputChatBox ( "Инвентарь: загрузка праймари", localPlayer )
  47.         if getElementData(localPlayer, "dayz.primary_weapon_slot") then
  48.                 guiSetText ( GUIEditor.button[5], items[getElementData(localPlayer, "dayz.primary_weapon_slot")][1] )
  49.                 weight = weight +  items[getElementData(localPlayer, "dayz.primary_weapon_slot")][2]
  50.         else
  51.                 guiSetText ( GUIEditor.button[5], "пусто" )
  52.         end
  53.         outputChatBox ( "Инвентарь: загрузка секонд", localPlayer )
  54.         if getElementData(localPlayer, "dayz.second_weapon_slot") then
  55.                 guiSetText ( GUIEditor.button[3], items[getElementData(localPlayer, "dayz.second_weapon_slot")][1] )
  56.                 weight = weight +  items[getElementData(localPlayer, "dayz.second_weapon_slot")][2]
  57.         else
  58.                 guiSetText ( GUIEditor.button[3], "пусто" )
  59.         end
  60.        
  61.         if getElementData(localPlayer, "dayz.special_weapon_slot") then
  62.                 guiSetText ( GUIEditor.button[6], items[getElementData(localPlayer, "dayz.special_weapon_slot")][1] )
  63.                 weight = weight +  items[getElementData(localPlayer, "dayz.special_weapon_slot")][2]
  64.         else
  65.                 guiSetText ( GUIEditor.button[6], "пусто" )
  66.         end
  67.        
  68.         if getElementData(localPlayer, "dayz.fast_slot1") then
  69.                 guiSetText ( GUIEditor.button[7], items[getElementData(localPlayer, "dayz.fast_slot1")][1] )
  70.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot1")][2]
  71.         else
  72.                 guiSetText ( GUIEditor.button[7], "пусто" )
  73.         end
  74.        
  75.         if getElementData(localPlayer, "dayz.fast_slot2") then
  76.                 guiSetText ( GUIEditor.button[8], items[getElementData(localPlayer, "dayz.fast_slot2")][1] )
  77.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot2")][2]
  78.         else
  79.                 guiSetText ( GUIEditor.button[8], "пусто" )
  80.         end
  81.        
  82.         if getElementData(localPlayer, "dayz.fast_slot3") then
  83.                 guiSetText ( GUIEditor.button[9], items[getElementData(localPlayer, "dayz.fast_slot3")][1] )
  84.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot3")][2]
  85.         else
  86.                 guiSetText ( GUIEditor.button[9], "пусто" )
  87.         end
  88.        
  89.         if getElementData(localPlayer, "dayz.mask_slot") then
  90.                 guiSetText ( GUIEditor.button[4], items[getElementData(localPlayer, "dayz.mask_slot")][1] )
  91.                 weight = weight +  items[getElementData(localPlayer, "dayz.mask_slot")][2]
  92.         else
  93.                 guiSetText ( GUIEditor.button[4], "пусто" )
  94.         end
  95.        
  96.         if getElementData(localPlayer, "dayz.armor_slot") then
  97.                 guiSetText ( GUIEditor.button[2], items[getElementData(localPlayer, "dayz.armor_slot")][1] )
  98.                 weight = weight +  items[getElementData(localPlayer, "dayz.armor_slot")][2]
  99.         else
  100.                 guiSetText ( GUIEditor.button[2], "пусто" )
  101.         end
  102.         guiSetText ( GUIEditor.label[1], "Вес: " .. weight .."/ 228кг." )]]--
  103. end
  104.  
  105. function showInventory ()
  106.         outputChatBox ( "Открытие инвентаря")        
  107.         if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then -- check if the gui element is visible              
  108.                 guiSetVisible ( GUIEditor.window[1], false ) -- if it is, we hide it
  109.                 showCursor(false)  
  110.         else            
  111.                 guiSetVisible ( GUIEditor.window[1], true ) -- if not, we make it visible
  112.                
  113.                 showCursor(true)  
  114.                 refreshInventory()
  115.         end
  116. end
  117.  
  118. bindKey ( "i", "down", showInventory, localPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement