Reworked the warning system, warns are now persistent and warn bans are exponentialy longer based on how many times youve been banned.

This commit is contained in:
d3athrow
2013-11-11 14:48:52 -06:00
parent 198e82847a
commit 3227232476
4 changed files with 24 additions and 15 deletions

View File

@@ -1,5 +1,5 @@
datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0, var/banckey = null) /datum/admins/proc/DB_ban_record(var/bantype, var/mob/banned_mob, var/duration = -1, var/reason, var/job = "", var/rounds = 0, var/banckey = null)
if(!check_rights(R_BAN)) return if(!check_rights(R_BAN)) return
@@ -318,7 +318,7 @@ datum/admins/proc/DB_ban_unban_by_id(var/id)
</td> </td>
</tr> </tr>
</table> </table>
<form method='GET' action='?src=\ref[src]'><b>Search:</b> <form method='GET' action='?src=\ref[src]'><b>Search:</b>
<input type='hidden' name='src' value='\ref[src]'> <input type='hidden' name='src' value='\ref[src]'>
<b>Ckey:</b> <input type='text' name='dbsearchckey' value='[playerckey]'> <b>Ckey:</b> <input type='text' name='dbsearchckey' value='[playerckey]'>
<b>Admin ckey:</b> <input type='text' name='dbsearchadmin' value='[adminckey]'> <b>Admin ckey:</b> <input type='text' name='dbsearchadmin' value='[adminckey]'>

View File

@@ -460,15 +460,16 @@ var/list/admin_verbs_mod = list(
feedback_add_details("admin_verb","SM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","SM") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
#define MAX_WARNS 3 #define MAX_WARNS 3
#define AUTOBANTIME 10 #define AUTOBANTIME 15
/client/proc/warn(warned_ckey) /client/proc/warn(warned_ckey)
var/reason = "Autobanning due to too many formal warnings"
if(!check_rights(R_ADMIN)) return if(!check_rights(R_ADMIN)) return
if(!warned_ckey || !istext(warned_ckey)) return if(!warned_ckey || !istext(warned_ckey)) return
if(warned_ckey in admin_datums) /*if(warned_ckey in admin_datums)
usr << "<font color='red'>Error: warn(): You can't warn admins.</font>" usr << "<font color='red'>Error: warn(): You can't warn admins.</font>"
return return*/
var/datum/preferences/D var/datum/preferences/D
var/client/C = directory[warned_ckey] var/client/C = directory[warned_ckey]
@@ -480,22 +481,26 @@ var/list/admin_verbs_mod = list(
return return
if(++D.warns >= MAX_WARNS) //uh ohhhh...you'reee iiiiin trouuuubble O:) if(++D.warns >= MAX_WARNS) //uh ohhhh...you'reee iiiiin trouuuubble O:)
ban_unban_log_save("[ckey] warned [warned_ckey], resulting in a [AUTOBANTIME] minute autoban.") var/bantime = (++D.warnbans * AUTOBANTIME)
D.warns = 1
ban_unban_log_save("[ckey] warned [warned_ckey], resulting in a [bantime] minute autoban.")
if(C) if(C)
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)] resulting in a [AUTOBANTIME] minute ban.") message_admins("[key_name_admin(src)] has warned [key_name_admin(C)] resulting in a [bantime] minute ban.")
C << "<font color='red'><BIG><B>You have been autobanned due to a warning by [ckey].</B></BIG><br>This is a temporary ban, it will be removed in [AUTOBANTIME] minutes." C << "<font color='red'><BIG><B>You have been autobanned due to a warning by [ckey].</B></BIG><br>This is a temporary ban, it will be removed in [bantime] minutes."
del(C)
else else
message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [AUTOBANTIME] minute ban.") message_admins("[key_name_admin(src)] has warned [warned_ckey] resulting in a [bantime] minute ban.")
AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, AUTOBANTIME) AddBan(warned_ckey, D.last_id, "Autobanning due to too many formal warnings", ckey, 1, bantime)
holder.DB_ban_record(BANTYPE_TEMP, null, bantime, reason, , ,warned_ckey)
feedback_inc("ban_warn",1) feedback_inc("ban_warn",1)
D.save_preferences()
del(C)
else else
if(C) if(C)
C << "<font color='red'><BIG><B>You have been formally warned by an administrator.</B></BIG><br>Further warnings will result in an autoban.</font>" C << "<font color='red'><BIG><B>You have been formally warned by an administrator.</B></BIG><br>Further warnings will result in an autoban.</font>"
message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining.") message_admins("[key_name_admin(src)] has warned [key_name_admin(C)]. They have [MAX_WARNS-D.warns] strikes remaining. And have been warn banned [D.warnbans] [D.warnbans == 1 ? "time" : "times"]")
else else
message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining.") message_admins("[key_name_admin(src)] has warned [warned_ckey] (DC). They have [MAX_WARNS-D.warns] strikes remaining. And have been warn banned [D.warnbans] [D.warnbans == 1 ? "time" : "times"]")
D.save_preferences()
feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc! feedback_add_details("admin_verb","WARN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
#undef MAX_WARNS #undef MAX_WARNS

View File

@@ -34,6 +34,7 @@ datum/preferences
//non-preference stuff //non-preference stuff
var/warns = 0 var/warns = 0
var/warnbans = 0
var/muted = 0 var/muted = 0
var/last_ip var/last_ip
var/last_id var/last_id

View File

@@ -54,6 +54,8 @@
S["be_special"] >> be_special S["be_special"] >> be_special
S["default_slot"] >> default_slot S["default_slot"] >> default_slot
S["toggles"] >> toggles S["toggles"] >> toggles
S["warns"] >> warns
S["warnbans"] >> warnbans
//Sanitize //Sanitize
ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor)) ooccolor = sanitize_hexcolor(ooccolor, initial(ooccolor))
@@ -62,7 +64,6 @@
be_special = sanitize_integer(be_special, 0, 65535, initial(be_special)) be_special = sanitize_integer(be_special, 0, 65535, initial(be_special))
default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot)) default_slot = sanitize_integer(default_slot, 1, MAX_SAVE_SLOTS, initial(default_slot))
toggles = sanitize_integer(toggles, 0, 65535, initial(toggles)) toggles = sanitize_integer(toggles, 0, 65535, initial(toggles))
return 1 return 1
/datum/preferences/proc/save_preferences() /datum/preferences/proc/save_preferences()
@@ -80,6 +81,8 @@
S["be_special"] << be_special S["be_special"] << be_special
S["default_slot"] << default_slot S["default_slot"] << default_slot
S["toggles"] << toggles S["toggles"] << toggles
S["warns"] << warns
S["warnbans"] << warnbans
return 1 return 1