Jump to content
  • 0

guide on adding @afk commands


Question

7 answers to this question

Recommended Posts

Posted

I did not test if the command works but here you go, open src/map/atcommand.c and find

ACMD_FUNC(cart) {

#define MC_CART_MDFY(x) \
sd->status.skill[MC_PUSHCART].id = x?MC_PUSHCART:0; \
sd->status.skill[MC_PUSHCART].lv = x?1:0; \
sd->status.skill[MC_PUSHCART].flag = x?1:0;

int val = atoi(message);
bool need_skill = pc_checkskill(sd, MC_PUSHCART) ? false : true;

if( !message || !*message || val < 0 || val > MAX_CARTS ) {
	sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>).
	clif_displaymessage(fd, atcmd_output);
	return -1;
}

if( val == 0 && !pc_iscarton(sd) ) {
	clif_displaymessage(fd, msg_txt(1391)); // You do not possess a cart to be removed
	return -1;
}

if( need_skill ) {
	MC_CART_MDFY(1);
}

if( pc_setcart(sd, val) ) {
	if( need_skill ) {
		MC_CART_MDFY(0);
	}
	return -1;/* @cart failed */
}

if( need_skill ) {
	MC_CART_MDFY(0);
}

clif_displaymessage(fd, msg_txt(1392)); // Cart Added

return 0;
#undef MC_CART_MDFY
}

Then you place this code below it:


/*==========================================
* @afk by [cr0wmaster]
* Features: 1z required to use. Venders are forbidden to use this command.
*------------------------------------------*/
ACMD_FUNC(afk)
{
nullpo_retr(-1, sd);
if (sd->vender_id)  //check if that player's vending [cr0wmaster]
{
clif_displaymessage(fd, "You can't use this command while you're vending.");
}
else
if(sd->status.zeny >= 1)
  {

           sd->status.zeny += -1;
          clif_updatestatus(sd, SP_ZENY);
          sd->state.logout = 1;
clif_authfail_fd(fd, 15);
  } else {
      clif_displaymessage(fd, "You do not have enough money to use this command.");
      clif_displaymessage(fd, "@afk failed.");
          }
return 0;
}

Then you find

ACMD_DEF(mount2)

replace it with the following

ACMD_DEF(mount2),

and add the following below

ACMD_DEF(afk)

Compile your server and you're done.

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...