Fixed Reports

This commit is contained in:
Cooldude2606
2018-01-06 15:47:03 +00:00
parent 54663421d6
commit 4727296ea4
4 changed files with 28 additions and 25 deletions

View File

@@ -154,12 +154,13 @@ function Admin.report(player,by_player,reason)
local player, by_player_name = valid_players(player,by_player)
if not player or Ranking.get_rank(player):allowed('no-report') then return end
if rank:allowed('varified') then
_reports.varified[player.name] = _reports.varified[player.name] or {}
table.insert(_reports.varified,{by_player_name,reason})
_reports().varified[player.name] = _reports().varified[player.name] or {}
table.insert(_reports().varified,{by_player_name,reason})
else
_reports.reports[player.name] = _reports.reports[player.name] or {}
table.insert(_reports.reports,{by_player_name,reason})
_reports().reports[player.name] = _reports().reports[player.name] or {}
table.insert(_reports().reports,{by_player_name,reason})
end
report_message(player,by_player,reason)
cheak_reports(player)
end

View File

@@ -49,11 +49,11 @@ Gui.left.add{
draw=function(frame)
frame.caption = ''
local player_list = frame.add{
name="scroll",
type = "scroll-pane",
direction = "vertical",
vertical_scroll_policy="always",
horizontal_scroll_policy="never"
name='scroll',
type = 'scroll-pane',
direction = 'vertical',
vertical_scroll_policy='always',
horizontal_scroll_policy='never'
}
for _,rank in pairs(Ranking._ranks()) do
for _,player in pairs(rank:get_players(true)) do
@@ -73,10 +73,12 @@ Gui.left.add{
caption={'player-list.format',tick_to_display_format(player.online_time),player.name,rank.short_hand}
}.style.font_color = rank.colour
end
if Admin.report_btn and not rank:allowed('no-report') and not player.index == frame.player_index then
local btn = Admin.report_btn:draw(flow)
btn.style.height = 20
btn.style.width = 20
if Admin.report_btn then
if not rank:allowed('no-report') and player.index ~= frame.player_index then
local btn = Admin.report_btn:draw(flow)
btn.style.height = 20
btn.style.width = 20
end
end
end
end

View File

@@ -11,27 +11,24 @@ Discord: https://discord.gg/r6dC2uK
local confirm_report = Gui.inputs.add{
type='button',
name='admin-report-confirm',
caption='utility/spawn_flag'
caption='utility/spawn_flag',
tooltip={'reports.name'}
}:on_event('click',function(event)
local parent = evet.element.parent
local parent = event.element.parent
local player = Game.get_player(parent.player.caption)
local reason = parent.reason.text
Admin.report(player,event.player_index,reason)
Gui.center.clear(event.player_index)
end)
Admin.report_btn = Gui.inputs.add{
type='button',
name='admin-report',
caption='utility/spawp_flag'
caption='utility/spawn_flag',
tooltip={'reports.name'}
}:on_event('click',function(event)
local parent = event.element.parent
local player = nil
for name,_ in pairs(parent.children) do
if name ~= 'admin-report' then
player = Game.get_player(name)
break
end
end
local player = Game.get_player(parent.children[1].name)
if not player then return end
local _player = Game.get_player(event)
Gui.center.clear(_player)
@@ -39,12 +36,15 @@ Admin.report_btn = Gui.inputs.add{
type='frame',
name='report-gui'
}
_player.opened=frame
frame.caption={'reports.name'}
frame.add{
type='textfield',
name='reason'
}.style.width = 300
confirm_report:draw(frame)
local btn = confirm_report:draw(frame)
btn.style.height = 30
btn.style.width = 30
frame.add{
type='label',
name='player',

View File

@@ -40,7 +40,7 @@ require('Guis/player-list')
require('Guis/tasklist')
require('Guis/rank-changer')
require('Guis/admin-gui') -- used with Admin/admin, requires Admin/admin
require('Guis/game-settings')
require('Guis/reports') -- requires Admin/reports
require('Guis/game-settings')
-- other