Index: atcommand.c =================================================================== --- atcommand.c (revision 16781) +++ atcommand.c (working copy) @@ -8818,6 +8818,53 @@ #undef MC_CART_MDFY } +/*========================================== +* @afk +*------------------------------------------*/ +ACMD_FUNC(afk) { + + nullpo_retr(-1, sd); + + if(sd->bl.m == map_mapname2mapid("prontera")) { + clif_displaymessage(fd, "@afk is not allowed on this map."); + return 0; + } + + if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ) + { + + if(map[sd->bl.m].flag.pvp || map[sd->bl.m].flag.gvg){ + clif_displaymessage(fd, "You may not use the @afk maps PVP or GVG."); + return -1;} + + sd->state.autotrade = 1; + sd->state.monster_ignore = 1; + pc_setsit(sd); + skill_sit(sd,1); + clif_sitting(&sd->bl); + clif_changelook(&sd->bl,LOOK_HEAD_TOP,471); + clif_specialeffect(&sd->bl, 234,AREA); + if( battle_config.at_timeout ) + { + int timeout = atoi(message); + status_change_start(&sd->bl, SC_AUTOTRADE, 10000,0,0,0,0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout)*60000,0); + } + clif_authfail_fd(fd, 15); + } else + clif_displaymessage(fd, "@afk is not allowed on this map."); + return 0; +} + /** * Fills the reference of available commands in atcommand DBMap **/ @@ -9072,7 +9119,8 @@ ACMD_DEF2("rmvperm", addperm), ACMD_DEF(unloadnpcfile), ACMD_DEF(cart), - ACMD_DEF(mount2) + ACMD_DEF(mount2), + ACMD_DEF(afk) }; AtCommandInfo* atcommand; int i;