Fixed A Few Bugs

This commit is contained in:
Cooldude2606
2018-01-06 14:43:47 +00:00
parent ed306b4006
commit 76c02e8f26
4 changed files with 21 additions and 16 deletions

View File

@@ -64,7 +64,7 @@ local function report_message(player,by_player,reason)
local player, by_player_name = valid_players(player,by_player)
if not player then return end
if _reports().actions[player.name] == actions.report then return end
Ranking.print(low_rank,{'reports.low-print',player.name,med},defines.text_color.info,true)
Ranking.print(low_rank,{'reports.low-print',player.name,reason},defines.text_color.info,true)
Ranking.print(high_rank,{'reports.high-print',player.name,by_player_name,reason},defines.text_color.med)
discord_emit{
title='Player Report',
@@ -110,11 +110,12 @@ local function cheak_reports(player)
end
end
local function give_punishment(player,reason)
local function give_punishment(player,by_player,reason)
local player, by_player_name = valid_players(player,by_player)
local warnings = get_warnings(player)
local punishment = punishments[warnings]
local reason = reason or 'No Other Reason'
if punishment[1] == 'nothing' then return
if not punishment or punishment[1] == 'nothing' then return
elseif punishment[1] == 'message' then
local message = punishment[2]
local colour = punishment[3]
@@ -126,25 +127,27 @@ local function give_punishment(player,reason)
report_message(player,'<server>',reason)
elseif punishment[1] == 'kick' then
_reports().actions[player.name] = actions.kick
Admin.kick(player,'<server>','Too Many Warnings: '..warnings..' Also: '..reason)
Admin.kick(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason)
elseif punishment[1] == 'temp-ban' then
_reports().actions[player.name] = actions.temp
Admin.temp_ban(player,'<server>','Too Many Warnings: '..warnings..' Also: '..reason)
Admin.temp_ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason)
elseif punishment[1] == 'ban' then
_reports().actions[player.name] = actions.ban
Admin.ban(player,'<server>','Too Many Warnings: '..warnings..' Also: '..reason)
Admin.ban(player,by_player,'Too Many Warnings: '..warnings-(take_action-2)..' Also: '..reason)
end
end
function Admin.give_warning(player,by_player,reason,min)
local player, by_player_name = valid_players(player,by_player)
if not player then return end
local min = by_player_name and take_action or min or 0
local min = Game.get_player(by_player) and take_action or min or 0
local warnings = get_warnings(player)
if warnings < min then warnings = min end
warnings = warnings+1
_reports().warnings[player.name] = warnings
give_punishment(player,reason)
player_return({'reports.warning-given-by',by_player_name},defines.text_color.info,player)
game.print({'reports.player-warning',player,by_player_name})
give_punishment(player,by_player,reason)
end
function Admin.report(player,by_player,reason)
@@ -242,8 +245,8 @@ Event.register(defines.events.on_tick,function(event)
_reports().remove_warnings_time = {}
local highest = nil
for power,rank in pairs(Ranking._ranks()) do
if not highest and not rank:allowed('no-report') then highest = power+1 end
local _power = power; if highest then _power = highest-power end
if not highest and not rank:allowed('no-report') then highest = power-1 end
local _power = power; if highest then _power = power-highest end
if rank:allowed('no-report') then _reports().remove_warnings_time[power] = 0
else _reports().remove_warnings_time[power] = min_time_to_remove_warning*_power end
end

View File

@@ -16,7 +16,7 @@ commands.add_command('report', 'Reports a player', {'player','reason',true}, fun
Admin.report(player,event.player_index,reason)
end)
commands.add_command('give-warnings', 'Gives a player a warnings', {'player','reason',true}, function(event,args)
commands.add_command('give-warning', 'Gives a player a warnings', {'player','reason',true}, function(event,args)
local player = Game.get_player(args.player)
local reason = args.reason
if not player then player_return({'commands.invalid-player',args.player}) return commands.error end

View File

@@ -46,7 +46,7 @@ groups['Root']:edit('allow',false,{
['tasklist']=true,
['rank-changer']=true,
['admin-commands']=true,
['give-warnings']=true,
['give-warning']=true,
['temp-ban']=true,
['clear-warings']=true,
['clear-reports']=true,
@@ -60,7 +60,7 @@ groups['Admin']:edit('allow',false,{
['tasklist']=true,
['rank-changer']=true,
['admin-commands']=true,
['give-warnings']=true,
['give-warning']=true,
['temp-ban']=true,
['clear-warings']=true,
['clear-reports']=true,
@@ -71,7 +71,8 @@ groups['User']:edit('allow',false,{
['readme']=true,
['rockets']=true,
['science']=true,
['tasklist']=true
['tasklist']=true,
['report']=true
})
groups['Jail']:edit('allow',false,{
@@ -168,8 +169,7 @@ ranks['Regular']:edit('allow',false,{
})
ranks['Guest']:edit('allow',false,{
['tag']=true,
['tag-clear']=true,
['report']=true
['tag-clear']=true
})
Ranking._base_preset{

View File

@@ -2,6 +2,8 @@
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.
warning-given-by=This Warnings Was Given By: __1__
player-warning=__1__ was given a warning by __2__
temp-ban=__1__ was temp-ban by __2__ and will remain in jail untill next reset
remove-warn=You are had a warning Removed, you have __1__ warnings, next removed in __2__
message=You Are Currently Reciving Warnings From The Script, This Will Continue Unless You Cease And Desist