From 414da58ac6655d490b93d054d6b4e47fa80cab79 Mon Sep 17 00:00:00 2001 From: csnv Date: Mon, 30 Oct 2023 01:42:06 +0100 Subject: [PATCH] Disable attaching scripts to characters in autotrade --- src/map/script.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/map/script.c b/src/map/script.c index a37fb0aa2d6..b98fc49204d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14418,15 +14418,21 @@ static void script_detach_rid(struct script_state *st) static BUILDIN(attachrid) { int rid = script_getnum(st,2); + struct map_session_data* sd = map->id2sd(rid); - if (map->id2sd(rid) != NULL) { + if (sd != NULL) { + if (sd->state.autotrade) { + ShowError("buildin_attachrid: Cannot attach script to character in autotrade\n"); + script_pushint(st, 0); + return false; + } script->detach_rid(st); st->rid = rid; script->attach_state(st); - script_pushint(st,1); + script_pushint(st, 1); } else - script_pushint(st,0); + script_pushint(st, 0); return true; } /*==========================================