Jump to content
  • 0

@warp when dead


Brynner

Question


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  1942
  • Reputation:   197
  • Joined:  01/08/12
  • Last Seen:  

how to disable @warp when your dead. the default on rathena is you can still use @warp even your in a dead status. anyone know how to implement this?

Link to comment
Share on other sites

6 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   4
  • Joined:  11/09/11
  • Last Seen:  

Add this code in your @warp command

if (status_isdead(&sd->bl)){
clif_displaymessage(sd->fd,"You can not use @warp while dead.");
return 0;
}

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  118
  • Topics Per Day:  0.03
  • Content Count:  1942
  • Reputation:   197
  • Joined:  01/08/12
  • Last Seen:  

Add this code in your @warp command

if (status_isdead(&sd->bl)){
clif_displaymessage(sd->fd,"You can not use @warp while dead.");
return 0;
}

where should i put this?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  224
  • Reputation:   22
  • Joined:  03/23/12
  • Last Seen:  

src/map/atcommand.c like this:

/*==========================================
* @rura, @warp, @mapmove
*------------------------------------------*/
ACMD_FUNC(mapmove)
{
   char map_name[MAP_NAME_LENGTH_EXT];
   unsigned short mapindex;
   short x = 0, y = 0;
   int m = -1;

   nullpo_retr(-1, sd);

   memset(map_name, '\0', sizeof(map_name));

   if (!message || !*message ||
       (sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 &&
        sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) {

           clif_displaymessage(fd, "Please, enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>).");
           return -1;
   }

   mapindex = mapindex_name2id(map_name);
   if (mapindex)
       m = map_mapindex2mapid(mapindex);

   if (status_isdead(&sd->bl)){
       clif_displaymessage(sd->fd,"You can not use @warp while dead.");
       return 0;
   }

   if (!mapindex) { // m < 0 means on different server! [Kevin]
       clif_displaymessage(fd, msg_txt(1)); // Map not found.
       return -1;
   }

   if ((x || y) && map_getcell(m, x, y, CELL_CHKNOPASS))
     {    //This is to prevent the pc_setpos call from printing an error.
       clif_displaymessage(fd, msg_txt(2));
       if (!map_search_freecell(NULL, m, &x, &y, 10, 10, 1))
           x = y = 0; //Invalid cell, use random spot.
   }
   if (map[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
       clif_displaymessage(fd, msg_txt(247));
       return -1;
   }
   if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
       clif_displaymessage(fd, msg_txt(248));
       return -1;
   }
   if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
       clif_displaymessage(fd, msg_txt(1)); // Map not found.
       return -1;
   }

   clif_displaymessage(fd, msg_txt(0)); // Warped.
   return 0;

}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  34
  • Reputation:   4
  • Joined:  11/09/11
  • Last Seen:  

Add this code in your @warp command

if (status_isdead(&sd->bl)){
clif_displaymessage(sd->fd,"You can not use @warp while dead.");
return 0;
}

It should be return -1 not 0.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   3
  • Joined:  06/12/12
  • Last Seen:  

The code given here to answer Brynner's question did not work for me.

I use revision 16243, and after some toying around with the code I found that the following code did in fact work for me:

if( pc_isdead(sd) )

{

clif_displaymessage(fd, "You cannot use this command when dead.");

return -1;

}

/no1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  28
  • Topics Per Day:  0.01
  • Content Count:  353
  • Reputation:   70
  • Joined:  07/14/12
  • Last Seen:  

Add this code in your @warp command

if (status_isdead(&sd->bl)){
clif_displaymessage(sd->fd,"You can not use @warp while dead.");
return 0;
}

works great! even with @go :D

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