Jump to content
  • 0

@monster command


jedwynne

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  68
  • Reputation:   2
  • Joined:  03/10/12
  • Last Seen:  

is there any way i could disable a specific monster in @commands. for example you cant summon a poring using @monster poring. if it possible, how?

Link to comment
Share on other sites

15 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.00
  • Content Count:  68
  • Reputation:   2
  • Joined:  03/10/12
  • Last Seen:  

BUMP~

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  134
  • Reputation:   35
  • Joined:  02/27/12
  • Last Seen:  

In src/map/atcommand.c:

Find:

/*==========================================
*
*------------------------------------------*/
ACMD_FUNC(monster)
{
char name[NAME_LENGTH];
char monster[NAME_LENGTH];
char eventname[EVENT_NAME_LENGTH] = "";
int mob_id;
int number = 0;

Before add:

static int monsterBlock(int compareid){
 FILE *fp;
char line[1024];
int ln=0;
int nameid;
char filename[255];
snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path);

if( (fp=fopen(filename,"r"))==NULL ){
  ShowError("can't read %s\n", filename);
 return -1;
}
while(fgets(line, sizeof(line), fp))
{
 if(line[0] == '\n' || line[0] == '\r' || line[0] == ' ' || (line[0]=='/' && line[1]=='/'))
  continue;
 nameid = atoi(line);
 if(compareid == nameid)
 {
  fclose(fp);
  return 1; // Monster Blocked
 }
}
fclose(fp);
return 0; // Monster Accepted

}

Within ACMD_FUNC(monster) find:

int mob_id;

Replace with:

int mob_id, mB = 0;

Find:

if (mob_id == MOBID_EMPERIUM) {
 clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned.
 return -1;
}

After add:

if(pc_get_group_level(sd) < 99 && (mB  = monsterBlock(mob_id)))
 if(mB == 1){
  clif_displaymessage(fd, "Acess_Restriction: Administrator restricted this monster from being called by @monster direct command.");
  return -1;
 }

Go to db path and create a file called: monster_block.txt

Put into it ID from monsters you want to block, like this:

//Comments

1001 //Scorpion

1002

1003 //etc

--------------------------------------------------------------------------------------------------------

Admin level 99 can still summon any monster, if you don't want it change it:

if(pc_get_group_level(sd) < 99 && (mB  = monsterBlock(mob_id)))

To:

if((mB = monsterBlock(mob_id)))

Edit: fixed the fclose part which could lead to file descriptor staying opened "forever".

Edited by MarkZD
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

In src/map/atcommand.c:

Find:

/*==========================================
*
*------------------------------------------*/
ACMD_FUNC(monster)
{
char name[NAME_LENGTH];
char monster[NAME_LENGTH];
char eventname[EVENT_NAME_LENGTH] = "";
int mob_id;
int number = 0;

Before add:

static int monsterBlock(int compareid){
 FILE *fp;
char line[1024];
int ln=0;
int nameid;
char filename[255];
snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path);

if( (fp=fopen(filename,"r"))==NULL ){
  ShowError("can't read %s\n", filename);
 return -1;
}
while(fgets(line, sizeof(line), fp))
{
 if(line[0] == '\n' || line[0] == '\r' || line[0] == ' ' || (line[0]=='/' && line[1]=='/'))
  continue;
 nameid = atoi(line);
 if(compareid == nameid)
  return 1; // Monster Blocked
}
fclose(fp);
return 0; // Monster Accepted

}

Within ACMD_FUNC(monster) find:

int mob_id;

Replace with:

int mob_id, mB = 0;

Find:

if (mob_id == MOBID_EMPERIUM) {
 clif_displaymessage(fd, msg_txt(83)); // Monster 'Emperium' cannot be spawned.
 return -1;
}

After add:

if(pc_get_group_level(sd) < 99 && (mB  = monsterBlock(mob_id)))
 if(mB == 1){
  clif_displaymessage(fd, "Acess_Restriction: Administrator restricted this monster from being called by @monster direct command.");
  return -1;
 }

Go to db path and create a file called: monster_block.txt

Put into it ID from monsters you want to block, like this:

//Comments

1001 //Scorpion

1002

1003 //etc

--------------------------------------------------------------------------------------------------------

Admin level 99 can still summon any monster, if you don't want it change it:

if(pc_get_group_level(sd) < 99 && (mB  = monsterBlock(mob_id)))

To:

if((mB = monsterBlock(mob_id)))

Hi MarkZD

Pls adivse where i must pu Before add:

thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  134
  • Reputation:   35
  • Joined:  02/27/12
  • Last Seen:  

Before the found part:


HERE


/*==========================================
*
*------------------------------------------*/
ACMD_FUNC(monster)
{
char name[NAME_LENGTH];
char monster[NAME_LENGTH];
char eventname[EVENT_NAME_LENGTH] = "";
int mob_id;
int number = 0;

Edited by MarkZD
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

Hi MarkZD

what u mean by Here pls advise more detail because got error when i compile

Or u can help me to combine all in 1 script.

Thanks

Pls advise.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1130
  • Joined:  05/27/12
  • Last Seen:  

MarkZD already provided a very clear explanation on how to add this modification.

http://rathena.org/wiki/Diff

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

Hi Euphy

Here the error please advise

wp045ahzvh.jpg

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

i think he still uses ea.. if ea.. change the pc_get_group_level to pc_isGM.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

Hi Rage

Still got error pls advise

mo2y8sndcy.jpg

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

i'm still waiting for this source

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

Hi Rage

Still got error pls advise

mo2y8sndcy.jpg

Please adivse this error thanks.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  155
  • Topics Per Day:  0.03
  • Content Count:  647
  • Reputation:   16
  • Joined:  11/21/11
  • Last Seen:  

remove the "DBPATH" on "%s/"DBPATH"monster_block.txt", db_path);

Edited by Rage
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   0
  • Joined:  03/19/12
  • Last Seen:  

remove the "DBPATH" on "%s/"DBPATH"monster_block.txt", db_path);

Hi Rage

Can u explain more detail

Thanks

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  134
  • Reputation:   35
  • Joined:  02/27/12
  • Last Seen:  

Change this line from the code I posted above:

snprintf(filename, 255, "%s/"DBPATH"monster_block.txt", db_path);

To this:

snprintf(filename, 255, "%s/monster_block.txt", db_path);

And recompile.

Link to comment
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.   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...