查看: 3072|回复: 28

[源码]查看服务器在线玩家信息

[复制链接]
发表于 2012-12-24 07:23:56 | 显示全部楼层 |阅读模式


#include <amxmisc>

#include <csstats>

#include <cstrike>

#include <li_geoip>



new players[33][32], motd[2048], iLen, inum, szstate[4], name[32], stats[8], body[8]



public plugin_init()

{

        register_plugin("Motd info of player", "1.0", "K.K.Lv")



        register_clcmd("say", "checksay")

        register_clcmd("say_team", "checksay")

}



public showinfoa(id, pos)

{

        if (pos < 0)

                return PLUGIN_HANDLED

        new k = 0, star = pos * 32

        new host_name[128]

        get_cvar_string("hostname", host_name, 127)



        get_players(players[id], inum)



        iLen = format(motd, 2047,"<meta charset=UTF-8><style>body{color:#ccFFFF;background-color:#445555;margin-top:5}.one{background-color:#aa9963}.two{background-color:#447866}td{font-size:12px}</style><center><b><font size=4>玩家信息来源表 一</b><table width=650>");

        iLen += format(motd[iLen], 2047-iLen, "%s","<tr bgcolor=#000065><td>#<td>昵称<td>玩家排名<td>玩家IP<td>所在城市</tr>");

        new end = star + 32

        if (end > inum)

                end = inum

        new b = inum - 16

        if (b < 0)

                b = 0

        for (new a = star; a < inum - b; ++a)

        {

                if (equal(szstate,"one")) copy(szstate,3,"two")

                else copy(szstate,3,"one")



                new ipaddress[16], country[40], area[64]

                get_user_ip(players[id][a], ipaddress, 16, 1)

                geoip_info(ipaddress, country, area, 39, 63)



                get_user_name(players[id][a], name, 31)

                new rank_pos = get_user_stats(players[id][a], stats, body)



                iLen += format(motd[iLen], 2047-iLen,"<tr class=%s><td>%d<td>%s<td>%d<td>%s<td>%s-%s^n", szstate, ++k, name, rank_pos, ipaddress, country, area)

        }



        show_motd(id, motd, host_name)



        return 0;

}



public showinfob(id, pos)

{

        if (pos < 0)

                return PLUGIN_HANDLED

        new k = 16, star = pos * 32

        new host_name[128]

        get_cvar_string("hostname", host_name, 127)

        get_players(players[id], inum)



        iLen = format(motd, 2047,"<meta charset=UTF-8><style>body{color:#ccFFFF;background-color:#445555;margin-top:5}.one{background-color:#aa9963}.two{background-color:#447866}td{font-size:12px}</style><center><b><font size=4>玩家信息来源表 二</b><table width=650>")

        iLen += format(motd[iLen], 2047-iLen, "%s","<tr bgcolor=#000065><td>#<td>昵称<td>玩家排名<td>玩家IP<td>所在城市</tr>")

        new end = star + 32

        if (end > inum)

                end = inum

        for (new a = star + 16; a < end; ++a)

        {

                if (equal(szstate,"one")) copy(szstate,3,"two")

                else copy(szstate,3,"one")



                new ipaddress[16], country[40], area[64]

                get_user_ip(players[id][a], ipaddress, 16, 1)

                geoip_info(ipaddress, country, area, 39, 63)



                get_user_name(players[id][a], name, 31)

                new rank_pos = get_user_stats(players[id][a], stats, body)



                iLen += format(motd[iLen], 2047-iLen,"<tr class=%s><td>%d<td>%s<td>%d<td>%s<td>%s-%s^n", szstate, ++k, name, rank_pos, ipaddress, country, area)

        }



        show_motd(id, motd, host_name)



        return 0;

}



public cmdShowInfocheck(id, pos)

{

        new playersunm = get_playersnum()

        if (!(playersunm > 16))

                return PLUGIN_HANDLED

        showinfob(id, pos)

        return PLUGIN_CONTINUE

}



public checksay(id, pos)

{

        new said[32]

        read_args(said, 31)



        if (equali(said, "^"/info1^"") || equali(said, "^"info1^""))

                showinfoa(id, pos)

        else if (equali(said, "^"/info2^"") || equali(said, "^"info2^""))

                cmdShowInfocheck(id, pos)

        return PLUGIN_CONTINUE

}
复制代码

2.jpg
1.jpg

say_info1.rar

1.16 KB, 下载次数: 9

售价: 2 金钱  [记录]

发表于 2013-1-1 15:04:46 | 显示全部楼层
拍脑袋决策,拍胸脯保证,拍屁股走人  
发表于 2013-1-3 21:40:02 | 显示全部楼层
回复一下  
发表于 2013-1-4 04:12:41 | 显示全部楼层
有空一起交流一下  
发表于 2013-1-6 18:39:54 | 显示全部楼层
呵呵 大家好奇嘛 来观看下~~~~  
发表于 2013-1-7 09:54:08 | 显示全部楼层
不对,就是碗是铁的,里边没饭你吃啥去?  
发表于 2014-11-25 17:27:28 | 显示全部楼层
顶也~  
发表于 2014-12-15 04:41:07 | 显示全部楼层
哈哈,这么多的人都回了,我敢不回吗?赶快回一个,很好的,我喜欢  
发表于 2015-1-10 09:51:47 | 显示全部楼层
不错!  
发表于 2015-2-15 10:13:34 | 显示全部楼层
哈哈,有意思~顶顶 ,继续顶顶。继续顶哦  
您需要登录后才可以回帖 登录 | 中文注册

本版积分规则