Jump to content
  • 0
Sign in to follow this  
Max

AFK Plugins update

Question

I opened another topic before but seem the owner of the script is busy didnt update the script so I was hoping anyone can fix it ?

 

/*	By Dastgir/HerculesChangelog:v1.0 - Initial Conversionv1.1 - Dead Person cannot @afk.v1.2 - Added afk_timeout option(Battle_Config too...) Yippy...v1.3 - Added noafk mapflag :Dv1.4 - Compatible with new Hercules.Battle Config Adjustment:You can add "afk_timeout: seconds" in any of the files in conf/battle/ to make it work(so you don't have to recompile everytime you want to change timeout seconds)MapFlags:Add mapflag just like you add other mapflags,e.g:prontera	mapflag	noafk^ Add Above to any script, and it will make prontera to be noafk zone.*/#include "common/hercules.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include "common/HPMi.h"#include "common/memmgr.h"#include "common/mmo.h"#include "common/socket.h"#include "common/strlib.h"#include "common/timer.h"#include "common/mapindex.h"#include "map/battle.h"#include "map/clif.h"#include "map/script.h"#include "map/skill.h"#include "map/pc.h"#include "map/map.h"#include "map/status.h"#include "map/channel.h"#include "common/HPMDataCheck.h"HPExport struct hplugin_info pinfo ={	"@afk",			// Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"1.4",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};int afk_timeout = 0;struct plugin_mapflag {	unsigned noafk : 1;};ACMD(afk){	/*	MapFlag Restriction	*/	struct plugin_mapflag *mf_data = getFromMAPD(&map->list[sd->bl.m], 0);	if (mf_data && mf_data->noafk)	{		clif->message(fd, "@afk is forbidden in this map.");		return true;	}	if( pc_isdead(sd) ) {		clif->message(fd, "Cannot use @afk While dead.");		return true;	}	if(DIFF_TICK(timer->gettick(),sd->canlog_tick) < battle->bc->prevent_logout) {		clif->message(fd, "Failed to use @afk, please try again later.");		return true;	}	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( afk_timeout )	{		status->change_start(NULL, &sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, afk_timeout*1000,0);	}	channel->quit(sd); //Quit from Channels.	clif->authfail_fd(fd, 15);	return true;}void afk_timeout_adjust(const char *val) {	//In Seconds	int value = config_switch(val);	if (value < 0){		ShowDebug("Received Invalid Setting for afk_timeout(%d), defaulting to 0n",value);		return;	}	afk_timeout = value;	return;	}void parse_noafk_mapflag(const char *name, char *w3, char *w4, const char* start, const char* buffer, const char* filepath, int *retval){	int16 m = map->mapname2mapid(name);	if (!strcmpi(w3,"noafk")){		struct plugin_mapflag *mf_data;		if ( !( mf_data = getFromMAPD(&map->list[m], 0) ) )		{			CREATE(mf_data,struct plugin_mapflag,1);			mf_data->noafk = 1;			addToMAPD(&map->list[m], mf_data, 0, true);		}		mf_data->noafk = 1;		hookStop();	}		return;}/* Server Startup */HPExport void plugin_init (void){	addAtcommand("afk",afk);	addHookPre("npc->parse_unknown_mapflag",parse_noafk_mapflag);}HPExport void server_preinit (void) {	addBattleConf("afk_timeout",afk_timeout_adjust);}HPExport void server_online (void) {	ShowInfo ("'%s' Plugin by Dastgir/Hercules. Version '%s'n",pinfo.name,pinfo.version);}

AFK.c plugins

 

 

Since the new update: https://github.com/HerculesWS/Hercules/commit/f102c913b2aa093ef40c7846e25850ebb1106d71

 

What should I add ? return ? Should it be like this ?

 

HPExport void server_preinit (void) {	addBattleConf("afk_timeout",afk_timeout_adjust);        return; // or return true;}

 

The error showing:

 

afk.c: In function 'server_preinit':afk.c:125:48: error: macro "addBattleConf" requires 3 arguments, but only 2 given  addBattleConf("afk_timeout",afk_timeout_adjust);                                                ^afk.c:125:2: error: 'addBattleConf' undeclared (first use in this function)  addBattleConf("afk_timeout",afk_timeout_adjust);  ^afk.c:125:2: note: each undeclared identifier is reported only once for each function it appears in

Thank you

Edited by Max

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.