mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-07-13 08:03:43 +01:00
karma fix
This commit is contained in:
@@ -30,20 +30,20 @@ proc/sql_report_karma(var/mob/spender, var/mob/receiver)
|
||||
query = dbcon.NewQuery("SELECT * FROM karmatotals WHERE byondkey='[receiver.key]'")
|
||||
query.Execute()
|
||||
|
||||
var/dbkarma
|
||||
var/karma
|
||||
var/id
|
||||
while(query.NextRow())
|
||||
id = query.item[1]
|
||||
dbkarma = text2num(query.item[3])
|
||||
if(dbkarma == null)
|
||||
dbkarma = 1
|
||||
query = dbcon.NewQuery("INSERT INTO karmatotals (byondkey, karma) VALUES ('[receiver.key]', [dbkarma])")
|
||||
karma = text2num(query.item[3])
|
||||
if(karma == null)
|
||||
karma = 1
|
||||
query = dbcon.NewQuery("INSERT INTO karmatotals (byondkey, karma) VALUES ('[receiver.key]', [karma])")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during karmatotal logging (adding new key). Error : \[[err]\]\n")
|
||||
else
|
||||
dbkarma += 1
|
||||
query = dbcon.NewQuery("UPDATE karmatotals SET karma=[dbkarma] WHERE id=[id]")
|
||||
karma += 1
|
||||
query = dbcon.NewQuery("UPDATE karmatotals SET karma=[karma] WHERE id=[id]")
|
||||
if(!query.Execute())
|
||||
var/err = query.ErrorMsg()
|
||||
log_game("SQL ERROR during karmatotal logging (updating existing entry). Error : \[[err]\]\n")
|
||||
@@ -51,7 +51,7 @@ proc/sql_report_karma(var/mob/spender, var/mob/receiver)
|
||||
|
||||
var/list/karma_spenders = list()
|
||||
|
||||
/client/verb/spend_karma(var/mob/M in player_list) // Karma system -- TLE
|
||||
/mob/verb/spend_karma(var/mob/M in player_list) // Karma system -- TLE
|
||||
set name = "Award Karma"
|
||||
set desc = "Let the gods know whether someone's been nice. <One use only>"
|
||||
set category = "Special Verbs"
|
||||
@@ -62,7 +62,7 @@ var/list/karma_spenders = list()
|
||||
if(!M.client)
|
||||
usr << "\red That mob has no client connected at the moment."
|
||||
return
|
||||
if(src.karma_spent)
|
||||
if(src.client.karma_spent)
|
||||
usr << "\red You've already spent your karma for the round."
|
||||
return
|
||||
for(var/a in karma_spenders)
|
||||
@@ -72,7 +72,7 @@ var/list/karma_spenders = list()
|
||||
if(M.key == src.key)
|
||||
usr << "\red You can't spend karma on yourself!"
|
||||
return
|
||||
if(M.client.address == src.address)
|
||||
if(M.client.address == src.client.address)
|
||||
message_admins("\red Illegal karma spending detected from [src.key] to [M.key]. Using the same IP!")
|
||||
log_game("\red Illegal karma spending detected from [src.key] to [M.key]. Using the same IP!")
|
||||
usr << "\red The karma system is not available to multi-accounters."
|
||||
@@ -82,7 +82,7 @@ var/list/karma_spenders = list()
|
||||
if(choice == "Good")
|
||||
M.client.karma += 1
|
||||
usr << "[choice] karma spent on [M.name]."
|
||||
src.karma_spent = 1
|
||||
src.client.karma_spent = 1
|
||||
karma_spenders.Add(src.key)
|
||||
if(M.client.karma <= -2 || M.client.karma >= 2)
|
||||
var/special_role = "None"
|
||||
|
||||
Reference in New Issue
Block a user