Jump to content
  • 0

@showip for rAthena ?


Question

Posted (edited)
int atcommand_showip(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
        char temp0[100];
        struct map_session_data *pl_sd;
        struct s_mapiterator* iter;
        int j, count;
        int pl_GM_level, GM_level;
        char match_text[100];
        char player_name[NAME_LENGTH];
        char ip[16];
        uint32 ipl;
        
        nullpo_retr(-1, sd);

        memset(atcmd_output, '\0', sizeof(atcmd_output));
        memset(match_text, '\0', sizeof(match_text));
        memset(player_name, '\0', sizeof(player_name));

        if (sscanf(message, "%99[^\n]", match_text) < 1)
                strcpy(match_text, "");
        for (j = 0; match_text[j]; j++)
                match_text[j] = TOLOWER(match_text[j]);

        count = 0;
        GM_level = pc_isGM(sd);

        iter = mapit_getallusers();
        for( pl_sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); pl_sd = (TBL_PC*)mapit_next(iter) )
        {
                pl_GM_level = pc_isGM(pl_sd);
                if(!( (battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && pl_GM_level > GM_level ))
                {
                        memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
                        for (j = 0; player_name[j]; j++)
                                player_name[j] = TOLOWER(player_name[j]);
                        if (strstr(player_name, match_text) != NULL) {

                                if (battle_config.who_display_aid > 0 && pc_isGM(sd) >= battle_config.who_display_aid) {
                                        sprintf(atcmd_output, "(CID:%d/AID:%d) ", pl_sd->status.char_id, pl_sd->status.account_id);
                                } else {
                                        atcmd_output[0]=0;
                                }
                                //Player name
                                sprintf(temp0, msg_txt(333), pl_sd->status.name);
                                strcat(atcmd_output,temp0);
                                //Player title, if exists


                                ipl = session[pl_sd->fd]->client_addr;
                                ip2str(ipl, ip);
                                
                                sprintf(temp0, "| IP:%s | ", ip);
                                strcat(atcmd_output,temp0);
                                        
                                //Players Location: map x y
                                sprintf(temp0, msg_txt(338), mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
                                strcat(atcmd_output,temp0);

                                clif_displaymessage(fd, atcmd_output);
                                count++;
                        }
                }
        }
        mapit_free(iter);

        if (count == 0)
                clif_displaymessage(fd, msg_txt(28)); // No player.
        else if (count == 1)
                clif_displaymessage(fd, msg_txt(29)); // 1 player.
        else {
                sprintf(atcmd_output, msg_txt(30), count); // %d players.
                clif_displaymessage(fd, atcmd_output);
        }

        return 0;
}

 

 Can help me to fix it in rathena version? 

Thank in advance ;)

Edited by tinko

1 answer to this question

Recommended Posts

Posted

you can use this to view the IP address.

 

@accinfo <name>

or..

*getcharip({"<character name>"|<account id>|<char id>})

This function will return the IP address of the invoking character, or, if a player
is specified, of that character. A blank string is returned if no player is attached.

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