Вопросы

coolgamer
Новичок

Кароче я сделал команду ipinfo (получение инфы о IP - адресе) переделав немного инклуд playergeolocation (чтобы показывало инфу о регистрационном айпи а не текущем)

Когда ввожу команду, оно показывает диалог без инфы, а когда пишу команду второй раз, то уже показывает инфу.

и еще в консоле появляется вот это: [12:32:08] sscanf warning: String buffer overflow.

//
#define GEO_MAX_IP_LENGTH               (16 + 1)
#define GEO_MAX_COUNTRY_CODE_LENGTH     (4 + 1)
#define GEO_MAX_COUNTRY_NAME_LENGTH     (32 + 1)
#define GEO_MAX_REGION_CODE_LENGTH      (6 + 1)
#define GEO_MAX_REGION_NAME_LENGTH      (32 + 1)
#define GEO_MAX_CITY_NAME_LENGTH        (32 + 1)
#define GEO_MAX_DISTRICT_NAME_LENGTH    (64 + 1)
#define GEO_MAX_LAT_LON_LENGTH          (12 + 1)
#define GEO_MAX_TIMEZONE_NAME_LENGTH    (64 + 1)
#define GEO_MAX_PROVIDER_NAME_LENGTH    (32 + 1)
#define GEO_MAX_MOBILE_STATUS_LENGTH    (5 + 1)
#define GEO_MAX_PROXY_LENGTH            (5 + 1)
enum e_PLAYER_GEO_INFO
{
    player_country_code[GEO_MAX_COUNTRY_CODE_LENGTH],
    player_country[GEO_MAX_COUNTRY_NAME_LENGTH],
    player_region_code[GEO_MAX_REGION_CODE_LENGTH],
    player_region[GEO_MAX_REGION_NAME_LENGTH],
    player_district[GEO_MAX_DISTRICT_NAME_LENGTH],
    player_city[GEO_MAX_CITY_NAME_LENGTH],
    player_lat[GEO_MAX_LAT_LON_LENGTH],
    player_lon[GEO_MAX_LAT_LON_LENGTH],
    player_timezone[GEO_MAX_TIMEZONE_NAME_LENGTH],
    player_provider[GEO_MAX_PROVIDER_NAME_LENGTH],
    player_mobile_status[GEO_MAX_MOBILE_STATUS_LENGTH],
    player_proxy[GEO_MAX_PROXY_LENGTH]
};
new
    player_geo_none[e_PLAYER_GEO_INFO] =
    {
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None",
        "None"
    },
    player_geo[e_PLAYER_GEO_INFO],
    player_geo_ip[GEO_MAX_IP_LENGTH];
    #define GetIpCountryCode(%0)    player_geo[player_country_code]
#define GetIpCountry(%0)          player_geo[player_country]
#define GetIpRegionCode(%0)       player_geo[player_region_code]
#define GetIpRegion(%0)           player_geo[player_region]
#define GetIpCity(%0)             player_geo[player_city]
#define GetIpDistrict(%0)         player_geo[player_district]
#define GetIpLatitude(%0)         player_geo[player_lat]
#define GetIpLongtitude(%0)       player_geo[player_lon]
#define GetIpTimeZone(%0)         player_geo[player_timezone]
#define GetIpProvider(%0)         player_geo[player_provider]
#define GetIpMobileStatus(%0)     player_geo[player_mobile_status]
#define GetIpProxyStatus(%0)      player_geo[player_proxy]
//
#define GEO_IP_INFO_DETECT_URL_PISKA          "ip-api.com/csv/"
#define GEO_IP_INFO_DETECT_URL_FIELDS   "?fields=721887"
#define GEO_MAX_IP_LENGTH               (16 + 1)
CMD:ipinfo(playerid, params[])
{

    if(PlayerInfo[playerid][pAdmin]<5)return 0;
    if(ADuty[playerid]!=228) return SendClientMessage(playerid,COLOR_GREY,NO_DUTY_TEXT);
    new dialog_string[512];
    new
        request[128];


    strcat(request, GEO_IP_INFO_DETECT_URL_PISKA);
    strcat(request, params[0]);
    strcat(request, GEO_IP_INFO_DETECT_URL_FIELDS);

    HTTP(playerid, HTTP_GET, request, "", "p_geo_OnIpInformationRequested");
    


//переделаю потом чтобы показывало инфу о регистрационном айпи
    format(dialog_string, sizeof(dialog_string),
    "{FFFFFF}Проверка IP: {ff9300}%s{FFFFFF}\n\n\
    Страна: {ff9300}%s{FFFFFF}\n\
    Город: {ff9300}%s{FFFFFF}\n\
    Регион: {ff9300}%s{FFFFFF}",
    params[0],
 GetIpCountry(params[0]),
    GetIpCity(params[0]),
    GetIpRegion(params[0]));

    return ShowPlayerDialogEx(playerid, 0, DIALOG_STYLE_MSGBOX, !"Информация об IP-адресе", dialog_string, !"Закрыть", "");
}

forward p_geo_OnIpInformationRequested(playerid, response_code, data[]);
public p_geo_OnIpInformationRequested(playerid, response_code, data[])
{
    if(response_code == 200)
    {
        sscanf(data, "p<,>s[64]s[64]s[64]s[64]s[64]s[64]s[64]s[64]s[64]s[64]s[64]s[64]",
            player_geo[player_country],
            player_geo[player_country_code],
            player_geo[player_region_code],
            player_geo[player_region],
            player_geo[player_city],
            player_geo[player_district],
            player_geo[player_lat],
            player_geo[player_lon],
            player_geo[player_timezone],
            player_geo[player_provider],
            player_geo[player_mobile_status],
            player_geo[player_proxy]);
    }
    else
    {
        player_geo = player_geo_none;
    }
    return 1;
}

 

