p!\/aT3 0 Posted July 20, 2013 as the title says, sir/mam im request for a @afk command for hercules. thanks Quote Share this post Link to post Share on other sites
0 jTynne 101 Posted July 20, 2013 /*==========================================* @afk by Rad, built on by Tubby * same as autotrade, but works without vending*------------------------------------------*/int atcommand_afk(const int fd, struct map_session_data* sd, const char* command, const char* message){nullpo_retr(-1, sd);if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ){if (!message || !*message) {chat_createpcchat(sd, "(@afk) Away", "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);}if((strlen(message) < 0)||(strlen(message) > 36)) {chat_createpcchat(sd, "(@afk) Away", "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);}chat_createpcchat(sd, message, "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);} elseclif_displaymessage(fd, "AFK is not allowed on this map.");return 0;}And also addACMD_DEF(afk),Into src/map/atcommand.c There's some plugin version floating around that I've not been able to get working. Quote Share this post Link to post Share on other sites
0 quesoph 105 Posted July 20, 2013 (edited) Original Topic: Click afk.diff Edited July 20, 2013 by quesoph 1 mrlongshen reacted to this Quote Share this post Link to post Share on other sites
0 EriNa_KillerSoul 9 Posted July 20, 2013 /*==========================================* @afk by Rad, built on by Tubby * same as autotrade, but works without vending*------------------------------------------*/int atcommand_afk(const int fd, struct map_session_data* sd, const char* command, const char* message){nullpo_retr(-1, sd);if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ){if (!message || !*message) {chat_createpcchat(sd, "(@afk) Away", "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);}if((strlen(message) < 0)||(strlen(message) > 36)) {chat_createpcchat(sd, "(@afk) Away", "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);}chat_createpcchat(sd, message, "", 1, 1);trade_tradeack(sd,4);sd->state.autotrade = 1;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);} elseclif_displaymessage(fd, "AFK is not allowed on this map.");return 0;}And also addACMD_DEF(afk),Into src/map/atcommand.c There's some plugin version floating around that I've not been able to get working. atcommand.c: In function 'atcommand_afk':atcommand.c:9444: warning: implicit declaration of function 'trade_tradeack'atcommand.c:9452: warning: implicit declaration of function 'clif_authfail_fd'atcommand.c:9485: warning: implicit declaration of function 'clif_displaymessage'atcommand.c: In function 'atcommand_basecommands':atcommand.c:9752: warning: initialization from incompatible pointer type I got this when compile Quote Share this post Link to post Share on other sites
0 jTynne 101 Posted July 20, 2013 You did something wrong, then. Place the first bit of code right above: /** * Fills the reference of available commands in atcommand DBMap **/The second bit of code, further down in the file, like so: ACMD_DEF(channel), ACMD_DEF(fontcolor), ACMD_DEF(searchstore), ACMD_DEF(costume), ACMD_DEF(afk),Works fine for me when placed in the correct location. /wah Quote Share this post Link to post Share on other sites
0 Samuel 83 Posted July 20, 2013 atcommand.c: In function 'atcommand_afk':atcommand.c:9444: warning: implicit declaration of function 'trade_tradeack' atcommand.c:9452: warning: implicit declaration of function 'clif_authfail_fd' atcommand.c:9485: warning: implicit declaration of function 'clif_displaymessage' atcommand.c: In function 'atcommand_basecommands': atcommand.c:9752: warning: initialization from incompatible pointer type i think you need to change them to trade->tradeack clif->authfail_fd clif->displaymessage Quote Share this post Link to post Share on other sites
0 quesoph 105 Posted July 20, 2013 (edited) its clif->message or use the diff that I uploaded. I made it compatible for Hercules. Click me Edited July 20, 2013 by quesoph Quote Share this post Link to post Share on other sites
0 EriNa_KillerSoul 9 Posted July 20, 2013 You did something wrong, then. Place the first bit of code right above: /** * Fills the reference of available commands in atcommand DBMap **/The second bit of code, further down in the file, like so: ACMD_DEF(channel), ACMD_DEF(fontcolor), ACMD_DEF(searchstore), ACMD_DEF(costume), ACMD_DEF(afk),Works fine for me when placed in the correct location. /wah I paste before this line /** * Fills the reference of available commands in atcommand DBMap **/ and paste this below ACMD_DEF(costume), ACMD_DEF(afk), Quote Share this post Link to post Share on other sites
0 Emistry 145 Posted July 21, 2013 ACMD(afk){ nullpo_retr(-1, sd); if( map[sd->bl.m].flag.autotrade == battle_config.autotrade_mapflag ){ chat_createpcchat(sd, "Be Right Back", "", 1, 1); sd->state.autotrade = 1; 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->chsys_quit(sd); clif->authfail_fd(sd->fd, 15); }else{ clif->message(fd, "AFK is not allowed on this map."); } return 0;} 1 EriNa_KillerSoul reacted to this Quote Share this post Link to post Share on other sites
0 mrlongshen 22 Posted August 14, 2013 thx alot . works on latest svn. Quote Share this post Link to post Share on other sites
as the title says, sir/mam im request for a @afk command for hercules. thanks
Share this post
Link to post
Share on other sites