summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2021-05-15 22:28:55 -0300
committerJesusaves <cpntb1@ymail.com>2021-05-15 22:28:55 -0300
commit5492ad8860e9a9e6989f241f095f3e6f25fe5769 (patch)
tree88222a157db33335d7986fa3b615c3080aa9c0af /npc
parent9e9e3e9555693f8eb5da999e05bb792de602f296 (diff)
downloadserverdata-5492ad8860e9a9e6989f241f095f3e6f25fe5769.tar.gz
serverdata-5492ad8860e9a9e6989f241f095f3e6f25fe5769.tar.bz2
serverdata-5492ad8860e9a9e6989f241f095f3e6f25fe5769.tar.xz
serverdata-5492ad8860e9a9e6989f241f095f3e6f25fe5769.zip
Fix bugs
Diffstat (limited to 'npc')
-rw-r--r--npc/commands/discord.txt21
1 files changed, 7 insertions, 14 deletions
diff --git a/npc/commands/discord.txt b/npc/commands/discord.txt
index 0f4f7e8c7..21e675a45 100644
--- a/npc/commands/discord.txt
+++ b/npc/commands/discord.txt
@@ -44,9 +44,9 @@ OnCall:
// Search on cache
.@key$=str(getcharid(3));
- .@m$ = htget(.discmem$, .@key$, "Not found");
+ .@discord$ = htget(.discmem, .@key$, "Not found");
- if (.@m$ == "Not found") {
+ if (.@discord$ == "Not found") {
// Only do SQL query if not in cache
.@nb = query_sql("select `discord_name` from `discord` WHERE `account_id`='"+getcharid(3)+"' limit 1", .@discord$);
// Override default behavior
@@ -55,14 +55,7 @@ OnCall:
.@link=false;
}
// Add to Cache
- htput(.discmem$, str(getcharid(3)), .@discord$);
- }
-
-
- // Doublecheck it worked properly
- if (.@discord$ == "") {
- .@discord$="Not Linked";
- .@link=false;
+ htput(.discmem, str(getcharid(3)), .@discord$);
}
do
@@ -86,7 +79,7 @@ OnCall:
if (.@discord$ == "") close;
mes "";
- // Run SQL query
+ // Run SQL query (will halt execution on dupe)
if (.@link) {
query_sql(sprintf("UPDATE `discord` SET `discord_name` = '%s', `verified` = '0', `discord_id` = '' WHERE `account_id`='%d'",
escape_sql(.@discord$), getcharid(3)));
@@ -102,7 +95,7 @@ OnCall:
// Send to API and update cache
api_send(API_DISCORD, .@p$);
- htput(.discmem$, str(getcharid(3)), .@discord$);
+ htput(.discmem, str(getcharid(3)), .@discord$);
// Prevent changing for the next 3 days
DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+3;
@@ -116,7 +109,7 @@ OnCall:
// Prevent setting a new linking right away
DISCTRL=gettimeparam(GETTIME_DAYOFMONTH)+1;
// Update Cache
- htput(.discmem$, str(getcharid(3)), "");
+ htput(.discmem, str(getcharid(3)), "");
// TODO: Remove Adventurer role?
logmes(sprintf("User %d \"%s\" unlinked Discord account!", getcharid(3), strcharinfo(0)));
break;
@@ -127,7 +120,7 @@ OnCall:
OnInit:
bindatcmd "discord", "@discord::OnCall", 0, 0, 1;
- .discmem$ = htnew;
+ .discmem = htnew;
end;
}