Files
Polaris/code/game/verbs/checkkarma.dm
petethegoat@gmail.com 43279f6154 Added a cooldown to check karma. Fixes issue 124.
Portable scrubbers filter N2O. Resolves issue 111.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2355 316c924e-a436-60f5-8080-3fe189b3f50e
2011-10-14 15:13:31 +00:00

29 lines
1.0 KiB
Plaintext

/mob/verb/check_karma()
set name = "Check Karma"
set category = "Special Verbs"
set desc = "Reports how much karma you have accrued"
if(config.sql_enabled)
var/DBConnection/dbcon = new()
dbcon.Connect("dbi:mysql:[sqldb]:[sqladdress]:[sqlport]","[sqllogin]","[sqlpass]")
if(!dbcon.IsConnected())
usr << "\red Unable to connect to karma database. This error can occur if your host has failed to set up an SQL database or improperly configured its login credentials.<br>"
return
else
usr.verbs -= /mob/verb/check_karma
spawn(300)
usr.verbs += /mob/verb/check_karma
var/DBQuery/query = dbcon.NewQuery("SELECT karma FROM karmatotals WHERE byondkey='[src.key]'")
query.Execute()
var/currentkarma
while(query.NextRow())
currentkarma = query.item[1]
if(currentkarma)
usr << "<b>Your current karma is:</b> [currentkarma]<br>"
else
usr << "<b>Your current karma is:</b> 0<br>"
dbcon.Disconnect()
else
usr << "<b>SQL is off, karma is not usable<b>"