From b3b3d94c52d7519aadae5cf959bd570f95ad1620 Mon Sep 17 00:00:00 2001 From: csnv Date: Mon, 30 Oct 2023 01:54:46 +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..54fa7993f1b 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; } /*==========================================