Skip to content

Commit

Permalink
Merge pull request #3243 from csnv/fix/attachrid-autoloot
Browse files Browse the repository at this point in the history
Disable attaching scripts to characters in autotrade
  • Loading branch information
MishimaHaruna authored Nov 20, 2023
2 parents 9119653 + b3b3d94 commit ed2c554
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 ed2c554

Please sign in to comment.