Advertisement
Guest User

Przebieralnia PD - C_Side

a guest
Jan 28th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.81 KB | None | 0 0
  1. local window;
  2. local gridlist;
  3. local button = {};
  4.  
  5. function createWindow()
  6.     window = guiCreateWindow(0.33, 0.17, 0.41, 0.60, "Przebieralnia SFPD", true)
  7.     guiWindowSetMovable(window, false)
  8.     guiWindowSetSizable(window, false)
  9.  
  10.     gridlist = guiCreateGridList(0.02, 0.05, 0.53, 0.93, true, window)
  11.     guiGridListAddColumn(gridlist, "ID Skina", 0.25)
  12.     guiGridListAddColumn(gridlist, "Ranga", 0.35)
  13.     button[1] = guiCreateButton(0.60, 0.07, 0.35, 0.11, "Wybierz skina", true, window)
  14.     button[2] = guiCreateButton(0.60, 0.21, 0.35, 0.11, "Zamknij", true, window)
  15. end;
  16. function openWindow()
  17.     showCursor(true)
  18.     triggerServerEvent('getAvaibleSkins', resourceRoot, localPlayer)
  19.     createWindow()
  20. end;
  21. function closeWindow()
  22.     showCursor(false)
  23.     if window and isElement(window) then
  24.         destroyElement(window)
  25.     end
  26. end;
  27. function onClick()
  28.     if source == button[1] then
  29.         local row = guiGridListGetSelectedItem(gridlist)
  30.         local id = guiGridListGetItemText(gridlist, row, 1)
  31.         local nazwa = guiGridListGetItemText(gridlist, row, 2)
  32.         triggerServerEvent('setPlayerSkin', resourceRoot, localPlayer, id, nazwa)
  33.     elseif source == button[2] then
  34.         closeWindow()
  35.     end
  36. end;
  37. function addSkinToGridList(id,nazwa)
  38.     if id and nazwa then
  39.         local row = guiGridListAddRow(gridlist)
  40.         guiGridListSetItemText(gridlist, row, 1, id, false, false)
  41.         guiGridListSetItemText(gridlist, row, 2, nazwa, false, false)
  42.     end
  43. end;
  44.  
  45. addEvent('openGUI', true);
  46. addEvent('addSkinToGridList', true);
  47. addEventHandler('openGUI', resourceRoot, function(...) openWindow(...) end);
  48. addEventHandler('addSkinToGridList', resourceRoot, function(...) addSkinToGridList(...) end);
  49. addEventHandler('onClientGUIClick', resourceRoot, function(...) onClick(...) end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement