From 8a0e383458a4cb234e0910bf49efee3fee19e2da Mon Sep 17 00:00:00 2001 From: skull132 Date: Mon, 8 Jun 2015 23:40:21 +0300 Subject: [PATCH] SQL notes fix Now fetches actual data, so that it doesn't return null-strings. And also checks if a client is still present or not. --- code/modules/admin/player_notes_sql.dm | 6 ++++-- code/modules/admin/topic.dm | 10 ++++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/code/modules/admin/player_notes_sql.dm b/code/modules/admin/player_notes_sql.dm index 6e7ea6ae..f46fe12b 100644 --- a/code/modules/admin/player_notes_sql.dm +++ b/code/modules/admin/player_notes_sql.dm @@ -21,8 +21,10 @@ if(!IP || !CID) var/DBQuery/initquery = dbcon.NewQuery("SELECT ip, computerid FROM erro_player WHERE ckey = '[ckey]'") - IP = initquery.item[1] - CID = initquery.item[2] + initquery.Execute() + if(initquery.NextRow()) + IP = initquery.item[1] + CID = initquery.item[2] var/querycontents if(IP && CID) diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index 144b463f..d3f0b078 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -2774,10 +2774,12 @@ else var/IP var/CID - var/client/C = directory[key] - if(C) - IP = C.address - CID = C.computer_id + if(directory[key]) + var/client/C = directory[key] + if(C) + IP = C.address + CID = C.computer_id + notes_add_sql(key, add, usr, IP, CID) show_player_info(key)