Skip to content

Commit

Permalink
Disable attaching scripts to characters in autotrade
Browse files Browse the repository at this point in the history
  • Loading branch information
csnv committed Oct 30, 2023
1 parent b097666 commit 414da58
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/map/script.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/*==========================================
Expand Down

0 comments on commit 414da58

Please sign in to comment.