Added report button on player list

This commit is contained in:
Cooldude2606
2018-01-06 15:19:55 +00:00
parent 67b220ed1e
commit d7280f84d8
4 changed files with 60 additions and 0 deletions

View File

@@ -73,6 +73,11 @@ 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 then
local btn = Admin.report_btn:draw(flow)
btn.style.height = 20
btn.style.width = 20
end
end
end
end,

53
Addons/Guis/reports.lua Normal file
View File

@@ -0,0 +1,53 @@
--[[
Explosive Gaming
This file can be used with permission but this and the credit below must remain in the file.
Contact a member of management on our discord to seek permission to use our code.
Any changes that you may make to the code are yours but that does not make the script yours.
Discord: https://discord.gg/r6dC2uK
]]
--Please Only Edit Below This Line-----------------------------------------------------------
local confirm_report = Gui.inputs.add{
type='button',
name='admin-report-confirm',
caption='utility/spawn_flag'
}:on_event('click',function(event)
local parent = evet.element.parent
local player = Game.get_player(parent.player.caption)
local reason = parent.reason.text
Admin.report(player,event.player_index,reason)
end)
Admin.report_btn = Gui.inputs.add{
type='button',
name='admin-report',
caption='utility/spawp_flag'
}: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
if not player then return end
local _player = Game.get_player(event)
Gui.center.clear(_player)
local frame = Gui.center.get_flow(_player).add{
type='frame',
name='report-gui'
}
frame.caption={'reports.name'}
frame.add{
type='textfield',
name='reason'
}.style.width = 300
confirm_report:draw(frame)
frame.add{
type='label',
name='player',
caption=player.name
}.style.visible = false
end)

View File

@@ -41,5 +41,6 @@ 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
-- other

View File

@@ -1,4 +1,5 @@
[reports]
name=Report Player
low-print=__1__ has been reported by a user for: __2__
high-print=__1__ has been reported by __2__ for: __3__
cant-report=This player cant be reported.