ACMD_FUNC(recallmap)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
unsigned short mapindex;
int m = -1;
nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message) {
clif_displaymessage(fd, "Please, enter a map name (usage: @recallmap <map>).");
return -1;
}
mapindex = mapindex_name2id(message);
if (mapindex)
m = map_mapindex2mapid(mapindex);
if (!mapindex) {
clif_displaymessage(fd, msg_txt(1)); // Map not found.
return -1;
}
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif_displaymessage(fd, "You are not authorised to warp somenone to your actual map.");
return -1;
}
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
{
if (sd->status.account_id != pl_sd->status.account_id && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
{
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
if (pl_sd->state.autotrade) //Can't recall player in Autotrade mode
if (pl_sd->chatID) // Can't recall players in Chatrooms
continue;
if (pc_isdead(pl_sd)) { //Wake them up
pc_setstand(pl_sd);
pc_setrestartvalue(pl_sd,1);
}
pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
}
}
}
mapit_free(iter);
sprintf(atcmd_output, msg_txt(999), map[m].name); //All characters from %s recalled!
clif_displaymessage(fd, atcmd_output);
return 0;
}
ACMD_FUNC(maprecall)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
int count;
nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->bl.m >= 0 && map[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif_displaymessage(fd, "You are not authorised to warp somenone to your actual map.");
return -1;
}
count = 0;
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
{
if (sd->status.account_id != pl_sd->status.account_id && pc_get_group_level(sd) >= pc_get_group_level(pl_sd))
{
if (pl_sd->state.autotrade) //Can't recall player in Autotrade mode
if (pl_sd->chatID) // Can't recall players in Chatrooms
continue;
else {
if (pc_isdead(pl_sd)) { //Wake them up
pc_setstand(pl_sd);
pc_setrestartvalue(pl_sd,1);
}
pc_setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, 2);
}
}
}
mapit_free(iter);
clif_displaymessage(fd, "All characters on your map recalled!");
if (count) {
sprintf(atcmd_output, "%d player(s) have not been recalled because they are vending or in a chatroom.", count);
clif_displaymessage(fd, atcmd_output);
}
return 0;
}