R> @afk compatible with Hercules

/*==========================================* @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 add
Code:
ACMD_DEF(afk),
Into src/map/atcommand.c
There's some plugin version floating around that I've not been able to get working.

 
/*==========================================* @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 add
Code:
ACMD_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

 
You did something wrong, then.

Place the first bit of code right above:

Code:
/** * Fills the reference of available commands in atcommand DBMap **/
The second bit of code, further down in the file, like so:
Code:
		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
 
Last edited by a moderator:
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
 
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:
Code:
		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),

Code:
ACMD_DEF(afk),
 
Code:
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;}
 
Back
Top