Advertisement
Guest User

gui_c.lua

a guest
Dec 7th, 2017
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. isAdmin = false
  2. showLicenses = false
  3.  
  4.  
  5.  
  6. Citizen.CreateThread(function()
  7. local currentItemIndex = 1
  8. local selectedItemIndex = 1
  9.  
  10. WarMenu.CreateMenu('admin', 'Admin Menu')
  11. WarMenu.CreateSubMenu('kickplayers', 'admin', 'Kick Player')
  12. WarMenu.CreateSubMenu('banplayers', 'admin', 'Ban Player')
  13. WarMenu.CreateSubMenu('unbanplayers', 'admin', 'Unban Player')
  14. WarMenu.CreateSubMenu('spectateplayers', 'admin', 'Spectate Players')
  15. WarMenu.CreateSubMenu('teleporttoplayer', 'admin', 'Teleport to Player')
  16. WarMenu.CreateSubMenu('settings', 'admin', 'Settings')
  17. TriggerServerEvent("amiadmin")
  18.  
  19.  
  20.  
  21.  
  22. while true do
  23. if WarMenu.IsMenuOpened('admin') then
  24. if isAdmin == false then
  25. WarMenu.CloseMenu()
  26. elseif isAdmin == true then
  27. if WarMenu.MenuButton('Kick Player', 'kickplayers') then
  28.  
  29. elseif WarMenu.MenuButton('Ban Player', 'banplayers') then
  30.  
  31. elseif WarMenu.MenuButton('Spectate Player', 'spectateplayers') then
  32.  
  33. elseif WarMenu.MenuButton('Teleport to Player', 'teleporttoplayer') then
  34.  
  35. elseif WarMenu.MenuButton('Unban Player', "unbanplayers") then
  36.  
  37. elseif WarMenu.MenuButton('Settings', "settings") then
  38.  
  39. elseif WarMenu.Button('Close') then
  40. WarMenu.CloseMenu()
  41. end
  42. end
  43. WarMenu.Display()
  44. elseif WarMenu.IsMenuOpened("kickplayers") then
  45.  
  46. for i,thePlayer in ipairs(players) do
  47. if WarMenu.MenuButton("["..GetPlayerServerId( thePlayer ).."] "..GetPlayerName( thePlayer ), 'kickplayers') then
  48.  
  49. DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP8", "", "", "", "", "", 128 + 1)
  50.  
  51. while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do
  52. Citizen.Wait( 0 )
  53. end
  54.  
  55. local result = GetOnscreenKeyboardResult()
  56.  
  57. if result then
  58. TriggerServerEvent("kickPlayer", GetPlayerServerId( thePlayer ), result)
  59. end
  60. end
  61. end
  62. WarMenu.Display()
  63.  
  64. elseif WarMenu.IsMenuOpened("banplayers") then
  65.  
  66. for i,thePlayer in ipairs(players) do
  67. if WarMenu.MenuButton("["..GetPlayerServerId( thePlayer ).."] "..GetPlayerName( thePlayer ), 'banplayers') then
  68. DisplayOnscreenKeyboard(1, "FMMC_KEY_TIP8", "", "", "", "", "", 128 + 1)
  69.  
  70. while UpdateOnscreenKeyboard() ~= 1 and UpdateOnscreenKeyboard() ~= 2 do
  71. Citizen.Wait( 0 )
  72. end
  73.  
  74. local result = GetOnscreenKeyboardResult()
  75.  
  76.  
  77. if result then
  78. TriggerServerEvent("banPlayer", GetPlayerServerId( thePlayer ), result)
  79. end
  80. end
  81. end
  82. WarMenu.Display()
  83.  
  84.  
  85. elseif WarMenu.IsMenuOpened("spectateplayers") then
  86.  
  87. for i,thePlayer in ipairs(players) do
  88. if WarMenu.MenuButton("["..GetPlayerServerId( thePlayer ).."] "..GetPlayerName( thePlayer ), 'spectateplayers') then
  89. spectatePlayer(GetPlayerPed(thePlayer), GetPlayerName( thePlayer ))
  90. end
  91. end
  92. WarMenu.Display()
  93.  
  94. elseif WarMenu.IsMenuOpened("teleporttoplayer") then
  95.  
  96. for i,thePlayer in ipairs(players) do
  97. if WarMenu.MenuButton("["..GetPlayerServerId( thePlayer ).."] "..GetPlayerName( thePlayer ), 'teleporttoplayer') then
  98. local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(thePlayer),true))
  99. local heading = GetEntityHeading(GetPlayerPed(player))
  100. SetEntityCoords(PlayerPedId(), x,y,z,0,0,heading, false)
  101. end
  102. end
  103. WarMenu.Display()
  104.  
  105. elseif WarMenu.IsMenuOpened("unbanplayers") then
  106.  
  107. for i,theBanned in ipairs(banlist) do
  108. if showLicenses then
  109. if WarMenu.Button(theBanned) then
  110. TriggerServerEvent("unbanPlayer", theBanned)
  111. TriggerServerEvent("updateBanlist")
  112. Citizen.Trace("unbanning user")
  113. end
  114. else
  115. if WarMenu.Button(banlist.reasons[i]) then
  116. TriggerServerEvent("unbanPlayer", theBanned)
  117. Citizen.Trace("unbanning user")
  118. TriggerServerEvent("updateBanlist")
  119. end
  120. end
  121. end
  122. WarMenu.Display()
  123.  
  124. elseif WarMenu.IsMenuOpened("settings") then
  125. if showLicenses then
  126. sl = "Licenses"
  127. else
  128. sl = "Reasons"
  129. end
  130. if WarMenu.Button("Banlist: Show Licenses/Reasons", sl) then
  131. showLicenses = not showLicenses
  132. elseif WarMenu.Button('Refresh Banlist') then
  133. TriggerServerEvent("updateBanlist")
  134. end
  135.  
  136. WarMenu.Display()
  137.  
  138.  
  139.  
  140. elseif IsControlJustReleased(0, 289) and isAdmin == true then --M by default
  141. WarMenu.OpenMenu('admin')
  142. end
  143.  
  144. Citizen.Wait(0)
  145. end
  146. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement