Advertisement
Guest User

Какой смысл?

a guest
Jun 2nd, 2015
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.33 KB | None | 0 0
  1. GUIEditor = {
  2.     gridlist = {},
  3.     window = {},
  4.     button = {},
  5.     label = {}
  6. }
  7.  
  8. addEventHandler("onClientResourceStart", resourceRoot,
  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.         outputChatBox ( "Инвентарь: загрузка праймари")
  46.         if getElementData(localPlayer, "dayz.primary_weapon_slot") then
  47.                 guiSetText ( GUIEditor.button[5], items[getElementData(localPlayer, "dayz.primary_weapon_slot")][1] )
  48.                 weight = weight +  items[getElementData(localPlayer, "dayz.primary_weapon_slot")][2]
  49.         else
  50.                 guiSetText ( GUIEditor.button[5], "пусто" )
  51.         end
  52.         outputChatBox ( "Инвентарь: загрузка секонд")
  53.         if getElementData(localPlayer, "dayz.second_weapon_slot") then
  54.                 guiSetText ( GUIEditor.button[3], items[getElementData(localPlayer, "dayz.second_weapon_slot")][1] )
  55.                 weight = weight +  items[getElementData(localPlayer, "dayz.second_weapon_slot")][2]
  56.         else
  57.                 guiSetText ( GUIEditor.button[3], "пусто" )
  58.         end
  59.        
  60.         if getElementData(localPlayer, "dayz.special_weapon_slot") then
  61.                 guiSetText ( GUIEditor.button[6], items[getElementData(localPlayer, "dayz.special_weapon_slot")][1] )
  62.                 weight = weight +  items[getElementData(localPlayer, "dayz.special_weapon_slot")][2]
  63.         else
  64.                 guiSetText ( GUIEditor.button[6], "пусто" )
  65.         end
  66.        
  67.         if getElementData(localPlayer, "dayz.fast_slot1") then
  68.                 guiSetText ( GUIEditor.button[7], items[getElementData(localPlayer, "dayz.fast_slot1")][1] )
  69.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot1")][2]
  70.         else
  71.                 guiSetText ( GUIEditor.button[7], "пусто" )
  72.         end
  73.        
  74.         if getElementData(localPlayer, "dayz.fast_slot2") then
  75.                 guiSetText ( GUIEditor.button[8], items[getElementData(localPlayer, "dayz.fast_slot2")][1] )
  76.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot2")][2]
  77.         else
  78.                 guiSetText ( GUIEditor.button[8], "пусто" )
  79.         end
  80.        
  81.         if getElementData(localPlayer, "dayz.fast_slot3") then
  82.                 guiSetText ( GUIEditor.button[9], items[getElementData(localPlayer, "dayz.fast_slot3")][1] )
  83.                 weight = weight +  items[getElementData(localPlayer, "dayz.fast_slot3")][2]
  84.         else
  85.                 guiSetText ( GUIEditor.button[9], "пусто" )
  86.         end
  87.        
  88.         if getElementData(localPlayer, "dayz.mask_slot") then
  89.                 guiSetText ( GUIEditor.button[4], items[getElementData(localPlayer, "dayz.mask_slot")][1] )
  90.                 weight = weight +  items[getElementData(localPlayer, "dayz.mask_slot")][2]
  91.         else
  92.                 guiSetText ( GUIEditor.button[4], "пусто" )
  93.         end
  94.        
  95.         if getElementData(localPlayer, "dayz.armor_slot") then
  96.                 guiSetText ( GUIEditor.button[2], items[getElementData(localPlayer, "dayz.armor_slot")][1] )
  97.                 weight = weight +  items[getElementData(localPlayer, "dayz.armor_slot")][2]
  98.         else
  99.                 guiSetText ( GUIEditor.button[2], "пусто" )
  100.         end
  101.         guiSetText ( GUIEditor.label[1], "Вес: " .. weight .."/ 228кг." )
  102. end
  103.  
  104. function showInventory ()
  105.         outputChatBox ( "Открытие инвентаря")        
  106.         if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then -- check if the gui element is visible              
  107.                 guiSetVisible ( GUIEditor.window[1], false ) -- if it is, we hide it
  108.                 showCursor(false)  
  109.         else            
  110.                 guiSetVisible ( GUIEditor.window[1], true ) -- if not, we make it visible
  111.                
  112.                 showCursor(true)  
  113.                 refreshInventory()
  114.         end
  115. end
  116.  
  117. bindKey ( "i", "down", showInventory)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement