budek Posted October 14, 2016 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 46 Reputation: 3 Joined: 01/11/14 Last Seen: December 15, 2021 Share Posted October 14, 2016 here is my atcommand.c /*========================================== * @rura, @warp, @mapmove *------------------------------------------*/ ACMD_FUNC(mapmove) { char map_name[MAP_NAME_LENGTH_EXT]; unsigned short mapindex; short x = 0, y = 0; int16 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, msg_txt(sd,909)); // 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 (!mapindex) { // m < 0 means on different server! [Kevin] clif_displaymessage(fd, msg_txt(sd,1)); // Map not found. if (battle_config.warp_suggestions_enabled) warp_get_suggestions(sd, map_name); 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(sd,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(sd,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(sd,248)); return -1; } if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) { clif_displaymessage(fd, msg_txt(sd,1)); // Map not found. return -1; } clif_displaymessage(fd, msg_txt(sd,0)); // Warped. return 0; } 1 Quote Link to comment Share on other sites More sharing options...
0 Scylla Posted October 14, 2016 Group: Members Topic Count: 47 Topics Per Day: 0.01 Content Count: 374 Reputation: 47 Joined: 03/27/13 Last Seen: Monday at 11:23 PM Share Posted October 14, 2016 (edited) here is my atcommand.c /*========================================== * @rura, @warp, @mapmove *------------------------------------------*/ ACMD_FUNC(mapmove) { char map_name[MAP_NAME_LENGTH_EXT]; unsigned short mapindex; short x = 0, y = 0; int16 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, msg_txt(sd,909)); // 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 (!mapindex) { // m < 0 means on different server! [Kevin] clif_displaymessage(fd, msg_txt(sd,1)); // Map not found. if (battle_config.warp_suggestions_enabled) warp_get_suggestions(sd, map_name); 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(sd,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(sd,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(sd,248)); return -1; } if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) { clif_displaymessage(fd, msg_txt(sd,1)); // Map not found. return -1; } clif_displaymessage(fd, msg_txt(sd,0)); // Warped. return 0; } Add this: if (status_isdead(&sd->bl)){ clif_displaymessage(sd->fd,"You can not use @warp while dead."); return 0; } Source: https://rathena.org/board/topic/65504-warp-when-dead/ Edited October 14, 2016 by Scylla Quote Link to comment Share on other sites More sharing options...
0 budek Posted October 14, 2016 Group: Members Topic Count: 19 Topics Per Day: 0.00 Content Count: 46 Reputation: 3 Joined: 01/11/14 Last Seen: December 15, 2021 Author Share Posted October 14, 2016 Thanks men, Quote Link to comment Share on other sites More sharing options...
Question
budek
here is my atcommand.c
/*==========================================
* @rura, @warp, @mapmove
*------------------------------------------*/
ACMD_FUNC(mapmove)
{
char map_name[MAP_NAME_LENGTH_EXT];
unsigned short mapindex;
short x = 0, y = 0;
int16 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, msg_txt(sd,909)); // 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 (!mapindex) { // m < 0 means on different server! [Kevin]
clif_displaymessage(fd, msg_txt(sd,1)); // Map not found.
if (battle_config.warp_suggestions_enabled)
warp_get_suggestions(sd, map_name);
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(sd,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(sd,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(sd,248));
return -1;
}
if (pc_setpos(sd, mapindex, x, y, CLR_TELEPORT) != 0) {
clif_displaymessage(fd, msg_txt(sd,1)); // Map not found.
return -1;
}
clif_displaymessage(fd, msg_txt(sd,0)); // Warped.
return 0;
}
Link to comment
Share on other sites
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.