Jump to content
  • 0

Help With Custom Command


Sero

Question


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  5
  • Reputation:   0
  • Joined:  01/24/12
  • Last Seen:  

hi its me again, excuseme for mi bad english, in this time i need help with a custom atcommand

this is the "code"

/*==========================================
* Moblevel   v 1.0
* originally by [sero] Divinero
*------------------------------------------*/
ACMD_FUNC(moblevel)
{
char atcmd_output2[CHAT_SIZE_MAX];
struct mob_db *mob, *mob_array[MAX_SEARCH];
int param1, param2, count;
int i, k, j, d;
memset(atcmd_output, '0', sizeof(atcmd_output));
memset(atcmd_output2, '0', sizeof(atcmd_output2));
if (!message || !*message || sscanf(message, "%d %d", &param1, &param2) == 2) {
if( param1 < 1 || param1 > 161 ) {
clif_displaymessage(fd, "xD");
return -1;
}
if( param2 < 1 || param2 > 161 ) {
clif_displaymessage(fd, "xD");
return -1;
}
if (param1 < param2) {
j = param1;
d = param2;
while (j <= d) {
count = mobdb_searchlv_array(mob_array, MAX_SEARCH, j);
j =+1;
if( count > MAX_SEARCH ){
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif_displaymessage(fd, atcmd_output);
count = MAX_SEARCH;
}
}
}
if (param2 < param1) {
j = param2;
d = param1;
while (j <= d) {
count = mobdb_searchlv_array(mob_array, MAX_SEARCH, j);
j =+1;
if( count > MAX_SEARCH ){
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif_displaymessage(fd, atcmd_output);
count = MAX_SEARCH;
}
}
}
if (param2 == param1) {
j = param2;
d = param1;
count = mobdb_searchlv_array(mob_array, MAX_SEARCH, j);
if( count > MAX_SEARCH ){
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif_displaymessage(fd, atcmd_output);
count = MAX_SEARCH;
}
}
for (k = 0; k < count; k++) {
mob = mob_array[k];
// stats
if (mob->mexp)
sprintf(atcmd_output, "MVP Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
else
sprintf(atcmd_output, "Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
clif_displaymessage(fd, atcmd_output);
sprintf(atcmd_output, " Level:%d  HP:%d  SP:%d  Base EXP:%u  Job EXP:%u", mob->lv, mob->status.max_hp, mob->status.max_sp, mob->base_exp, mob->job_exp);
clif_displaymessage(fd, atcmd_output);
}
return 0;
}
if (!message || !*message || sscanf(message, "%d %d", &param1, &param2) == 1) {
if( param1 < 1 || param1 > 161 ) {
clif_displaymessage(fd, "xD");
return -1;
}
count = mobdb_searchlv_array(mob_array, MAX_SEARCH, param1);
if( count > MAX_SEARCH ){
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif_displaymessage(fd, atcmd_output);
count = MAX_SEARCH;
}
for (k = 0; k < count; k++) {
mob = mob_array[k];
// stats
if (mob->mexp)
sprintf(atcmd_output, "MVP Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
else
sprintf(atcmd_output, "Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
clif_displaymessage(fd, atcmd_output);
sprintf(atcmd_output, " Level:%d  HP:%d  SP:%d  Base EXP:%u  Job EXP:%u", mob->lv, mob->status.max_hp, mob->status.max_sp, mob->base_exp, mob->job_exp);
clif_displaymessage(fd, atcmd_output);
}
return 0;
}
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a Monster/ID (usage: @moblevel <monster_name> or <monster_id>).");
return -1;
} else {
if ((i = mobdb_checkid(atoi(message))))
{
mob_array[0] = mob_db(i);
count = 1;
} else
count = mobdb_searchname_array(mob_array, MAX_SEARCH, message);
if (!count) {
clif_displaymessage(fd, msg_txt(40)); // Invalid monster ID or name.
return -1;
}
if (count > MAX_SEARCH) {
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif_displaymessage(fd, atcmd_output);
count = MAX_SEARCH;
}
for (k = 0; k < count; k++) {
mob = mob_array[k];
if (mob->mexp)
sprintf(atcmd_output, "MVP Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
else
sprintf(atcmd_output, "Monster: '%s'/'%s'/'%s' (%d)", mob->name, mob->jname, mob->sprite, mob->vd.class_);
clif_displaymessage(fd, atcmd_output);
sprintf(atcmd_output, " Level:%d  HP:%d  SP:%d  Base EXP:%u  Job EXP:%u", mob->lv, mob->status.max_hp, mob->status.max_sp, mob->base_exp, mob->job_exp);
clif_displaymessage(fd, atcmd_output);
}
return 0;
}
}

the command should work if you put the name of a mob give its level and othergeneralities (that if it works), and if you put a level to give an overview of the mobsat that level, and if you put a level range such as "100 120 "give the same generalities, but it really does is pull my server when I put the level range -. -

Thank you very much!

Edited by Emistry
Codeboxed Long Content
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.   Paste as plain text instead

  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.

×
×
  • Create New...