viewing paste Unknown #602 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
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;
}
Viewed 613 times, submitted by Eurydice.