【求助】IP显示插件BUG问题,感谢。
本帖最后由 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
new g_SpecMode
new msg
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;
get_user_authid(id, SteamID, charsmax(SteamID));
if(containi(SteamID, ":") >= 0)
iUseSteamClient = true;
else
iUseSteamClient = false;
if(is_user_connected(id))
{
set_task(3.0,"login",id);
}
return PLUGIN_CONTINUE;
}
public SetSpecMode(id){
new arg;
read_data( 2, arg, 11);
g_SpecMode = ( arg == '4' );
}
public DisplayInfo(id){
if ( g_SpecMode){
new player = read_data(2);
if ( is_user_connected( player)){
new szName;
get_user_name( player, szName, 31);
new szIP, szCountry, szArea,sxe1;
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;
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, szCountry, szArea,name
get_user_ip( id, szIP, 15, 1);
get_user_name(id,name,31)
geoip_info( szIP, szCountry, szArea, 39, 63);
if(iUseSteamClient)
{
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)
{
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;
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()
}
public login(id)
{
new szIP, szCountry, szArea,name
get_user_ip( id, szIP, 15, 1);
get_user_name(id,name,31)
geoip_info( szIP, szCountry, szArea, 39, 63);
if(iUseSteamClient)
{
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)
{
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;
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以上分辨率就正常了吧,无解 q82398009 发表于 2020-6-30 00:37
public login(id)
{
new szIP, szCountry, szArea,name
好的,谢谢! 好久没上论坛:) 不行,把名字截断,比如5个字符长度加...
页:
[1]