Поделиться сообщением


Ссылка на сообщение

0 ответов на этот вопрос

Ответы на этот вопрос пока отсутствуют

Гость
Эта тема закрыта для публикации ответов.
  • Последние посетители   0 пользователей онлайн

    Ни одного зарегистрированного пользователя не просматривает данную страницу

  • Похожий контент

    • grizly57a
      От grizly57a
      вот логи 
       
       
      ---------- Loaded log file: "server_log.txt". ---------- SA-MP Dedicated Server ---------------------- v0.3.7-R2, (C)2005-2015 SA-MP Team [16:41:25] [16:41:25] Server Plugins [16:41:25] -------------- [16:41:25] Loading plugin: crashdetect.so [16:41:25] CrashDetect plugin 4.19.4 [16:41:25] Loaded. [16:41:25] Loading plugin: pawncmd.so [16:41:25] Pawn.CMD plugin v3.2.0 by urShadow has been loaded [16:41:25] Loaded. [16:41:25] Loading plugin: pawnraknet.so [16:41:25] [Pawn.RakNet] plugin v1.6.0 loading... [16:41:25] [Pawn.RakNet] | Pawn.RakNet 1.6.0 | 2016 - 2023 |-------------------------------- | Author and maintainer: katursis | Compiled: Feb 12 2023 at 19:35:06 |-------------------------------------------------------------- | Repository: https://github.com/katursis/Pawn.RakNet |-------------------------------------------------------------- | Wiki: https://github.com/katursis/Pawn.RakNet/wiki [16:41:25] Loaded. [16:41:25] Loading plugin: sscanf.so [16:41:25] [16:41:25] =============================== [16:41:25] sscanf plugin loaded. [16:41:25] Version: 2.8.3 [16:41:25] (c) 2018 Alex "Y_Less" Cole [16:41:25] =============================== [16:41:25] Loaded. [16:41:25] Loading plugin: streamer.so [16:41:25] *** Streamer Plugin v2.9.4 by Incognito loaded *** [16:41:25] Loaded. [16:41:25] Loading plugin: mysql_static.so [16:41:25] >> plugin.mysql: R39-6 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: profiler.so [16:41:25] Profiler plugin 2.15.1 [16:41:25] Loaded. [16:41:25] Loading plugin: timerfix.so [16:41:25] >> TimerFix v1.5 successfully loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: UTuning.so [16:41:25] Loaded. [16:41:25] Loading plugin: housecar.so [16:41:25] Loaded. [16:41:25] Loading plugin: TOTP.so [16:41:25] TOTP plugin v1.0.1 by Games loaded. [16:41:25] Loaded. [16:41:25] Loading plugin: FCNPC.so [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] FCNPC - Fully Controllable NPC v2.0.9 [16:41:25] GNU/Linux SA-MP 0.3.7 R2 [16:41:25] Apr 17 2024 at 09:11:36 [16:41:25] [16:41:25] Author: OrMisicL (2013 - 2015) [16:41:25] Continued by: ziggi (2016 - present) [16:41:25] [16:41:25] See full credits in the README.md file [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] [16:41:25] ------------------------------------------------- [16:41:25] ColAndreasv1.4.0 [16:41:25] [16:41:25] Created By: [16:41:25] [uL]Chris42O [16:41:25] [uL]Slice [16:41:25] [uL]Pottus [16:41:25] ------------------------------------------------- [16:41:25] [16:41:25] Loading... [16:41:25] ColAndreas v1.4.0 Loaded. [16:41:25] Loaded. [16:41:25] Loaded 13 plugins. [16:41:25] [16:41:25] Filterscripts [16:41:25] --------------- [16:41:25] Loading filterscript 'voice.amx'... [16:41:25] No collision data found. [16:41:25] [FCNPC] Warning: Unable to create NPCs. The maxnpc limit in server.cfg is 0. [16:41:25] -------------------------------------- [16:41:25] VOICE COPY RADMIR BY ������ dev. [16:41:25] -------------------------------------- [16:41:25] Loaded 1 filterscripts. [16:41:25] *** Streamer Plugin: Include file version (0x295) does not match plugin version (0x294) (script might need to be recompiled with the correct include file). [16:41:25] ------------------------------------------ [16:41:25] SSSS [16:41:25] ------------------------------------------ [16:41:25] mapname = "San Andreas" (string) [16:41:25] [Vehicle]: ��� ������������ �������� ������� [16:41:25] [TP]: ��� �����/������ ������� [16:41:25] [ATM]: ��� ��������� ������� [16:41:25] ����������� � ���� ������ �� ������� [������� � ����� ������ ����������] [16:41:25] ----------------------------------------- [16:41:25] [16:41:25] [16:41:25] [16:41:25] ----------------------------------------- [16:41:25] Number of vehicle models: 55 [16:42:00] [connection] 93.159.241.195:2395 requests connection cookie. [16:42:01] [connection] incoming connection: 93.159.241.195:2395 id: 0 [16:42:02] [join] Dkak_wlaas has joined the server (0:93.159.241.195) [16:42:02] [part] Dkak_wlaas has left the server (0:2)