mirror of
https://github.com/VOREStation/VOREStation.git
synced 2026-07-19 02:56:14 +01:00
Adds 'age' command to world.Topic, for the IRC bot. Also runs all keys through ckey() before using them, to avoid easily-fixed errors
This commit is contained in:
@@ -177,6 +177,25 @@
|
||||
return ..()
|
||||
|
||||
|
||||
// here because it's similar to below
|
||||
|
||||
// Returns null if no DB connection can be established, or -1 if the requested key was not found in the database
|
||||
|
||||
/proc/get_player_age(key)
|
||||
establish_db_connection()
|
||||
if(!dbcon.IsConnected())
|
||||
return null
|
||||
|
||||
var/sql_ckey = sql_sanitize_text(ckey(key))
|
||||
|
||||
var/DBQuery/query = dbcon.NewQuery("SELECT datediff(Now(),firstseen) as age FROM erro_player WHERE ckey = '[sql_ckey]'")
|
||||
query.Execute()
|
||||
|
||||
if(query.NextRow())
|
||||
return text2num(query.item[1])
|
||||
else
|
||||
return -1
|
||||
|
||||
|
||||
/client/proc/log_client_to_db()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user