Index: atcommand.c =================================================================== --- atcommand.c (revision 16781) +++ atcommand.c (working copy) @@ -8818,6 +8818,53 @@ #undef MC_CART_MDFY } +/*========================================== +* @afk +*------------------------------------------*/ +ACMD_FUNC(afk) { + + struct chat_data* cd; + nullpo_retr(-1, sd); + cd = (struct chat_data*)map_id2bl(sd->chatID); + + if( cd==NULL || (struct block_list *)sd != cd->owner ){ + clif_displaymessage(fd, "You must be in a chat room to use the @afk."); + return -1;} + + 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; + // safestrncpy(cd->title, "[AFK] Leave a Message", CHATROOM_TITLE_SIZE); + cd->limit = 0; + cd->users = 0; + 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_dispchat(cd,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;