From af35d31bd98a94e267087cfa607a4e8d2f203a82 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Thu, 9 Apr 2015 03:19:20 -0700 Subject: [PATCH 1/2] Fixes the rank button on player panel --- code/modules/admin/admin.dm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/modules/admin/admin.dm b/code/modules/admin/admin.dm index 6c0a2019fe7..05990a54129 100644 --- a/code/modules/admin/admin.dm +++ b/code/modules/admin/admin.dm @@ -27,7 +27,7 @@ var/global/floorIsLava = 0 body += "Options panel for [M]" if(M.client) body += " played by [M.client] " - body += "\[[M.client.holder ? M.client.holder.rank : "Player"]\]" + body += "\[[M.client.holder ? M.client.holder.rank : "Player"]\]" if(istype(M, /mob/new_player)) body += " Hasn't Entered Game " From 5b2221cd4f8a377100f308f22b96cb372db4c512 Mon Sep 17 00:00:00 2001 From: MrStonedOne Date: Thu, 9 Apr 2015 03:19:55 -0700 Subject: [PATCH 2/2] Changing/adding an admins rank now updates the player's table --- code/modules/admin/admin_ranks.dm | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/code/modules/admin/admin_ranks.dm b/code/modules/admin/admin_ranks.dm index 711907c6025..0fa01cb6319 100644 --- a/code/modules/admin/admin_ranks.dm +++ b/code/modules/admin/admin_ranks.dm @@ -248,6 +248,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums admin_datums -= adm_ckey D.disassociate() + updateranktodb(adm_ckey, "player") message_admins("[key_name_admin(usr)] removed [adm_ckey] from the admins list") log_admin("[key_name(usr)] removed [adm_ckey] from the admins list") log_admin_rank_modification(adm_ckey, "Removed") @@ -288,6 +289,7 @@ var/list/admin_ranks = list() //list of all admin_rank datums var/client/C = directory[adm_ckey] //find the client with the specified ckey (if they are logged in) D.associate(C) //link up with the client and add verbs + updateranktodb(adm_ckey, new_rank) message_admins("[key_name_admin(usr)] edited the admin rank of [adm_ckey] to [new_rank]") log_admin("[key_name(usr)] edited the admin rank of [adm_ckey] to [new_rank]") log_admin_rank_modification(adm_ckey, new_rank) @@ -319,3 +321,13 @@ var/list/admin_ranks = list() //list of all admin_rank datums log_admin_permission_modification(adm_ckey, D.rank.rights) edit_admin_permissions() + +/datum/admins/proc/updateranktodb(ckey,newrank) + establish_db_connection() + if (!dbcon.IsConnected()) + return + var/sql_ckey = sanitizeSQL(ckey) + var/sql_admin_rank = sanitizeSQL(newrank) + + var/DBQuery/query_update = dbcon.NewQuery("UPDATE [format_table_name("player")] SET lastadminrank = '[sql_admin_rank]' WHERE ckey = '[sql_ckey]'") + query_update.Execute() \ No newline at end of file