Jump to content
  • 0
Brynner

@mapmoblist not compatible with the latest version.

Question

here is the code for this HPM Plugins but i think it is outdated.

 

#include <stdio.h>#include <string.h>#include "../common/HPMi.h"#include "../map/script.h"#include "../map/pc.h"#include "../map/map.h"HPExport struct hplugin_info pinfo = {	"mapmoblist",		// Plugin name	SERVER_TYPE_MAP,// Which server types this plugin works with?	"1.0",			// Plugin version	HPM_VERSION,	// HPM Version (don't change, macro is automatically updated)};static int count_mob(struct block_list *bl, va_list ap) // [FE]{    struct mob_data *md = (struct mob_data*)bl;    int id = va_arg(ap, int);    if (md->class_ == id)        return 1;    return 0;}ACMD(mapmoblist){	char temp[100];    bool mob_searched[MAX_MOB_DB];    bool mob_mvp[MAX_MOB_DB]; // Store mvp data..    struct s_mapiterator* it;    unsigned short count = 0, i, mapindex = 0;    int m = 0;    memset(mob_searched, 0, MAX_MOB_DB);    memset(mob_mvp, 0, MAX_MOB_DB);    if (message && *message) {        // Player input map name, search mob list for that map        mapindex = mapindex_name2id(message);        if (!mapindex) {            clif->message(fd, "Map not found");            return -1;        }        m = map_mapindex2mapid(mapindex);    } else {        // Player doesn't input map name, search mob list in player current map        mapindex = sd->mapindex;        m = sd->bl.m;    }    clif->message(fd, "--------Monster List--------");    sprintf(temp, "Mapname: %s", mapindex_id2name(mapindex));    clif->message(fd, temp);    clif->message(fd, "Monsters: ");    //Looping and search for mobs    it = mapit_geteachmob();    while (true) {        TBL_MOB* md = (TBL_MOB*)mapit->next(it);        if (md == NULL)            break;        if (md->bl.m != m || md->status.hp <= 0)            continue;        if (mob_searched[md->class_] == true)            continue; // Already found, skip it        if (mob_db(md->class_)->mexp) {            mob_searched[md->class_] = true;            mob_mvp[md->class_] = true; // Save id for later            continue; // It's MVP!        }        mob_searched[md->class_] = true;        count = map_foreachinmap(count_mob, m, BL_MOB, md->class_);        sprintf(temp, " %s[%d] : %d", mob_db(md->class_)->jname, md->class_, count);        clif->message(fd, temp);    }    mapit->free(it);    clif->message(fd, "MVP: ");    // Looping again and search for mvp, not sure if this is the best way..    for (i = 1000; i < MAX_MOB_DB; i++) { //First monster start at 1001 (Scorpion)        if (mob_mvp[i] == true) {            count = map_foreachinmap(count_mob, m, BL_MOB, i);            sprintf(temp, " %s[%d] : %d", mob_db(i)->jname, i, count);            clif->message(fd, temp);        }    }	return true;}/* Server Startup */HPExport void plugin_init (void){	clif = GET_SYMBOL("clif");    script = GET_SYMBOL("script");    battle = GET_SYMBOL("battle");    if( HPMi->addCommand != NULL ) {//link our '@sample' command		HPMi->addCommand("mapmoblist",ACMD_A(mapmoblist));	}}

thanks you.

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

here is the code for this HPM Plugins but i think it is outdated.

 

#include <stdio.h>#include <string.h>#include "../common/HPMi.h"#include "../map/script.h"#include "../map/pc.h"#include "../map/map.h"...

thanks you.

Okay I made your plugins compatible with latest rev. and it works on game.

test it out :) @mapmoblist

Share this post


Link to post
Share on other sites
  • 0

kinda, for example HPMi->addCommand was replaced with something else, also its missing hpmdatacheck include...I could be of more help if you could provide the compiling errors

Share this post


Link to post
Share on other sites
  • 0

he

 

kinda, for example HPMi->addCommand was replaced with something else, also its missing hpmdatacheck include...I could be of more help if you could provide the compiling errors

here is the Errors/Warnings

 

Warning	1	warning C4013: 'mapindex_name2id' undefined; assuming extern returning int	srcpluginsmapmoblist.c	38	1	mapmoblistWarning	2	warning C4013: 'map_mapindex2mapid' undefined; assuming extern returning int	srcpluginsmapmoblist.c	43	1	mapmoblistError	3	error C2223: left of '->id2name' must point to struct/union	srcpluginsmapmoblist.c	52	1	mapmoblistWarning	4	warning C4013: 'mob_db' undefined; assuming extern returning int	srcpluginsmapmoblist.c	68	1	mapmoblistError	5	error C2223: left of '->mexp' must point to struct/union	srcpluginsmapmoblist.c	68	1	mapmoblistWarning	6	warning C4013: 'map_foreachinmap' undefined; assuming extern returning int	srcpluginsmapmoblist.c	75	1	mapmoblistError	7	error C2223: left of '->jname' must point to struct/union	srcpluginsmapmoblist.c	77	1	mapmoblistError	8	error C2223: left of '->jname' must point to struct/union	srcpluginsmapmoblist.c	89	1	mapmoblistWarning	9	warning C4013: 'ACMD_A' undefined; assuming extern returning int	srcpluginsmapmoblist.c	105	1	mapmoblistError	10	error C2065: 'mapmoblist' : undeclared identifier	srcpluginsmapmoblist.c	105	1	mapmoblistWarning	11	warning C4047: 'function' : 'bool (__cdecl *)(const int,map_session_data *,const char *,const char *,AtCommandInfo *)' differs in levels of indirection from 'int'	srcpluginsmapmoblist.c	105	1	mapmoblistWarning	12	warning C4024: 'function through pointer' : different types for formal and actual parameter 2	srcpluginsmapmoblist.c	105	1	mapmoblist

Share this post


Link to post
Share on other sites
  • 0

mapindex_name2id didn't work on plugins before so I'd be safe to say the plugin didn't fully work before the update either....

Replace

    if( HPMi->addCommand != NULL ) {//link our '@sample' command		HPMi->addCommand("mapmoblist",ACMD_A(mapmoblist));	}
with
	addAtcommand("mapmoblist",mapmoblist);//link our '@mapmoblist' command
and
mapindex_name2id
with
mapindex->name2id
as for this stuff
    battle = GET_SYMBOL("battle");
you'll need to add map/mapindex/mob as well (and their includes)

Share this post


Link to post
Share on other sites
  • 0

thanks. this is my first time to use custom HPM Plugins.

 

i got this warning?

7>srcpluginsmapmoblist.c(56): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.7>          c:program files (x86)microsoft visual studio 11.0vcincludestdio.h(357) : see declaration of 'sprintf'7>srcpluginsmapmoblist.c(81): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.7>          c:program files (x86)microsoft visual studio 11.0vcincludestdio.h(357) : see declaration of 'sprintf'7>srcpluginsmapmoblist.c(93): warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.7>          c:program files (x86)microsoft visual studio 11.0vcincludestdio.h(357) : see declaration of 'sprintf'

is this normal?i use Visual Studio 2012.

Share this post


Link to post
Share on other sites

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...

×
×
  • Create New...

Important Information

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