Advertisement
Guest User

Готово

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