thanna 11 Posted June 2, 2013 (edited) Can I request for a plugin atcommand AFK with a function like this on a misc.conf file // Set this to the amount of minutes afk chars will be kicked from the server. 720 = 12 hours afk_timeout: 0 I have this on my old emulator before somehow as I read through the forums source code for hercules is different here's the code for it Index: atcommand.c===================================================================--- atcommand.c (revision 17321)+++ atcommand.c (working copy)@@ -8989,6 +8989,48 @@ return 0; } +/*==========================================+* @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( pc_isdead(sd) ) {+ clif_displaymessage(fd, "Cannot @afk if you are dead.");+ return -1;+ }++ 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.afk_timeout )+ {+ int timeout = atoi(message);+ status_change_start(NULL, &sd->bl, SC_AUTOTRADE, 10000,0,0,0,0, ((timeout > 0) ? min(timeout,battle_config.afk_timeout) : battle_config.afk_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 **/@@ -9253,7 +9295,8 @@ ACMD_DEF(channel), ACMD_DEF(fontcolor), ACMD_DEF(langtype),- ACMD_DEF(reloadmsgconf)+ ACMD_DEF(reloadmsgconf),+ ACMD_DEF(afk) }; AtCommandInfo* atcommand; int i;Index: battle.c===================================================================--- battle.c (revision 17321)+++ battle.c (working copy)@@ -5892,6 +5892,7 @@ { "quest_exp_rate", &battle_config.quest_exp_rate, 100, 0, INT_MAX, }, { "at_mapflag", &battle_config.autotrade_mapflag, 0, 0, 1, }, { "at_timeout", &battle_config.at_timeout, 0, 0, INT_MAX, },+ { "afk_timeout", &battle_config.afk_timeout, 0, 0, INT_MAX, }, { "homunculus_autoloot", &battle_config.homunculus_autoloot, 0, 0, 1, }, { "idle_no_autoloot", &battle_config.idle_no_autoloot, 0, 0, INT_MAX, }, { "max_guild_alliance", &battle_config.max_guild_alliance, 3, 0, 3, },Index: battle.h===================================================================--- battle.h (revision 17321)+++ battle.h (working copy)@@ -433,6 +433,7 @@ int quest_exp_rate; int autotrade_mapflag; int at_timeout;+ int afk_timeout; int homunculus_autoloot; int idle_no_autoloot; int max_guild_alliance;Index: misc.conf===================================================================--- misc.conf (revision 17321)+++ misc.conf (working copy)@@ -124,3 +124,6 @@ // 1 = Yes // 2 = Yes, when there are unread mails mail_show_status: 0++// Set this to the amount of minutes afk chars will be kicked from the server.+afk_timeout: 0 Edited June 2, 2013 by thanna Quote Share this post Link to post Share on other sites
0 Shikazu 11 Posted June 2, 2013 Can you give me a copy of that old @afk command? Would speed up the whole process Quote Share this post Link to post Share on other sites
0 thanna 11 Posted June 2, 2013 Can you give me a copy of that old @afk command? Would speed up the whole process I paste it on my 1st post Quote Share this post Link to post Share on other sites
0 Shikazu 11 Posted June 2, 2013 Thanks, will work on it Quote Share this post Link to post Share on other sites
0 Shikazu 11 Posted June 2, 2013 I removed most of the stuff from the src you've sent me, so the plugin will only be able to be afk where ever you want, until i have access to the battle config through the plugin. I know that you might not want to use it like this, but i can't offer a better plugin, since i have no access to the needed functions. Here it is: http://herc.ws/board/topic/984-atcommandafk/ ~Shikazu Quote Share this post Link to post Share on other sites
0 thanna 11 Posted June 3, 2013 no problem, thanks for the help Quote Share this post Link to post Share on other sites
Can I request for a plugin atcommand AFK with a function like this on a misc.conf file
I have this on my old emulator before somehow as I read through the forums source code for hercules is different
here's the code for it
Edited by thannaShare this post
Link to post
Share on other sites