/*==========================================
* @afk by GM Chatterboy [BesprenRO Script]
* Turns on/off Autotrade for a specific player
*------------------------------------------*/
ACMD_FUNC(afk) {
nullpo_retr(-1, sd);
if( map[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) {
clif_displaymessage(fd, msg_txt(sd,1179)); // Autotrade is not allowed on this map.
return -1;
}
if( pc_isdead(sd) ) {
clif_displaymessage(fd, msg_txt(sd,1180)); // You cannot autotrade when dead.
return -1;
}
sd->state.autotrade = 1;
if( battle_config.at_timeout ) {
int timeout = atoi(message);
status_change_start(NULL,&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
}
channel_pcquit(sd,0xF); //leave all chan
clif_authfail_fd(sd->fd, 15);
return 0;
}