搜索
查看: 3453|回复: 3

【求助】IP显示插件BUG问题,感谢。

[复制链接]
发表于 2020-6-21 12:37:16 | 显示全部楼层 |阅读模式 来自 上海
本帖最后由 yidunsaocaozuo 于 2020-6-25 13:57 编辑

bug:


源码:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <cstrike>
#include <fakemeta>
#include <li_geoip>

#define PLUGIN        "sXe Msg"
#define VERSION        "1.0"
#define AUTHOR        "Qg"
#define LOADING        "^n^t%s v%s, Copyright (C) 2020 by %s^n"

new bool:iUseSteamClient[33]
new g_SpecMode[33]
new msg[191]

public plugin_init()
{
        register_plugin(PLUGIN, VERSION, AUTHOR);
        register_event( "StatusValue", "DisplayInfo", "bd", "1=2");
        register_event( "TextMsg", "SetSpecMode", "bd", "2&ec_Mod");
}

public client_putinserver(id)
{
        new SteamID[32];
        get_user_authid(id, SteamID, charsmax(SteamID));
        if(containi(SteamID, ":") >= 0)
                iUseSteamClient[id] = true;
        else
                iUseSteamClient[id] = false;
        if(is_user_connected(id))
        {
                set_task(3.0,"login",id);
        }
        return PLUGIN_CONTINUE;
}

public SetSpecMode(id){       
        new arg[12];
        read_data( 2, arg, 11);
        g_SpecMode[id] = ( arg[10] == '4' );
}

public DisplayInfo(id){

        if ( g_SpecMode[id]){
               
                new player = read_data(2);
                if ( is_user_connected( player)){
                       
                        new szName[32];
                        get_user_name( player, szName, 31);
                       
                        new szIP[16], szCountry[40], szArea[64],sxe1[128];
                        get_user_ip( player, szIP, 15, 1);
                        get_ipinfo( szIP, szCountry, szArea, 39, 63);
                       
                        if(is_steam(player))
                        sxe1 = "Steam正版用户"
                        else
                        sxe1 = "NoSteam盗版用户"

                        new szMessage[512];

                        format( szMessage, 511, "%s^n【%s】^n来自:%s %s",
                                szName,
                                sxe1,
                                szCountry,
                                szArea);

                        if(is_steam(player))
                        set_hudmessage( 0, 191, 255, 0.63, 0.72, 0, 6.0, 18.0, 0.5, 0.15, 3) ;       
                        else
                        set_hudmessage( 255, 255, 255, 0.63, 0.72, 0, 6.0, 18.0, 0.5, 0.15, 3) ;       
                        show_hudmessage(id, szMessage);

                }
        }
}

get_ipinfo( szIP[], szCountry[], szArea[], clen, alen){
       
        //可能 li_geoip 模块将 192.168.*.* 网段固定为"内网用户", 这里提供修改的办法.
        if( strfind( szIP, "192.168.") == 1){
               
                /*修改成你自己的网吧的地区名*/
                copy( szCountry, clen, "***本地***");
               
                /*修改成你自己的网吧的名称*/
                copy( szArea, alen, "局域网");
        }
        else
                geoip_info( szIP, szCountry, szArea, clen, alen);
}

public login(id)
{
new szIP[16], szCountry[40], szArea[64],name[32]
get_user_ip( id, szIP, 15, 1);
get_user_name(id,name,31)
geoip_info( szIP, szCountry, szArea, 39, 63);

if(iUseSteamClient[id])
{
client_color(id, id, msg)
format(msg, 190,"^x01【^x04Steam正版用户^x01】^x03%s^x01进入了服务器, ^x01IP: ^x04%s ^x01来自^x04%s%s^n",name,szIP,szCountry,szArea)
client_color(0, id, msg)
}
if(!iUseSteamClient[id])
{
client_color(id, id, msg)
format(msg, 190,"^x01【^x04NoSteam盗版用户^x01】^x03%s^x01进入了服务器, ^x01IP: ^x04%s ^x01来自^x04%s%s^n",name,szIP,szCountry,szArea)
client_color(0, id, msg)
}
return PLUGIN_CONTINUE;
}

public is_steam(id)
        return iUseSteamClient[id];

public client_color(playerid, colorid, msg[])
{
        message_begin(playerid?MSG_ONE_UNRELIABLE:MSG_BROADCAST,get_user_msgid("SayText"),_,playerid)
        write_byte(colorid)
        write_string(msg)
        message_end()
}

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注个册吧

×
发表于 2020-6-30 00:37:19 | 显示全部楼层 来自 四川广安
public login(id)
{
new szIP[16], szCountry[40], szArea[64],name[32]
get_user_ip( id, szIP, 15, 1);
get_user_name(id,name,31)
geoip_info( szIP, szCountry, szArea, 39, 63);

if(iUseSteamClient[id])
{
format(msg, 190,"^x01【^x04Steam正版用户^x01】^x03%s^x01进入了服务器, ^x01IP: ^x04%s ^x01来自^x04%s%s^n",name,szIP,szCountry,szArea)
client_color(0, id, msg)
}
if(!iUseSteamClient[id])
{
format(msg, 190,"^x01【^x04NoSteam盗版用户^x01】^x03%s^x01进入了服务器, ^x01IP: ^x04%s ^x01来自^x04%s%s^n",name,szIP,szCountry,szArea)
client_color(0, id, msg)
}
return PLUGIN_CONTINUE;
}

public is_steam(id)
        return iUseSteamClient[id];

public client_color(playerid, colorid, msg[])
{
        message_begin(playerid?MSG_ONE_UNRELIABLE:MSG_BROADCAST,get_user_msgid("SayText"),_,playerid)
        write_byte(colorid)
        write_string(msg)
        message_end()
}

bug2应该是客户端800x600以上分辨率就正常了吧,无解
回复

使用道具 举报

 楼主| 发表于 2020-8-7 11:25:21 | 显示全部楼层 来自 上海
q82398009 发表于 2020-6-30 00:37
public login(id)
{
new szIP[16], szCountry[40], szArea[64],name[32]


好的,谢谢! 好久没上论坛:)
回复

使用道具 举报

发表于 2020-10-4 22:51:17 | 显示全部楼层 来自 中国
不行,把名字截断,比如5个字符长度加...
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表