Guest User

Untitled

a guest
Dec 4th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. teams = {"Liberation Army", "Imperial Forces"}
  2.  
  3. function getPos()
  4. local x, y ,z = getElementPosition(localPlayer)
  5. local pos = tostring(x..", "..y..", "..z)
  6. outputChatBox(pos, 255, 100, 100, false)
  7. setClipboard(pos)
  8. end
  9. addCommandHandler("pos", getPos)
  10.  
  11. ---- GUI Creation
  12. addEventHandler("onClientResourceStart", resourceRoot,
  13. function()
  14. window = guiCreateWindow(0.57, 0.25, 0.19, 0.37, "Spawn Menu", true)
  15. guiWindowSetMovable(window, false)
  16. guiWindowSetSizable(window, false)
  17. guiSetAlpha(window, 1.00)
  18. team_gridlist = guiCreateGridList(10, 32, 284, 98, false, window)
  19. column = guiGridListAddColumn(team_gridlist, "Team", 0.9)
  20. rowA = guiGridListAddRow(team_gridlist)
  21. rowB = guiGridListAddRow(team_gridlist)
  22. guiGridListSetItemText(team_gridlist, 0, 1, "Liberation Front", false, false)
  23. guiGridListSetItemText(team_gridlist, 1, 1, "Imperial Forces", false, false)
  24. skin_label = guiCreateLabel(58, 248, 71, 15, "Select a skin", false, window)
  25. skin_btn_next = guiCreateButton(96, 273, 33, 16, ">", false, window)
  26. skin_btn_previous = guiCreateButton(58, 273, 33, 16, "<", false, window)
  27. location_gridlist = guiCreateGridList(10, 140, 284, 98, false, window)
  28. location_col = guiGridListAddColumn(location_gridlist, "Location", 0.9)
  29. weapon_label = guiCreateLabel(155, 248, 96, 15, "Select a weapon", false, window)
  30. weapon_btn_next = guiCreateButton(165, 273, 33, 16, ">", false, window)
  31. weapon_btn_previous = guiCreateButton(204, 273, 33, 16, "<", false, window)
  32. spawn_btn = guiCreateButton(114, 299, 67, 24, "Spawn", false, window)
  33. guiSetVisible(window, false)
  34. end
  35. )
  36.  
  37. ---- GUI functions
  38. function isGUIVisible(gui)
  39. return (guiGetVisible(gui) == true)
  40. end
  41.  
  42. -- Make the GUI appear on login.
  43. addEvent("onClientPlayerLoginn", true)
  44. addEventHandler("onClientPlayerLoginn", root, function()
  45. if isGUIVisible(window) then
  46. return
  47. end
  48. guiSetVisible(window, true)
  49.  
  50. -- Set the camera to the desired location.
  51. setCameraMatrix(-2610.9792480469, 1445.4840087891, 7.1875, -2610.9792480469, 1445.4840087891, 7.1875)
  52.  
  53. -- Make a ped with default skin (0).
  54. local ped = createPed(0, -2614.0212402344, 1451.1651611328, 7.1875, 180)
  55. end)
  56.  
  57. -- Team
  58. addEventHandler("onClientGUIClick", resourceRoot, function()
  59. if (source == spawn_btn) then
  60. local row, col = guiGridListGetSelectedItem(team_gridlist)
  61. local team = guiGridListGetItemText(team_gridlist, row, col)
  62. if team then
  63. triggerServerEvent("setTeam", localPlayer, team)
  64. end
  65. end
  66. end)
  67.  
  68. -- Location (according to the team)
  69. addEventHandler("onClientGUIClick", resourceRoot, function(button, state)
  70. if button == "left" and state == "up" then
  71. local LALocations = {"LA Test 1", "LA Test 2", "LA Test 3"}
  72. local IFLocations = {"IF Test 1", "IF Test 2", "IF Test 3"}
  73. local row, col = guiGridListGetSelectedItem(team_gridlist)
  74. if row and col and row ~= -1 and col ~= -1 then
  75. local team = guiGridListGetItemText(team_gridlist, row, col)
  76. if team == "Liberation Army" then
  77. outputChatBox("Test successful", 100, 255, 100)
  78. for _, locations_LA in ipairs(LALocations) do
  79. local location_row_LA = guiGridListAddRow(location_gridlist)
  80. guiGridListSetItemText(location_gridlist, location_row_LA, location_col, locations_LA, false, false)
  81. end
  82. if team == "Imperial Forces" then
  83. for _, locations_IF in ipairs(IFLocations) do
  84. local location_row_IF = guiGridListAddRow(location_gridlist)
  85. guiGridListSetItemText(location_gridlist, location_row_IF, location_col, locations_IF, false, false)
  86. end
  87. end
  88. end
  89. end
  90. end
  91. end)
  92.  
  93. -- Skin
  94. -- Weapon
Add Comment
Please, Sign In to add comment